From 3b133dee8daec1e6e72821f3341f9c54e07d6a95 Mon Sep 17 00:00:00 2001 From: Stuart Brown Date: Tue, 27 Jun 2023 15:19:11 +0200 Subject: [PATCH 1/8] feat: add MSTest support to CookieCrumble snapshots --- global.json | 2 +- .../src/CookieCrumble/CookieCrumble.csproj | 1 + .../src/CookieCrumble/Snapshot.cs | 82 ++++++++--- .../CookieCrumble.MSTest.csproj | 28 ++++ .../CookieCrumble.MSTest/SnapshotTests.cs | 134 ++++++++++++++++++ .../SnapshotTests.MatchSnapshot.snap | 3 + .../SnapshotTests.OneSnapshot.snap | 3 + ...napshotTests.OneSnapshot_Post_Fix_ABC.snap | 3 + ...napshotTests.OneSnapshot_Txt_Extension.txt | 3 + .../SnapshotTests.SnapshotBuilder.snap | 17 +++ .../SnapshotTests.SnapshotBuilderAsync.snap | 17 +++ ...Tests.SnapshotBuilder_GraphQL_Segment.snap | 11 ++ ...lder_Segment_Custom_Global_Serializer.snap | 1 + ...Segment_Custom_Serializer_For_Segment.snap | 22 +++ ...hotTests.SnapshotBuilder_Segment_Name.snap | 18 +++ ...ests.SnapshotBuilder_Segment_Name_All.snap | 20 +++ .../SnapshotTests.ThreeSnapshot.snap | 17 +++ .../SnapshotTests.TwoSnapshot.snap | 11 ++ 18 files changed, 371 insertions(+), 22 deletions(-) create mode 100644 src/CookieCrumble/test/CookieCrumble.MSTest/CookieCrumble.MSTest.csproj create mode 100644 src/CookieCrumble/test/CookieCrumble.MSTest/SnapshotTests.cs create mode 100644 src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.MatchSnapshot.snap create mode 100644 src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.OneSnapshot.snap create mode 100644 src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.OneSnapshot_Post_Fix_ABC.snap create mode 100644 src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.OneSnapshot_Txt_Extension.txt create mode 100644 src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder.snap create mode 100644 src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilderAsync.snap create mode 100644 src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder_GraphQL_Segment.snap create mode 100644 src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Custom_Global_Serializer.snap create mode 100644 src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Custom_Serializer_For_Segment.snap create mode 100644 src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Name.snap create mode 100644 src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Name_All.snap create mode 100644 src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.ThreeSnapshot.snap create mode 100644 src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.TwoSnapshot.snap diff --git a/global.json b/global.json index 70e3dcc5080..401762bf0ad 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "7.0.100" + "version": "7.0.302" } } diff --git a/src/CookieCrumble/src/CookieCrumble/CookieCrumble.csproj b/src/CookieCrumble/src/CookieCrumble/CookieCrumble.csproj index f057439ff1a..dcd84ed8b7d 100644 --- a/src/CookieCrumble/src/CookieCrumble/CookieCrumble.csproj +++ b/src/CookieCrumble/src/CookieCrumble/CookieCrumble.csproj @@ -15,6 +15,7 @@ + diff --git a/src/CookieCrumble/src/CookieCrumble/Snapshot.cs b/src/CookieCrumble/src/CookieCrumble/Snapshot.cs index 2cb2320f90d..545f34d3a3e 100644 --- a/src/CookieCrumble/src/CookieCrumble/Snapshot.cs +++ b/src/CookieCrumble/src/CookieCrumble/Snapshot.cs @@ -14,6 +14,25 @@ namespace CookieCrumble; +enum TestType +{ + Unknown, + Xunit, + MSTest +} + +internal sealed class TestInfo +{ + internal string FileName { get; } + internal TestType Type { get; } + + internal TestInfo(string fileName, TestType type) + { + FileName = fileName; + Type = type; + } +} + public sealed class Snapshot { private static readonly object _sync = new(); @@ -35,13 +54,13 @@ public sealed class Snapshot private static readonly JsonSnapshotValueFormatter _defaultFormatter = new(); private readonly List _segments = new(); - private readonly string _fileName; private string _extension; private string? _postFix; + private TestInfo _testInfo; public Snapshot(string? postFix = null, string? extension = null) { - _fileName = CreateFileName(); + _testInfo = GetTestInfo(); _postFix = postFix; _extension = extension ?? ".snap"; } @@ -208,7 +227,7 @@ public async ValueTask MatchAsync(CancellationToken cancellationToken = default) EnsureDirectoryExists(mismatchFile); await using var stream = File.Create(mismatchFile); await stream.WriteAsync(writer.WrittenMemory, cancellationToken); - throw new Xunit.Sdk.XunitException(diff); + throwTestException(diff); } } } @@ -238,7 +257,7 @@ public void Match() EnsureDirectoryExists(mismatchFile); using var stream = File.Create(mismatchFile); stream.Write(writer.WrittenSpan); - throw new Xunit.Sdk.XunitException(diff); + throwTestException(diff); } } } @@ -252,7 +271,7 @@ public void MatchInline(string expected) if (!MatchSnapshot(expected, after, true, out var diff)) { - throw new Xunit.Sdk.XunitException(diff); + throwTestException(diff); } } @@ -346,7 +365,7 @@ private string CreateMismatchDirectoryName() private string CreateSnapshotDirectoryName(bool mismatch = false) { - var directoryName = GetDirectoryName(_fileName)!; + var directoryName = GetDirectoryName(_testInfo.FileName)!; return mismatch ? Combine(directoryName, "__snapshots__", "__MISMATCH__") @@ -380,14 +399,14 @@ private static void EnsureFileDoesNotExist(string file) private string CreateSnapshotFileName() { - var fileName = GetFileNameWithoutExtension(_fileName); + var fileName = GetFileNameWithoutExtension(_testInfo.FileName); return string.IsNullOrEmpty(_postFix) ? string.Concat(fileName, _extension) : string.Concat(fileName, "_", _postFix, _extension); } - private static string CreateFileName() + private static TestInfo GetTestInfo() { foreach (var stackFrame in new StackTrace(true).GetFrames()) { @@ -395,25 +414,28 @@ private static string CreateFileName() var fileName = stackFrame?.GetFileName(); if (method is not null && - !string.IsNullOrEmpty(fileName) && - IsXunitTestMethod(method)) + !string.IsNullOrEmpty(fileName)) { - return Combine(GetDirectoryName(fileName)!, method.ToName()); + var testType = GetTestType(method); + if (testType != TestType.Unknown) + return new TestInfo(Combine(GetDirectoryName(fileName)!, method.ToName()), testType); } - var asyncMethod = EvaluateAsynchronousMethodBase(method); + method = EvaluateAsynchronousMethodBase(method); - if (asyncMethod is not null && - !string.IsNullOrEmpty(fileName) && - IsXunitTestMethod(asyncMethod)) + if (method is not null && + !string.IsNullOrEmpty(fileName)) { - return Combine(GetDirectoryName(fileName)!, asyncMethod.ToName()); + var testType = GetTestType(method); + if (testType != TestType.Unknown) + return new TestInfo(Combine(GetDirectoryName(fileName)!, method.ToName()), testType); } } throw new Exception( "The snapshot full name could not be evaluated. " + - "This error can occur, if you use the snapshot match " + + "Only XUnit or MSTest test suites are supported. " + + "This error can also occur, if you use the snapshot match " + "within a async test helper child method. To solve this issue, " + "use the Snapshot.FullName directly in the unit test to " + "get the snapshot name, then reach this name to your " + @@ -443,20 +465,38 @@ from methodInfo in classDeclaringType.GetMethods() return actualMethodInfo; } - private static bool IsXunitTestMethod(MemberInfo? method) + private static TestType GetTestType(MemberInfo? method) { - var isFactTest = IsFactTestMethod(method); - var isTheoryTest = IsTheoryTestMethod(method); + if (IsMSTestMethod(method)) + return TestType.MSTest; + + if (IsXunitTestMethod(method)) + return TestType.Xunit; - return isFactTest || isTheoryTest; + return TestType.Unknown; } + private static bool IsMSTestMethod(MemberInfo? method) + => method?.GetCustomAttributes(typeof(Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute)).Any() ?? false; + + private static bool IsXunitTestMethod(MemberInfo? method) + => IsFactTestMethod(method) || IsTheoryTestMethod(method); + private static bool IsFactTestMethod(MemberInfo? method) => method?.GetCustomAttributes(typeof(FactAttribute)).Any() ?? false; private static bool IsTheoryTestMethod(MemberInfo? method) => method?.GetCustomAttributes(typeof(TheoryAttribute)).Any() ?? false; + private void throwTestException(string message) + { + if (_testInfo.Type == TestType.Xunit) + throw new Xunit.Sdk.XunitException(message); + + if (_testInfo.Type == TestType.MSTest) + throw new Microsoft.VisualStudio.TestTools.UnitTesting.AssertFailedException(message); + } + private struct SnapshotSegment { public SnapshotSegment(string? name, object? value, ISnapshotValueFormatter formatter) diff --git a/src/CookieCrumble/test/CookieCrumble.MSTest/CookieCrumble.MSTest.csproj b/src/CookieCrumble/test/CookieCrumble.MSTest/CookieCrumble.MSTest.csproj new file mode 100644 index 00000000000..01a9d1d9772 --- /dev/null +++ b/src/CookieCrumble/test/CookieCrumble.MSTest/CookieCrumble.MSTest.csproj @@ -0,0 +1,28 @@ + + + + $(Library2TargetFrameworks) + enable + enable + + false + + CookieCrumble.MSTest + CookieCrumble + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + + + diff --git a/src/CookieCrumble/test/CookieCrumble.MSTest/SnapshotTests.cs b/src/CookieCrumble/test/CookieCrumble.MSTest/SnapshotTests.cs new file mode 100644 index 00000000000..95f7985ed36 --- /dev/null +++ b/src/CookieCrumble/test/CookieCrumble.MSTest/SnapshotTests.cs @@ -0,0 +1,134 @@ +using System.Buffers; +using System.Text; +using CookieCrumble.Formatters; +using HotChocolate.Language; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace CookieCrumble; + +[TestClass] +public class SnapshotTests +{ + [TestMethod] + public void MatchSnapshot() + { + new MyClass().MatchSnapshot(); + } + + [TestMethod] + public void OneSnapshot() + { + Snapshot.Match(new MyClass()); + } + + [TestMethod] + public void OneSnapshot_Txt_Extension() + { + Snapshot.Match(new MyClass(), extension: ".txt"); + } + + [TestMethod] + public void OneSnapshot_Post_Fix() + { + Snapshot.Match(new MyClass(), "ABC"); + } + + [TestMethod] + public void TwoSnapshot() + { + Snapshot.Match(new MyClass(), new MyClass()); + } + + [TestMethod] + public void ThreeSnapshot() + { + Snapshot.Match(new MyClass(), new MyClass(), new MyClass()); + } + + [TestMethod] + public void SnapshotBuilder() + { + var snapshot = new Snapshot(); + snapshot.Add(new MyClass()); + snapshot.Add(new MyClass { Foo = "Bar" }); + snapshot.Add(new MyClass { Foo = "Baz" }); + snapshot.Match(); + } + + [TestMethod] + public async Task SnapshotBuilderAsync() + { + var snapshot = new Snapshot(); + snapshot.Add(new MyClass()); + snapshot.Add(new MyClass { Foo = "Bar" }); + snapshot.Add(new MyClass { Foo = "Baz" }); + await snapshot.MatchAsync(); + } + + [TestMethod] + public void SnapshotBuilder_Segment_Name() + { + var snapshot = new Snapshot(); + snapshot.Add(new MyClass()); + snapshot.Add(new MyClass { Foo = "Bar" }, "Bar:"); + snapshot.Add(new MyClass { Foo = "Baz" }); + snapshot.Match(); + } + + [TestMethod] + public void SnapshotBuilder_Segment_Name_All() + { + var snapshot = new Snapshot(); + snapshot.Add(new MyClass(), "Segment 1:"); + snapshot.Add(new MyClass { Foo = "Bar" }, "Segment 2:"); + snapshot.Add(new MyClass { Foo = "Baz" }, "Segment 3:"); + snapshot.Match(); + } + + [TestMethod] + public void SnapshotBuilder_Segment_Custom_Serializer_For_Segment() + { + var snapshot = new Snapshot(); + snapshot.Add(new MyClass()); + snapshot.Add(new MyClass { Foo = "Baz" }, "Bar:", new CustomSerializer()); + snapshot.Add(new MyClass { Foo = "Baz" }); + snapshot.Add(new MyClass { Foo = "Baz" }); + snapshot.Match(); + } + + [TestMethod] + public void SnapshotBuilder_Segment_Custom_Global_Serializer() + { + Snapshot.RegisterFormatter(new CustomSerializer()); + + var snapshot = new Snapshot(); + snapshot.Add(new MyClass { Foo = "123" }); + snapshot.Match(); + } + + [TestMethod] + public void SnapshotBuilder_GraphQL_Segment() + { + var snapshot = new Snapshot(); + snapshot.Add(new MyClass { Foo = "def" }); + snapshot.Add(Utf8GraphQLParser.Parse("{ abc }")); + snapshot.Match(); + } + + public class MyClass + { + public string Foo { get; set; } = "Bar"; + } + + public class CustomSerializer : ISnapshotValueFormatter + { + public bool CanHandle(object? value) + => value is MyClass { Foo: "123" }; + + public void Format(IBufferWriter snapshot, object? value) + { + var myClass = (MyClass)value!; + Encoding.UTF8.GetBytes(myClass.Foo.AsSpan(), snapshot); + } + } +} diff --git a/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.MatchSnapshot.snap b/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.MatchSnapshot.snap new file mode 100644 index 00000000000..a045e0a6e4a --- /dev/null +++ b/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.MatchSnapshot.snap @@ -0,0 +1,3 @@ +{ + "Foo": "Bar" +} \ No newline at end of file diff --git a/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.OneSnapshot.snap b/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.OneSnapshot.snap new file mode 100644 index 00000000000..a045e0a6e4a --- /dev/null +++ b/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.OneSnapshot.snap @@ -0,0 +1,3 @@ +{ + "Foo": "Bar" +} \ No newline at end of file diff --git a/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.OneSnapshot_Post_Fix_ABC.snap b/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.OneSnapshot_Post_Fix_ABC.snap new file mode 100644 index 00000000000..a045e0a6e4a --- /dev/null +++ b/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.OneSnapshot_Post_Fix_ABC.snap @@ -0,0 +1,3 @@ +{ + "Foo": "Bar" +} \ No newline at end of file diff --git a/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.OneSnapshot_Txt_Extension.txt b/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.OneSnapshot_Txt_Extension.txt new file mode 100644 index 00000000000..a045e0a6e4a --- /dev/null +++ b/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.OneSnapshot_Txt_Extension.txt @@ -0,0 +1,3 @@ +{ + "Foo": "Bar" +} \ No newline at end of file diff --git a/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder.snap b/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder.snap new file mode 100644 index 00000000000..30a62919f50 --- /dev/null +++ b/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder.snap @@ -0,0 +1,17 @@ +--------------- +{ + "Foo": "Bar" +} +--------------- + +--------------- +{ + "Foo": "Bar" +} +--------------- + +--------------- +{ + "Foo": "Baz" +} +--------------- diff --git a/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilderAsync.snap b/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilderAsync.snap new file mode 100644 index 00000000000..30a62919f50 --- /dev/null +++ b/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilderAsync.snap @@ -0,0 +1,17 @@ +--------------- +{ + "Foo": "Bar" +} +--------------- + +--------------- +{ + "Foo": "Bar" +} +--------------- + +--------------- +{ + "Foo": "Baz" +} +--------------- diff --git a/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder_GraphQL_Segment.snap b/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder_GraphQL_Segment.snap new file mode 100644 index 00000000000..5fb1a0da16f --- /dev/null +++ b/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder_GraphQL_Segment.snap @@ -0,0 +1,11 @@ +--------------- +{ + "Foo": "def" +} +--------------- + +--------------- +{ + abc +} +--------------- diff --git a/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Custom_Global_Serializer.snap b/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Custom_Global_Serializer.snap new file mode 100644 index 00000000000..d800886d9c8 --- /dev/null +++ b/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Custom_Global_Serializer.snap @@ -0,0 +1 @@ +123 \ No newline at end of file diff --git a/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Custom_Serializer_For_Segment.snap b/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Custom_Serializer_For_Segment.snap new file mode 100644 index 00000000000..60005ece07f --- /dev/null +++ b/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Custom_Serializer_For_Segment.snap @@ -0,0 +1,22 @@ +--------------- +{ + "Foo": "Bar" +} +--------------- + +Bar: +--------------- +Baz +--------------- + +--------------- +{ + "Foo": "Baz" +} +--------------- + +--------------- +{ + "Foo": "Baz" +} +--------------- diff --git a/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Name.snap b/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Name.snap new file mode 100644 index 00000000000..fecc879c52d --- /dev/null +++ b/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Name.snap @@ -0,0 +1,18 @@ +--------------- +{ + "Foo": "Bar" +} +--------------- + +Bar: +--------------- +{ + "Foo": "Bar" +} +--------------- + +--------------- +{ + "Foo": "Baz" +} +--------------- diff --git a/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Name_All.snap b/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Name_All.snap new file mode 100644 index 00000000000..71225eaeefc --- /dev/null +++ b/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Name_All.snap @@ -0,0 +1,20 @@ +Segment 1: +--------------- +{ + "Foo": "Bar" +} +--------------- + +Segment 2: +--------------- +{ + "Foo": "Bar" +} +--------------- + +Segment 3: +--------------- +{ + "Foo": "Baz" +} +--------------- diff --git a/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.ThreeSnapshot.snap b/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.ThreeSnapshot.snap new file mode 100644 index 00000000000..cfd5e7f6e49 --- /dev/null +++ b/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.ThreeSnapshot.snap @@ -0,0 +1,17 @@ +--------------- +{ + "Foo": "Bar" +} +--------------- + +--------------- +{ + "Foo": "Bar" +} +--------------- + +--------------- +{ + "Foo": "Bar" +} +--------------- diff --git a/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.TwoSnapshot.snap b/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.TwoSnapshot.snap new file mode 100644 index 00000000000..f9b5b954f12 --- /dev/null +++ b/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.TwoSnapshot.snap @@ -0,0 +1,11 @@ +--------------- +{ + "Foo": "Bar" +} +--------------- + +--------------- +{ + "Foo": "Bar" +} +--------------- From f9af5ec79998b5a19bab53948e3de73598acf695 Mon Sep 17 00:00:00 2001 From: Stuart Brown Date: Thu, 14 Sep 2023 16:03:48 +0200 Subject: [PATCH 2/8] feat: decouple unit test framework specific code --- .vscode/settings.json | 4 +- src/CookieCrumble/CookieCrumble.sln | 21 ++++ .../CookieCrumble.MSTest.csproj | 17 +++ .../CookieCrumble.MSTest/MSTestFramework.cs | 15 +++ .../CookieCrumble.Xunit.csproj | 17 +++ .../src/CookieCrumble.Xunit/XunitFramework.cs | 23 ++++ .../src/CookieCrumble/CookieCrumble.csproj | 2 - .../src/CookieCrumble/ITestFramework.cs | 9 ++ .../src/CookieCrumble/Snapshot.cs | 102 ++++++------------ .../CookieCrumble.MSTests.csproj} | 3 +- .../SnapshotTests.cs | 10 +- .../SnapshotMSTests.MatchSnapshot.snap} | 0 .../SnapshotMSTests.OneSnapshot.snap} | 0 ...shotMSTests.OneSnapshot_Post_Fix_ABC.snap} | 0 ...shotMSTests.OneSnapshot_Txt_Extension.txt} | 0 .../SnapshotMSTests.SnapshotBuilder.snap} | 0 ...SnapshotMSTests.SnapshotBuilderAsync.snap} | 0 ...ests.SnapshotBuilder_GraphQL_Segment.snap} | 0 ...der_Segment_Custom_Global_Serializer.snap} | 0 ...egment_Custom_Serializer_For_Segment.snap} | 0 ...MSTests.SnapshotBuilder_Segment_Name.snap} | 0 ...sts.SnapshotBuilder_Segment_Name_All.snap} | 0 .../SnapshotMSTests.ThreeSnapshot.snap} | 0 .../SnapshotMSTests.TwoSnapshot.snap} | 0 .../SnapshotTests.MatchSnapshot.snap | 3 + .../SnapshotTests.OneSnapshot.snap | 3 + ...napshotTests.OneSnapshot_Post_Fix_ABC.snap | 3 + ...napshotTests.OneSnapshot_Txt_Extension.txt | 3 + .../SnapshotTests.SnapshotBuilder.snap | 17 +++ .../SnapshotTests.SnapshotBuilderAsync.snap | 17 +++ ...Tests.SnapshotBuilder_GraphQL_Segment.snap | 11 ++ ...lder_Segment_Custom_Global_Serializer.snap | 1 + ...Segment_Custom_Serializer_For_Segment.snap | 22 ++++ ...hotTests.SnapshotBuilder_Segment_Name.snap | 18 ++++ ...ests.SnapshotBuilder_Segment_Name_All.snap | 20 ++++ .../SnapshotTests.ThreeSnapshot.snap | 17 +++ .../SnapshotTests.TwoSnapshot.snap | 11 ++ .../CookieCrumble.Tests.csproj | 1 + .../test/CookieCrumble.Tests/SnapshotTests.cs | 7 +- 39 files changed, 300 insertions(+), 77 deletions(-) create mode 100644 src/CookieCrumble/src/CookieCrumble.MSTest/CookieCrumble.MSTest.csproj create mode 100644 src/CookieCrumble/src/CookieCrumble.MSTest/MSTestFramework.cs create mode 100644 src/CookieCrumble/src/CookieCrumble.Xunit/CookieCrumble.Xunit.csproj create mode 100644 src/CookieCrumble/src/CookieCrumble.Xunit/XunitFramework.cs create mode 100644 src/CookieCrumble/src/CookieCrumble/ITestFramework.cs rename src/CookieCrumble/test/{CookieCrumble.MSTest/CookieCrumble.MSTest.csproj => CookieCrumble.MSTests/CookieCrumble.MSTests.csproj} (85%) rename src/CookieCrumble/test/{CookieCrumble.MSTest => CookieCrumble.MSTests}/SnapshotTests.cs (93%) rename src/CookieCrumble/test/{CookieCrumble.MSTest/__snapshots__/SnapshotTests.MatchSnapshot.snap => CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.MatchSnapshot.snap} (100%) rename src/CookieCrumble/test/{CookieCrumble.MSTest/__snapshots__/SnapshotTests.OneSnapshot.snap => CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.OneSnapshot.snap} (100%) rename src/CookieCrumble/test/{CookieCrumble.MSTest/__snapshots__/SnapshotTests.OneSnapshot_Post_Fix_ABC.snap => CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.OneSnapshot_Post_Fix_ABC.snap} (100%) rename src/CookieCrumble/test/{CookieCrumble.MSTest/__snapshots__/SnapshotTests.OneSnapshot_Txt_Extension.txt => CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.OneSnapshot_Txt_Extension.txt} (100%) rename src/CookieCrumble/test/{CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder.snap => CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder.snap} (100%) rename src/CookieCrumble/test/{CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilderAsync.snap => CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilderAsync.snap} (100%) rename src/CookieCrumble/test/{CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder_GraphQL_Segment.snap => CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder_GraphQL_Segment.snap} (100%) rename src/CookieCrumble/test/{CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Custom_Global_Serializer.snap => CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder_Segment_Custom_Global_Serializer.snap} (100%) rename src/CookieCrumble/test/{CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Custom_Serializer_For_Segment.snap => CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder_Segment_Custom_Serializer_For_Segment.snap} (100%) rename src/CookieCrumble/test/{CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Name.snap => CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder_Segment_Name.snap} (100%) rename src/CookieCrumble/test/{CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Name_All.snap => CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder_Segment_Name_All.snap} (100%) rename src/CookieCrumble/test/{CookieCrumble.MSTest/__snapshots__/SnapshotTests.ThreeSnapshot.snap => CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.ThreeSnapshot.snap} (100%) rename src/CookieCrumble/test/{CookieCrumble.MSTest/__snapshots__/SnapshotTests.TwoSnapshot.snap => CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.TwoSnapshot.snap} (100%) create mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.MatchSnapshot.snap create mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.OneSnapshot.snap create mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.OneSnapshot_Post_Fix_ABC.snap create mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.OneSnapshot_Txt_Extension.txt create mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder.snap create mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilderAsync.snap create mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder_GraphQL_Segment.snap create mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Custom_Global_Serializer.snap create mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Custom_Serializer_For_Segment.snap create mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Name.snap create mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Name_All.snap create mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.ThreeSnapshot.snap create mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.TwoSnapshot.snap diff --git a/.vscode/settings.json b/.vscode/settings.json index a56d7907913..1f698c53a35 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,4 @@ { - "omnisharp.defaultLaunchSolution": "src/All.sln", "search.exclude": { "**/node_modules": true, "**/bower_components": true, @@ -22,5 +21,6 @@ }, "cSpell.words": [ "Nats" - ] + ], + "dotnet.defaultSolution": "src/All.sln" } diff --git a/src/CookieCrumble/CookieCrumble.sln b/src/CookieCrumble/CookieCrumble.sln index e6647f68713..7330e0cdf0e 100644 --- a/src/CookieCrumble/CookieCrumble.sln +++ b/src/CookieCrumble/CookieCrumble.sln @@ -11,6 +11,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{EB8F1D90-6 EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CookieCrumble.Tests", "test\CookieCrumble.Tests\CookieCrumble.Tests.csproj", "{844E7501-7ED6-4548-8E99-D8E50D4F39A4}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CookieCrumble.MSTest", "src\CookieCrumble.MSTest\CookieCrumble.MSTest.csproj", "{A7F12BB5-F71C-484D-BABA-2980FE873B59}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CookieCrumble.Xunit", "src\CookieCrumble.Xunit\CookieCrumble.Xunit.csproj", "{CEE25A68-69B5-4CFD-9C35-E82736B1E205}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CookieCrumble.MSTests", "test\CookieCrumble.MSTests\CookieCrumble.MSTests.csproj", "{F83B1337-9535-4121-8B78-89EC970CA705}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -28,9 +34,24 @@ Global {844E7501-7ED6-4548-8E99-D8E50D4F39A4}.Debug|Any CPU.Build.0 = Debug|Any CPU {844E7501-7ED6-4548-8E99-D8E50D4F39A4}.Release|Any CPU.ActiveCfg = Release|Any CPU {844E7501-7ED6-4548-8E99-D8E50D4F39A4}.Release|Any CPU.Build.0 = Release|Any CPU + {A7F12BB5-F71C-484D-BABA-2980FE873B59}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A7F12BB5-F71C-484D-BABA-2980FE873B59}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A7F12BB5-F71C-484D-BABA-2980FE873B59}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A7F12BB5-F71C-484D-BABA-2980FE873B59}.Release|Any CPU.Build.0 = Release|Any CPU + {CEE25A68-69B5-4CFD-9C35-E82736B1E205}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CEE25A68-69B5-4CFD-9C35-E82736B1E205}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CEE25A68-69B5-4CFD-9C35-E82736B1E205}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CEE25A68-69B5-4CFD-9C35-E82736B1E205}.Release|Any CPU.Build.0 = Release|Any CPU + {F83B1337-9535-4121-8B78-89EC970CA705}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F83B1337-9535-4121-8B78-89EC970CA705}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F83B1337-9535-4121-8B78-89EC970CA705}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F83B1337-9535-4121-8B78-89EC970CA705}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(NestedProjects) = preSolution {8E71FA9B-8352-4675-A9B4-A934E40AF9E0} = {2465C122-714C-4D0A-A24D-D9C22A25D73A} {844E7501-7ED6-4548-8E99-D8E50D4F39A4} = {EB8F1D90-60D6-48FA-9744-D4180A0E4AC0} + {A7F12BB5-F71C-484D-BABA-2980FE873B59} = {2465C122-714C-4D0A-A24D-D9C22A25D73A} + {CEE25A68-69B5-4CFD-9C35-E82736B1E205} = {2465C122-714C-4D0A-A24D-D9C22A25D73A} + {F83B1337-9535-4121-8B78-89EC970CA705} = {EB8F1D90-60D6-48FA-9744-D4180A0E4AC0} EndGlobalSection EndGlobal diff --git a/src/CookieCrumble/src/CookieCrumble.MSTest/CookieCrumble.MSTest.csproj b/src/CookieCrumble/src/CookieCrumble.MSTest/CookieCrumble.MSTest.csproj new file mode 100644 index 00000000000..1d1abe27998 --- /dev/null +++ b/src/CookieCrumble/src/CookieCrumble.MSTest/CookieCrumble.MSTest.csproj @@ -0,0 +1,17 @@ + + + + $(Library2TargetFrameworks) + enable + enable + + + + + + + + + + + diff --git a/src/CookieCrumble/src/CookieCrumble.MSTest/MSTestFramework.cs b/src/CookieCrumble/src/CookieCrumble.MSTest/MSTestFramework.cs new file mode 100644 index 00000000000..4752cdfaf9e --- /dev/null +++ b/src/CookieCrumble/src/CookieCrumble.MSTest/MSTestFramework.cs @@ -0,0 +1,15 @@ +using CookieCrumble; +using System.Reflection; + +namespace CookieCrumble.MSTest; + +public class MSTestFramework : ITestFramework +{ + public bool IsValidTestMethod(MemberInfo? method) + => method?.GetCustomAttributes(typeof(Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute)).Any() ?? false; + + public void ThrowTestException(string message) + { + throw new Microsoft.VisualStudio.TestTools.UnitTesting.AssertFailedException(message); + } +} diff --git a/src/CookieCrumble/src/CookieCrumble.Xunit/CookieCrumble.Xunit.csproj b/src/CookieCrumble/src/CookieCrumble.Xunit/CookieCrumble.Xunit.csproj new file mode 100644 index 00000000000..19cc78da811 --- /dev/null +++ b/src/CookieCrumble/src/CookieCrumble.Xunit/CookieCrumble.Xunit.csproj @@ -0,0 +1,17 @@ + + + + $(Library2TargetFrameworks) + enable + enable + + + + + + + + + + + diff --git a/src/CookieCrumble/src/CookieCrumble.Xunit/XunitFramework.cs b/src/CookieCrumble/src/CookieCrumble.Xunit/XunitFramework.cs new file mode 100644 index 00000000000..805e0f8908e --- /dev/null +++ b/src/CookieCrumble/src/CookieCrumble.Xunit/XunitFramework.cs @@ -0,0 +1,23 @@ +using CookieCrumble; +using System.Reflection; +using Xunit; +using Xunit.Sdk; + +namespace CookieCrumble.Xunit; + +public class XunitFramework : ITestFramework +{ + public bool IsValidTestMethod(MemberInfo? method) + => IsFactTestMethod(method) || IsTheoryTestMethod(method); + + private static bool IsFactTestMethod(MemberInfo? method) + => method?.GetCustomAttributes(typeof(FactAttribute)).Any() ?? false; + + private static bool IsTheoryTestMethod(MemberInfo? method) + => method?.GetCustomAttributes(typeof(TheoryAttribute)).Any() ?? false; + + public void ThrowTestException(string message) + { + throw new XunitException(message); + } +} \ No newline at end of file diff --git a/src/CookieCrumble/src/CookieCrumble/CookieCrumble.csproj b/src/CookieCrumble/src/CookieCrumble/CookieCrumble.csproj index dcd84ed8b7d..61488c54816 100644 --- a/src/CookieCrumble/src/CookieCrumble/CookieCrumble.csproj +++ b/src/CookieCrumble/src/CookieCrumble/CookieCrumble.csproj @@ -13,9 +13,7 @@ - - diff --git a/src/CookieCrumble/src/CookieCrumble/ITestFramework.cs b/src/CookieCrumble/src/CookieCrumble/ITestFramework.cs new file mode 100644 index 00000000000..a2c6d3023a3 --- /dev/null +++ b/src/CookieCrumble/src/CookieCrumble/ITestFramework.cs @@ -0,0 +1,9 @@ +using System.Reflection; + +namespace CookieCrumble; + +public interface ITestFramework +{ + bool IsValidTestMethod(MemberInfo? method); + void ThrowTestException(string message); +} \ No newline at end of file diff --git a/src/CookieCrumble/src/CookieCrumble/Snapshot.cs b/src/CookieCrumble/src/CookieCrumble/Snapshot.cs index 545f34d3a3e..0ea5925f58b 100644 --- a/src/CookieCrumble/src/CookieCrumble/Snapshot.cs +++ b/src/CookieCrumble/src/CookieCrumble/Snapshot.cs @@ -8,31 +8,11 @@ using CookieCrumble.Formatters; using DiffPlex.DiffBuilder; using DiffPlex.DiffBuilder.Model; -using Xunit; using static System.Collections.Immutable.ImmutableStack; using static System.IO.Path; namespace CookieCrumble; -enum TestType -{ - Unknown, - Xunit, - MSTest -} - -internal sealed class TestInfo -{ - internal string FileName { get; } - internal TestType Type { get; } - - internal TestInfo(string fileName, TestType type) - { - FileName = fileName; - Type = type; - } -} - public sealed class Snapshot { private static readonly object _sync = new(); @@ -52,15 +32,20 @@ public sealed class Snapshot #endif }); private static readonly JsonSnapshotValueFormatter _defaultFormatter = new(); - + private static ITestFramework _testFramework; private readonly List _segments = new(); private string _extension; private string? _postFix; - private TestInfo _testInfo; + private string? _fileName; public Snapshot(string? postFix = null, string? extension = null) { - _testInfo = GetTestInfo(); + if (_testFramework is null) + { + throw new Exception("Please initialise a test framework before using Snapshot"); + } + + _fileName = GetFilename(); _postFix = postFix; _extension = extension ?? ".snap"; } @@ -107,6 +92,19 @@ public static void Match( snapshot.Match(); } + public static void RegisterTestFramework(ITestFramework testFramework) + { + if (testFramework is null) + { + throw new ArgumentNullException(nameof(testFramework)); + } + + lock (_sync) + { + _testFramework = testFramework; + } + } + public static void RegisterFormatter( ISnapshotValueFormatter formatter) { @@ -227,7 +225,7 @@ public async ValueTask MatchAsync(CancellationToken cancellationToken = default) EnsureDirectoryExists(mismatchFile); await using var stream = File.Create(mismatchFile); await stream.WriteAsync(writer.WrittenMemory, cancellationToken); - throwTestException(diff); + _testFramework.ThrowTestException(diff); } } } @@ -257,7 +255,7 @@ public void Match() EnsureDirectoryExists(mismatchFile); using var stream = File.Create(mismatchFile); stream.Write(writer.WrittenSpan); - throwTestException(diff); + _testFramework.ThrowTestException(diff); } } } @@ -271,7 +269,7 @@ public void MatchInline(string expected) if (!MatchSnapshot(expected, after, true, out var diff)) { - throwTestException(diff); + _testFramework.ThrowTestException(diff); } } @@ -365,7 +363,7 @@ private string CreateMismatchDirectoryName() private string CreateSnapshotDirectoryName(bool mismatch = false) { - var directoryName = GetDirectoryName(_testInfo.FileName)!; + var directoryName = GetDirectoryName(_fileName)!; return mismatch ? Combine(directoryName, "__snapshots__", "__MISMATCH__") @@ -399,14 +397,14 @@ private static void EnsureFileDoesNotExist(string file) private string CreateSnapshotFileName() { - var fileName = GetFileNameWithoutExtension(_testInfo.FileName); + var fileName = GetFileNameWithoutExtension(_fileName); return string.IsNullOrEmpty(_postFix) ? string.Concat(fileName, _extension) : string.Concat(fileName, "_", _postFix, _extension); } - private static TestInfo GetTestInfo() + private static string GetFilename() { foreach (var stackFrame in new StackTrace(true).GetFrames()) { @@ -414,21 +412,19 @@ private static TestInfo GetTestInfo() var fileName = stackFrame?.GetFileName(); if (method is not null && - !string.IsNullOrEmpty(fileName)) + !string.IsNullOrEmpty(fileName) && + _testFramework.IsValidTestMethod(method)) { - var testType = GetTestType(method); - if (testType != TestType.Unknown) - return new TestInfo(Combine(GetDirectoryName(fileName)!, method.ToName()), testType); + return Combine(GetDirectoryName(fileName)!, method.ToName()); } method = EvaluateAsynchronousMethodBase(method); if (method is not null && - !string.IsNullOrEmpty(fileName)) + !string.IsNullOrEmpty(fileName) && + _testFramework.IsValidTestMethod(method)) { - var testType = GetTestType(method); - if (testType != TestType.Unknown) - return new TestInfo(Combine(GetDirectoryName(fileName)!, method.ToName()), testType); + return Combine(GetDirectoryName(fileName)!, method.ToName()); } } @@ -465,38 +461,6 @@ from methodInfo in classDeclaringType.GetMethods() return actualMethodInfo; } - private static TestType GetTestType(MemberInfo? method) - { - if (IsMSTestMethod(method)) - return TestType.MSTest; - - if (IsXunitTestMethod(method)) - return TestType.Xunit; - - return TestType.Unknown; - } - - private static bool IsMSTestMethod(MemberInfo? method) - => method?.GetCustomAttributes(typeof(Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute)).Any() ?? false; - - private static bool IsXunitTestMethod(MemberInfo? method) - => IsFactTestMethod(method) || IsTheoryTestMethod(method); - - private static bool IsFactTestMethod(MemberInfo? method) - => method?.GetCustomAttributes(typeof(FactAttribute)).Any() ?? false; - - private static bool IsTheoryTestMethod(MemberInfo? method) - => method?.GetCustomAttributes(typeof(TheoryAttribute)).Any() ?? false; - - private void throwTestException(string message) - { - if (_testInfo.Type == TestType.Xunit) - throw new Xunit.Sdk.XunitException(message); - - if (_testInfo.Type == TestType.MSTest) - throw new Microsoft.VisualStudio.TestTools.UnitTesting.AssertFailedException(message); - } - private struct SnapshotSegment { public SnapshotSegment(string? name, object? value, ISnapshotValueFormatter formatter) diff --git a/src/CookieCrumble/test/CookieCrumble.MSTest/CookieCrumble.MSTest.csproj b/src/CookieCrumble/test/CookieCrumble.MSTests/CookieCrumble.MSTests.csproj similarity index 85% rename from src/CookieCrumble/test/CookieCrumble.MSTest/CookieCrumble.MSTest.csproj rename to src/CookieCrumble/test/CookieCrumble.MSTests/CookieCrumble.MSTests.csproj index 01a9d1d9772..0382649f846 100644 --- a/src/CookieCrumble/test/CookieCrumble.MSTest/CookieCrumble.MSTest.csproj +++ b/src/CookieCrumble/test/CookieCrumble.MSTests/CookieCrumble.MSTests.csproj @@ -7,7 +7,7 @@ false - CookieCrumble.MSTest + CookieCrumble.MSTests CookieCrumble @@ -22,6 +22,7 @@ + diff --git a/src/CookieCrumble/test/CookieCrumble.MSTest/SnapshotTests.cs b/src/CookieCrumble/test/CookieCrumble.MSTests/SnapshotTests.cs similarity index 93% rename from src/CookieCrumble/test/CookieCrumble.MSTest/SnapshotTests.cs rename to src/CookieCrumble/test/CookieCrumble.MSTests/SnapshotTests.cs index 95f7985ed36..0535d0f9c2a 100644 --- a/src/CookieCrumble/test/CookieCrumble.MSTest/SnapshotTests.cs +++ b/src/CookieCrumble/test/CookieCrumble.MSTests/SnapshotTests.cs @@ -4,11 +4,17 @@ using HotChocolate.Language; using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace CookieCrumble; +namespace CookieCrumble.MSTests; [TestClass] -public class SnapshotTests +public class SnapshotMSTests { + [TestInitialize()] + public void Initialize() + { + CookieCrumble.Snapshot.RegisterTestFramework(new CookieCrumble.MSTest.MSTestFramework()); + } + [TestMethod] public void MatchSnapshot() { diff --git a/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.MatchSnapshot.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.MatchSnapshot.snap similarity index 100% rename from src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.MatchSnapshot.snap rename to src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.MatchSnapshot.snap diff --git a/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.OneSnapshot.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.OneSnapshot.snap similarity index 100% rename from src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.OneSnapshot.snap rename to src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.OneSnapshot.snap diff --git a/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.OneSnapshot_Post_Fix_ABC.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.OneSnapshot_Post_Fix_ABC.snap similarity index 100% rename from src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.OneSnapshot_Post_Fix_ABC.snap rename to src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.OneSnapshot_Post_Fix_ABC.snap diff --git a/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.OneSnapshot_Txt_Extension.txt b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.OneSnapshot_Txt_Extension.txt similarity index 100% rename from src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.OneSnapshot_Txt_Extension.txt rename to src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.OneSnapshot_Txt_Extension.txt diff --git a/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder.snap similarity index 100% rename from src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder.snap rename to src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder.snap diff --git a/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilderAsync.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilderAsync.snap similarity index 100% rename from src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilderAsync.snap rename to src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilderAsync.snap diff --git a/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder_GraphQL_Segment.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder_GraphQL_Segment.snap similarity index 100% rename from src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder_GraphQL_Segment.snap rename to src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder_GraphQL_Segment.snap diff --git a/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Custom_Global_Serializer.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder_Segment_Custom_Global_Serializer.snap similarity index 100% rename from src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Custom_Global_Serializer.snap rename to src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder_Segment_Custom_Global_Serializer.snap diff --git a/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Custom_Serializer_For_Segment.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder_Segment_Custom_Serializer_For_Segment.snap similarity index 100% rename from src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Custom_Serializer_For_Segment.snap rename to src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder_Segment_Custom_Serializer_For_Segment.snap diff --git a/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Name.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder_Segment_Name.snap similarity index 100% rename from src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Name.snap rename to src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder_Segment_Name.snap diff --git a/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Name_All.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder_Segment_Name_All.snap similarity index 100% rename from src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Name_All.snap rename to src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder_Segment_Name_All.snap diff --git a/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.ThreeSnapshot.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.ThreeSnapshot.snap similarity index 100% rename from src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.ThreeSnapshot.snap rename to src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.ThreeSnapshot.snap diff --git a/src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.TwoSnapshot.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.TwoSnapshot.snap similarity index 100% rename from src/CookieCrumble/test/CookieCrumble.MSTest/__snapshots__/SnapshotTests.TwoSnapshot.snap rename to src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.TwoSnapshot.snap diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.MatchSnapshot.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.MatchSnapshot.snap new file mode 100644 index 00000000000..a045e0a6e4a --- /dev/null +++ b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.MatchSnapshot.snap @@ -0,0 +1,3 @@ +{ + "Foo": "Bar" +} \ No newline at end of file diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.OneSnapshot.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.OneSnapshot.snap new file mode 100644 index 00000000000..a045e0a6e4a --- /dev/null +++ b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.OneSnapshot.snap @@ -0,0 +1,3 @@ +{ + "Foo": "Bar" +} \ No newline at end of file diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.OneSnapshot_Post_Fix_ABC.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.OneSnapshot_Post_Fix_ABC.snap new file mode 100644 index 00000000000..a045e0a6e4a --- /dev/null +++ b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.OneSnapshot_Post_Fix_ABC.snap @@ -0,0 +1,3 @@ +{ + "Foo": "Bar" +} \ No newline at end of file diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.OneSnapshot_Txt_Extension.txt b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.OneSnapshot_Txt_Extension.txt new file mode 100644 index 00000000000..a045e0a6e4a --- /dev/null +++ b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.OneSnapshot_Txt_Extension.txt @@ -0,0 +1,3 @@ +{ + "Foo": "Bar" +} \ No newline at end of file diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder.snap new file mode 100644 index 00000000000..30a62919f50 --- /dev/null +++ b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder.snap @@ -0,0 +1,17 @@ +--------------- +{ + "Foo": "Bar" +} +--------------- + +--------------- +{ + "Foo": "Bar" +} +--------------- + +--------------- +{ + "Foo": "Baz" +} +--------------- diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilderAsync.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilderAsync.snap new file mode 100644 index 00000000000..30a62919f50 --- /dev/null +++ b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilderAsync.snap @@ -0,0 +1,17 @@ +--------------- +{ + "Foo": "Bar" +} +--------------- + +--------------- +{ + "Foo": "Bar" +} +--------------- + +--------------- +{ + "Foo": "Baz" +} +--------------- diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder_GraphQL_Segment.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder_GraphQL_Segment.snap new file mode 100644 index 00000000000..5fb1a0da16f --- /dev/null +++ b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder_GraphQL_Segment.snap @@ -0,0 +1,11 @@ +--------------- +{ + "Foo": "def" +} +--------------- + +--------------- +{ + abc +} +--------------- diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Custom_Global_Serializer.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Custom_Global_Serializer.snap new file mode 100644 index 00000000000..d800886d9c8 --- /dev/null +++ b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Custom_Global_Serializer.snap @@ -0,0 +1 @@ +123 \ No newline at end of file diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Custom_Serializer_For_Segment.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Custom_Serializer_For_Segment.snap new file mode 100644 index 00000000000..60005ece07f --- /dev/null +++ b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Custom_Serializer_For_Segment.snap @@ -0,0 +1,22 @@ +--------------- +{ + "Foo": "Bar" +} +--------------- + +Bar: +--------------- +Baz +--------------- + +--------------- +{ + "Foo": "Baz" +} +--------------- + +--------------- +{ + "Foo": "Baz" +} +--------------- diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Name.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Name.snap new file mode 100644 index 00000000000..fecc879c52d --- /dev/null +++ b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Name.snap @@ -0,0 +1,18 @@ +--------------- +{ + "Foo": "Bar" +} +--------------- + +Bar: +--------------- +{ + "Foo": "Bar" +} +--------------- + +--------------- +{ + "Foo": "Baz" +} +--------------- diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Name_All.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Name_All.snap new file mode 100644 index 00000000000..71225eaeefc --- /dev/null +++ b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Name_All.snap @@ -0,0 +1,20 @@ +Segment 1: +--------------- +{ + "Foo": "Bar" +} +--------------- + +Segment 2: +--------------- +{ + "Foo": "Bar" +} +--------------- + +Segment 3: +--------------- +{ + "Foo": "Baz" +} +--------------- diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.ThreeSnapshot.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.ThreeSnapshot.snap new file mode 100644 index 00000000000..cfd5e7f6e49 --- /dev/null +++ b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.ThreeSnapshot.snap @@ -0,0 +1,17 @@ +--------------- +{ + "Foo": "Bar" +} +--------------- + +--------------- +{ + "Foo": "Bar" +} +--------------- + +--------------- +{ + "Foo": "Bar" +} +--------------- diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.TwoSnapshot.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.TwoSnapshot.snap new file mode 100644 index 00000000000..f9b5b954f12 --- /dev/null +++ b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.TwoSnapshot.snap @@ -0,0 +1,11 @@ +--------------- +{ + "Foo": "Bar" +} +--------------- + +--------------- +{ + "Foo": "Bar" +} +--------------- diff --git a/src/CookieCrumble/test/CookieCrumble.Tests/CookieCrumble.Tests.csproj b/src/CookieCrumble/test/CookieCrumble.Tests/CookieCrumble.Tests.csproj index 41ea4c07e8a..5514a0c863c 100644 --- a/src/CookieCrumble/test/CookieCrumble.Tests/CookieCrumble.Tests.csproj +++ b/src/CookieCrumble/test/CookieCrumble.Tests/CookieCrumble.Tests.csproj @@ -25,6 +25,7 @@ + diff --git a/src/CookieCrumble/test/CookieCrumble.Tests/SnapshotTests.cs b/src/CookieCrumble/test/CookieCrumble.Tests/SnapshotTests.cs index 5f29d469d52..c064e40cf7e 100644 --- a/src/CookieCrumble/test/CookieCrumble.Tests/SnapshotTests.cs +++ b/src/CookieCrumble/test/CookieCrumble.Tests/SnapshotTests.cs @@ -3,10 +3,15 @@ using CookieCrumble.Formatters; using HotChocolate.Language; -namespace CookieCrumble; +namespace CookieCrumble.XunitTests; public class SnapshotTests { + public SnapshotTests() + { + CookieCrumble.Snapshot.RegisterTestFramework(new CookieCrumble.Xunit.XunitFramework()); + } + [Fact] public void MatchSnapshot() { From bb92bb5143d407565630f95fc0af8329a20acdde Mon Sep 17 00:00:00 2001 From: Glen Date: Fri, 29 Nov 2024 16:28:38 +0200 Subject: [PATCH 3/8] WIP: Added ModuleInitializers to initialize the xUnit test framework --- .../src/CookieCrumble.Xunit/CookieCrumbleXunit.cs | 9 +++++++++ src/GreenDonut/test/Core.Tests/ModuleInitializer.cs | 12 ++++++++++++ src/GreenDonut/test/Directory.Build.props | 3 ++- .../test/ApolloFederation.Tests/ModuleInitializer.cs | 1 + .../ApolloFederation/test/Directory.Build.props | 2 ++ .../ModuleInitializer.cs | 1 + .../test/AspNetCore.Tests/ModuleInitializer.cs | 1 + .../AspNetCore/test/Directory.Build.props | 2 ++ .../test/Transport.Http.Tests/ModuleInitializer.cs | 1 + .../Caching/test/Caching.Tests/ModuleInitializer.cs | 1 + src/HotChocolate/Caching/test/Directory.Build.props | 2 ++ .../test/Abstractions.Tests/ModuleInitializer.cs | 1 + .../test/Authorization.Tests/ModuleInitializer.cs | 1 + .../Core/test/Execution.Tests/ModuleInitializer.cs | 1 + .../Core/test/Fetching.Tests/ModuleInitializer.cs | 1 + .../test/Subscriptions.Tests/ModuleInitializer.cs | 1 + .../test/Types.Analyzers.Tests/ModuleInitializer.cs | 1 + .../ModuleInitializer.cs | 1 + .../Core/test/Types.Json.Tests/ModuleInitializer.cs | 1 + .../test/Types.Mutations.Tests/ModuleInitializer.cs | 1 + .../ModuleInitializer.cs | 1 + .../test/Types.Queries.Tests/ModuleInitializer.cs | 1 + .../test/Types.Records.Tests/ModuleInitializer.cs | 1 + .../Core/test/Types.Tests/ModuleInitializer.cs | 1 + .../test/CostAnalysis.Tests/ModuleInitializer.cs | 1 + .../CostAnalysis/test/Directory.Build.props | 2 ++ .../ModuleInitializer.cs | 1 + .../Data.EntityFramework.Tests/ModuleInitializer.cs | 1 + .../Data.Filters.InMemory.Tests/ModuleInitializer.cs | 1 + .../ModuleInitializer.cs | 1 + .../test/Data.Filters.Tests/ModuleInitializer.cs | 1 + .../ModuleInitializer.cs | 1 + .../test/Data.Projections.Tests/ModuleInitializer.cs | 1 + .../Data.Sorting.InMemory.Tests/ModuleInitializer.cs | 1 + .../Data.Sorting.SqlLite.Tests/ModuleInitializer.cs | 1 + .../test/Data.Sorting.Tests/ModuleInitializer.cs | 1 + .../Data/test/Data.Tests/ModuleInitializer.cs | 1 + src/HotChocolate/Data/test/Directory.Build.props | 2 ++ .../test/CommandLine.Tests/ModuleInitializer.cs | 1 + .../test/Composition.Tests/ModuleInitializer.cs | 1 + src/HotChocolate/Fusion/test/Directory.Build.props | 2 ++ src/HotChocolate/Language/test/Directory.Build.props | 2 ++ .../test/Language.Tests/ModuleInitializer.cs | 1 + .../Data.Marten.Filters.Tests/ModuleInitializer.cs | 1 + .../Data.Marten.Sorting.Tests/ModuleInitializer.cs | 1 + src/HotChocolate/Marten/test/Directory.Build.props | 2 ++ .../Data.MongoDb.Filters.Tests/ModuleInitializer.cs | 1 + src/HotChocolate/MongoDb/test/Directory.Build.props | 2 ++ .../MongoDb/test/Types.MongoDb/ModuleInitializer.cs | 1 + src/HotChocolate/OpenApi/test/Directory.Build.props | 2 ++ .../HotChocolate.OpenApi.Tests/ModuleInitializer.cs | 1 + .../Pagination/test/Directory.Build.props | 2 ++ .../ModuleInitializer.cs | 1 + .../PersistedOperations/test/Directory.Build.props | 2 ++ .../ModuleInitializer.cs | 1 + .../ModuleInitializer.cs | 1 + .../Data.Raven.Filters.Tests/ModuleInitializer.cs | 1 + .../Data.Raven.Sorting.Tests/ModuleInitializer.cs | 1 + .../Raven/test/Data.Raven.Tests/ModuleInitializer.cs | 1 + src/HotChocolate/Raven/test/Directory.Build.props | 2 ++ src/HotChocolate/Spatial/test/Directory.Build.props | 2 ++ .../Spatial/test/Types.Tests/ModuleInitializer.cs | 1 + 62 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 src/CookieCrumble/src/CookieCrumble.Xunit/CookieCrumbleXunit.cs create mode 100644 src/GreenDonut/test/Core.Tests/ModuleInitializer.cs diff --git a/src/CookieCrumble/src/CookieCrumble.Xunit/CookieCrumbleXunit.cs b/src/CookieCrumble/src/CookieCrumble.Xunit/CookieCrumbleXunit.cs new file mode 100644 index 00000000000..5abaf224762 --- /dev/null +++ b/src/CookieCrumble/src/CookieCrumble.Xunit/CookieCrumbleXunit.cs @@ -0,0 +1,9 @@ +namespace CookieCrumble.Xunit; + +public static class CookieCrumbleXunit +{ + public static void Initialize() + { + Snapshot.RegisterTestFramework(new XunitFramework()); + } +} diff --git a/src/GreenDonut/test/Core.Tests/ModuleInitializer.cs b/src/GreenDonut/test/Core.Tests/ModuleInitializer.cs new file mode 100644 index 00000000000..28085cc59ae --- /dev/null +++ b/src/GreenDonut/test/Core.Tests/ModuleInitializer.cs @@ -0,0 +1,12 @@ +using System.Runtime.CompilerServices; + +namespace GreenDonut; + +internal static class ModuleInitializer +{ + [ModuleInitializer] + public static void Initialize() + { + CookieCrumbleXunit.Initialize(); + } +} diff --git a/src/GreenDonut/test/Directory.Build.props b/src/GreenDonut/test/Directory.Build.props index f703c952745..2e35995ae4c 100644 --- a/src/GreenDonut/test/Directory.Build.props +++ b/src/GreenDonut/test/Directory.Build.props @@ -8,10 +8,11 @@ + - + diff --git a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/ModuleInitializer.cs b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/ModuleInitializer.cs index ec7cd91d5b1..bafe824c119 100644 --- a/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/ApolloFederation/test/ApolloFederation.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/ApolloFederation/test/Directory.Build.props b/src/HotChocolate/ApolloFederation/test/Directory.Build.props index ec781d79004..7baf4c5ea66 100644 --- a/src/HotChocolate/ApolloFederation/test/Directory.Build.props +++ b/src/HotChocolate/ApolloFederation/test/Directory.Build.props @@ -9,11 +9,13 @@ + + diff --git a/src/HotChocolate/AspNetCore/test/AspNetCore.Authorization.Tests/ModuleInitializer.cs b/src/HotChocolate/AspNetCore/test/AspNetCore.Authorization.Tests/ModuleInitializer.cs index 179636397e9..07575403ab1 100644 --- a/src/HotChocolate/AspNetCore/test/AspNetCore.Authorization.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/AspNetCore/test/AspNetCore.Authorization.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/ModuleInitializer.cs b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/ModuleInitializer.cs index 72ca586ccbe..64402bbc049 100644 --- a/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/AspNetCore/test/AspNetCore.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/AspNetCore/test/Directory.Build.props b/src/HotChocolate/AspNetCore/test/Directory.Build.props index 93666881f8d..77d8561274a 100644 --- a/src/HotChocolate/AspNetCore/test/Directory.Build.props +++ b/src/HotChocolate/AspNetCore/test/Directory.Build.props @@ -9,11 +9,13 @@ + + diff --git a/src/HotChocolate/AspNetCore/test/Transport.Http.Tests/ModuleInitializer.cs b/src/HotChocolate/AspNetCore/test/Transport.Http.Tests/ModuleInitializer.cs index 0813357d630..71eb1dabadd 100644 --- a/src/HotChocolate/AspNetCore/test/Transport.Http.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/AspNetCore/test/Transport.Http.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/Caching/test/Caching.Tests/ModuleInitializer.cs b/src/HotChocolate/Caching/test/Caching.Tests/ModuleInitializer.cs index 5d8557db1b8..1839afef2c3 100644 --- a/src/HotChocolate/Caching/test/Caching.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/Caching/test/Caching.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/Caching/test/Directory.Build.props b/src/HotChocolate/Caching/test/Directory.Build.props index 6169b24a476..c335499b8a2 100644 --- a/src/HotChocolate/Caching/test/Directory.Build.props +++ b/src/HotChocolate/Caching/test/Directory.Build.props @@ -9,10 +9,12 @@ + + diff --git a/src/HotChocolate/Core/test/Abstractions.Tests/ModuleInitializer.cs b/src/HotChocolate/Core/test/Abstractions.Tests/ModuleInitializer.cs index cdfd3490d24..863a695b53e 100644 --- a/src/HotChocolate/Core/test/Abstractions.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/Core/test/Abstractions.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/Core/test/Authorization.Tests/ModuleInitializer.cs b/src/HotChocolate/Core/test/Authorization.Tests/ModuleInitializer.cs index df8ef60ffe6..27b2a716974 100644 --- a/src/HotChocolate/Core/test/Authorization.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/Core/test/Authorization.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/Core/test/Execution.Tests/ModuleInitializer.cs b/src/HotChocolate/Core/test/Execution.Tests/ModuleInitializer.cs index bcdbdac37c5..8ac28c96e3c 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/Core/test/Execution.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/Core/test/Fetching.Tests/ModuleInitializer.cs b/src/HotChocolate/Core/test/Fetching.Tests/ModuleInitializer.cs index d14b36f51ac..95149c94a6b 100644 --- a/src/HotChocolate/Core/test/Fetching.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/Core/test/Fetching.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/Core/test/Subscriptions.Tests/ModuleInitializer.cs b/src/HotChocolate/Core/test/Subscriptions.Tests/ModuleInitializer.cs index 3097c9a9873..561e308bac8 100644 --- a/src/HotChocolate/Core/test/Subscriptions.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/Core/test/Subscriptions.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/Core/test/Types.Analyzers.Tests/ModuleInitializer.cs b/src/HotChocolate/Core/test/Types.Analyzers.Tests/ModuleInitializer.cs index f4200c1d7b0..ecc2344c08f 100644 --- a/src/HotChocolate/Core/test/Types.Analyzers.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/Core/test/Types.Analyzers.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/Core/test/Types.CursorPagination.Tests/ModuleInitializer.cs b/src/HotChocolate/Core/test/Types.CursorPagination.Tests/ModuleInitializer.cs index 035d01b98f8..2c50e63077c 100644 --- a/src/HotChocolate/Core/test/Types.CursorPagination.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/Core/test/Types.CursorPagination.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/Core/test/Types.Json.Tests/ModuleInitializer.cs b/src/HotChocolate/Core/test/Types.Json.Tests/ModuleInitializer.cs index f4200c1d7b0..ecc2344c08f 100644 --- a/src/HotChocolate/Core/test/Types.Json.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/Core/test/Types.Json.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/Core/test/Types.Mutations.Tests/ModuleInitializer.cs b/src/HotChocolate/Core/test/Types.Mutations.Tests/ModuleInitializer.cs index f4200c1d7b0..ecc2344c08f 100644 --- a/src/HotChocolate/Core/test/Types.Mutations.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/Core/test/Types.Mutations.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/Core/test/Types.OffsetPagination.Tests/ModuleInitializer.cs b/src/HotChocolate/Core/test/Types.OffsetPagination.Tests/ModuleInitializer.cs index 035d01b98f8..2c50e63077c 100644 --- a/src/HotChocolate/Core/test/Types.OffsetPagination.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/Core/test/Types.OffsetPagination.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/Core/test/Types.Queries.Tests/ModuleInitializer.cs b/src/HotChocolate/Core/test/Types.Queries.Tests/ModuleInitializer.cs index f93b2da2be7..a18781b37c8 100644 --- a/src/HotChocolate/Core/test/Types.Queries.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/Core/test/Types.Queries.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/Core/test/Types.Records.Tests/ModuleInitializer.cs b/src/HotChocolate/Core/test/Types.Records.Tests/ModuleInitializer.cs index f4200c1d7b0..ecc2344c08f 100644 --- a/src/HotChocolate/Core/test/Types.Records.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/Core/test/Types.Records.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/Core/test/Types.Tests/ModuleInitializer.cs b/src/HotChocolate/Core/test/Types.Tests/ModuleInitializer.cs index cdfd3490d24..863a695b53e 100644 --- a/src/HotChocolate/Core/test/Types.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/Core/test/Types.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/ModuleInitializer.cs b/src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/ModuleInitializer.cs index 598ebb0148d..e030ee9a93b 100644 --- a/src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/CostAnalysis/test/CostAnalysis.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/CostAnalysis/test/Directory.Build.props b/src/HotChocolate/CostAnalysis/test/Directory.Build.props index 47082b11e29..0129d035c93 100644 --- a/src/HotChocolate/CostAnalysis/test/Directory.Build.props +++ b/src/HotChocolate/CostAnalysis/test/Directory.Build.props @@ -9,11 +9,13 @@ + + diff --git a/src/HotChocolate/Data/test/Data.EntityFramework.Pagination.Tests/ModuleInitializer.cs b/src/HotChocolate/Data/test/Data.EntityFramework.Pagination.Tests/ModuleInitializer.cs index 9ec3dcfa4cf..b515a98631b 100644 --- a/src/HotChocolate/Data/test/Data.EntityFramework.Pagination.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/Data/test/Data.EntityFramework.Pagination.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/Data/test/Data.EntityFramework.Tests/ModuleInitializer.cs b/src/HotChocolate/Data/test/Data.EntityFramework.Tests/ModuleInitializer.cs index 9ec3dcfa4cf..b515a98631b 100644 --- a/src/HotChocolate/Data/test/Data.EntityFramework.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/Data/test/Data.EntityFramework.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/Data/test/Data.Filters.InMemory.Tests/ModuleInitializer.cs b/src/HotChocolate/Data/test/Data.Filters.InMemory.Tests/ModuleInitializer.cs index 4a0dbac9ef0..a56e4d6096e 100644 --- a/src/HotChocolate/Data/test/Data.Filters.InMemory.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/Data/test/Data.Filters.InMemory.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/Data/test/Data.Filters.SqlServer.Tests/ModuleInitializer.cs b/src/HotChocolate/Data/test/Data.Filters.SqlServer.Tests/ModuleInitializer.cs index 4a0dbac9ef0..a56e4d6096e 100644 --- a/src/HotChocolate/Data/test/Data.Filters.SqlServer.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/Data/test/Data.Filters.SqlServer.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/Data/test/Data.Filters.Tests/ModuleInitializer.cs b/src/HotChocolate/Data/test/Data.Filters.Tests/ModuleInitializer.cs index 841340c61d7..36845924536 100644 --- a/src/HotChocolate/Data/test/Data.Filters.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/Data/test/Data.Filters.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/Data/test/Data.Projections.SqlServer.Tests/ModuleInitializer.cs b/src/HotChocolate/Data/test/Data.Projections.SqlServer.Tests/ModuleInitializer.cs index 11c7d3f3faf..5a1987592e9 100644 --- a/src/HotChocolate/Data/test/Data.Projections.SqlServer.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/Data/test/Data.Projections.SqlServer.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/Data/test/Data.Projections.Tests/ModuleInitializer.cs b/src/HotChocolate/Data/test/Data.Projections.Tests/ModuleInitializer.cs index 9ec3dcfa4cf..b515a98631b 100644 --- a/src/HotChocolate/Data/test/Data.Projections.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/Data/test/Data.Projections.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/Data/test/Data.Sorting.InMemory.Tests/ModuleInitializer.cs b/src/HotChocolate/Data/test/Data.Sorting.InMemory.Tests/ModuleInitializer.cs index df44e0254da..fd37f886628 100644 --- a/src/HotChocolate/Data/test/Data.Sorting.InMemory.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/Data/test/Data.Sorting.InMemory.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/Data/test/Data.Sorting.SqlLite.Tests/ModuleInitializer.cs b/src/HotChocolate/Data/test/Data.Sorting.SqlLite.Tests/ModuleInitializer.cs index df44e0254da..fd37f886628 100644 --- a/src/HotChocolate/Data/test/Data.Sorting.SqlLite.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/Data/test/Data.Sorting.SqlLite.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/Data/test/Data.Sorting.Tests/ModuleInitializer.cs b/src/HotChocolate/Data/test/Data.Sorting.Tests/ModuleInitializer.cs index 841340c61d7..36845924536 100644 --- a/src/HotChocolate/Data/test/Data.Sorting.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/Data/test/Data.Sorting.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/Data/test/Data.Tests/ModuleInitializer.cs b/src/HotChocolate/Data/test/Data.Tests/ModuleInitializer.cs index 9ec3dcfa4cf..b515a98631b 100644 --- a/src/HotChocolate/Data/test/Data.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/Data/test/Data.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/Data/test/Directory.Build.props b/src/HotChocolate/Data/test/Directory.Build.props index c88e1f6c5c9..8db376fd335 100644 --- a/src/HotChocolate/Data/test/Directory.Build.props +++ b/src/HotChocolate/Data/test/Directory.Build.props @@ -9,11 +9,13 @@ + + diff --git a/src/HotChocolate/Fusion/test/CommandLine.Tests/ModuleInitializer.cs b/src/HotChocolate/Fusion/test/CommandLine.Tests/ModuleInitializer.cs index c971b1940bb..99df64613ca 100644 --- a/src/HotChocolate/Fusion/test/CommandLine.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/Fusion/test/CommandLine.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/Fusion/test/Composition.Tests/ModuleInitializer.cs b/src/HotChocolate/Fusion/test/Composition.Tests/ModuleInitializer.cs index 713217fab87..6919f4cc6c0 100644 --- a/src/HotChocolate/Fusion/test/Composition.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/Fusion/test/Composition.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/Fusion/test/Directory.Build.props b/src/HotChocolate/Fusion/test/Directory.Build.props index a1d76dbc5d1..1aa50dc6669 100644 --- a/src/HotChocolate/Fusion/test/Directory.Build.props +++ b/src/HotChocolate/Fusion/test/Directory.Build.props @@ -11,12 +11,14 @@ + + diff --git a/src/HotChocolate/Language/test/Directory.Build.props b/src/HotChocolate/Language/test/Directory.Build.props index 008f418e208..b318963e4da 100644 --- a/src/HotChocolate/Language/test/Directory.Build.props +++ b/src/HotChocolate/Language/test/Directory.Build.props @@ -9,10 +9,12 @@ + + diff --git a/src/HotChocolate/Language/test/Language.Tests/ModuleInitializer.cs b/src/HotChocolate/Language/test/Language.Tests/ModuleInitializer.cs index 4b9416795de..9057b0468be 100644 --- a/src/HotChocolate/Language/test/Language.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/Language/test/Language.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/Marten/test/Data.Marten.Filters.Tests/ModuleInitializer.cs b/src/HotChocolate/Marten/test/Data.Marten.Filters.Tests/ModuleInitializer.cs index 9ec3dcfa4cf..b515a98631b 100644 --- a/src/HotChocolate/Marten/test/Data.Marten.Filters.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/Marten/test/Data.Marten.Filters.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/Marten/test/Data.Marten.Sorting.Tests/ModuleInitializer.cs b/src/HotChocolate/Marten/test/Data.Marten.Sorting.Tests/ModuleInitializer.cs index 9ec3dcfa4cf..b515a98631b 100644 --- a/src/HotChocolate/Marten/test/Data.Marten.Sorting.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/Marten/test/Data.Marten.Sorting.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/Marten/test/Directory.Build.props b/src/HotChocolate/Marten/test/Directory.Build.props index ec781d79004..7baf4c5ea66 100644 --- a/src/HotChocolate/Marten/test/Directory.Build.props +++ b/src/HotChocolate/Marten/test/Directory.Build.props @@ -9,11 +9,13 @@ + + diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/ModuleInitializer.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/ModuleInitializer.cs index b76dc7a24eb..fc76dd7bdd8 100644 --- a/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/MongoDb/test/Directory.Build.props b/src/HotChocolate/MongoDb/test/Directory.Build.props index ec781d79004..7baf4c5ea66 100644 --- a/src/HotChocolate/MongoDb/test/Directory.Build.props +++ b/src/HotChocolate/MongoDb/test/Directory.Build.props @@ -9,11 +9,13 @@ + + diff --git a/src/HotChocolate/MongoDb/test/Types.MongoDb/ModuleInitializer.cs b/src/HotChocolate/MongoDb/test/Types.MongoDb/ModuleInitializer.cs index f4200c1d7b0..ecc2344c08f 100644 --- a/src/HotChocolate/MongoDb/test/Types.MongoDb/ModuleInitializer.cs +++ b/src/HotChocolate/MongoDb/test/Types.MongoDb/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/OpenApi/test/Directory.Build.props b/src/HotChocolate/OpenApi/test/Directory.Build.props index cb0896020b2..428761ef50c 100644 --- a/src/HotChocolate/OpenApi/test/Directory.Build.props +++ b/src/HotChocolate/OpenApi/test/Directory.Build.props @@ -9,11 +9,13 @@ + + diff --git a/src/HotChocolate/OpenApi/test/HotChocolate.OpenApi.Tests/ModuleInitializer.cs b/src/HotChocolate/OpenApi/test/HotChocolate.OpenApi.Tests/ModuleInitializer.cs index 87362ffdde0..d72ac9c8d36 100644 --- a/src/HotChocolate/OpenApi/test/HotChocolate.OpenApi.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/OpenApi/test/HotChocolate.OpenApi.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/Pagination/test/Directory.Build.props b/src/HotChocolate/Pagination/test/Directory.Build.props index c88e1f6c5c9..8db376fd335 100644 --- a/src/HotChocolate/Pagination/test/Directory.Build.props +++ b/src/HotChocolate/Pagination/test/Directory.Build.props @@ -9,11 +9,13 @@ + + diff --git a/src/HotChocolate/Pagination/test/Pagination.EntityFramework.Tests/ModuleInitializer.cs b/src/HotChocolate/Pagination/test/Pagination.EntityFramework.Tests/ModuleInitializer.cs index 9ec3dcfa4cf..b515a98631b 100644 --- a/src/HotChocolate/Pagination/test/Pagination.EntityFramework.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/Pagination/test/Pagination.EntityFramework.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/PersistedOperations/test/Directory.Build.props b/src/HotChocolate/PersistedOperations/test/Directory.Build.props index ec781d79004..7baf4c5ea66 100644 --- a/src/HotChocolate/PersistedOperations/test/Directory.Build.props +++ b/src/HotChocolate/PersistedOperations/test/Directory.Build.props @@ -9,11 +9,13 @@ + + diff --git a/src/HotChocolate/PersistedOperations/test/PersistedOperations.FileSystem.Tests/ModuleInitializer.cs b/src/HotChocolate/PersistedOperations/test/PersistedOperations.FileSystem.Tests/ModuleInitializer.cs index a04c389eee0..a576b134a29 100644 --- a/src/HotChocolate/PersistedOperations/test/PersistedOperations.FileSystem.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/PersistedOperations/test/PersistedOperations.FileSystem.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/PersistedOperations/test/PersistedOperations.Redis.Tests/ModuleInitializer.cs b/src/HotChocolate/PersistedOperations/test/PersistedOperations.Redis.Tests/ModuleInitializer.cs index 827c05b6af5..640098fe9e8 100644 --- a/src/HotChocolate/PersistedOperations/test/PersistedOperations.Redis.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/PersistedOperations/test/PersistedOperations.Redis.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/ModuleInitializer.cs b/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/ModuleInitializer.cs index 4a0dbac9ef0..a56e4d6096e 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Filters.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/Raven/test/Data.Raven.Sorting.Tests/ModuleInitializer.cs b/src/HotChocolate/Raven/test/Data.Raven.Sorting.Tests/ModuleInitializer.cs index df44e0254da..fd37f886628 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Sorting.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Sorting.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/Raven/test/Data.Raven.Tests/ModuleInitializer.cs b/src/HotChocolate/Raven/test/Data.Raven.Tests/ModuleInitializer.cs index 8779dd16985..22c6ad2e6b5 100644 --- a/src/HotChocolate/Raven/test/Data.Raven.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/Raven/test/Data.Raven.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } diff --git a/src/HotChocolate/Raven/test/Directory.Build.props b/src/HotChocolate/Raven/test/Directory.Build.props index ec781d79004..7baf4c5ea66 100644 --- a/src/HotChocolate/Raven/test/Directory.Build.props +++ b/src/HotChocolate/Raven/test/Directory.Build.props @@ -9,11 +9,13 @@ + + diff --git a/src/HotChocolate/Spatial/test/Directory.Build.props b/src/HotChocolate/Spatial/test/Directory.Build.props index ec781d79004..7baf4c5ea66 100644 --- a/src/HotChocolate/Spatial/test/Directory.Build.props +++ b/src/HotChocolate/Spatial/test/Directory.Build.props @@ -9,11 +9,13 @@ + + diff --git a/src/HotChocolate/Spatial/test/Types.Tests/ModuleInitializer.cs b/src/HotChocolate/Spatial/test/Types.Tests/ModuleInitializer.cs index 975f81c9cb1..9f1bf32191b 100644 --- a/src/HotChocolate/Spatial/test/Types.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/Spatial/test/Types.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleHotChocolate.Initialize(); } } From 0a9142b1838ca76667673e8ced32eb30d9547125 Mon Sep 17 00:00:00 2001 From: Glen Date: Fri, 29 Nov 2024 17:13:26 +0200 Subject: [PATCH 4/8] Added ModuleInitializers to initialize the xUnit test framework --- .../ModuleInitializer.cs | 12 ++++++++++++ .../ModuleInitializer.cs | 12 ++++++++++++ .../test/Types.NodaTime.Tests/ModuleInitializer.cs | 12 ++++++++++++ .../test/Types.Scalars.Tests/ModuleInitializer.cs | 12 ++++++++++++ .../Core/test/Validation.Tests/ModuleInitializer.cs | 12 ++++++++++++ .../test/Data.AutoMapper.Tests/ModuleInitializer.cs | 12 ++++++++++++ .../test/Diagnostics.Tests/ModuleInitializer.cs | 12 ++++++++++++ .../Diagnostics/test/Directory.Build.props | 3 ++- .../Fusion/test/Core.Tests/ModuleInitializer.cs | 1 + .../Language.SyntaxTree.Tests/ModuleInitializer.cs | 12 ++++++++++++ .../test/Language.Web.Tests/ModuleInitializer.cs | 12 ++++++++++++ .../Data.MongoDb.Paging.Tests/ModuleInitializer.cs | 12 ++++++++++++ .../ModuleInitializer.cs | 12 ++++++++++++ .../Data.MongoDb.Sorting.Tests/ModuleInitializer.cs | 12 ++++++++++++ .../ModuleInitializer.cs | 12 ++++++++++++ .../Data.Raven.Paging.Tests/ModuleInitializer.cs | 12 ++++++++++++ .../ModuleInitializer.cs | 12 ++++++++++++ src/HotChocolate/Skimmed/test/Directory.Build.props | 3 ++- .../Skimmed/test/Skimmed.Tests/ModuleInitializer.cs | 12 ++++++++++++ .../ModuleInitializer.cs | 12 ++++++++++++ .../ModuleInitializer.cs | 12 ++++++++++++ .../Spatial/test/Data.Tests/ModuleInitializer.cs | 12 ++++++++++++ .../Utilities/test/Directory.Build.props | 3 ++- .../ModuleInitializer.cs | 12 ++++++++++++ .../Client/test/Core.Tests/ModuleInitializer.cs | 12 ++++++++++++ .../Client/test/Directory.Build.props | 3 ++- .../test/Transport.Http.Tests/ModuleInitializer.cs | 12 ++++++++++++ .../Transport.InMemory.Tests/ModuleInitializer.cs | 12 ++++++++++++ .../Transport.WebSocket.Tests/ModuleInitializer.cs | 12 ++++++++++++ .../test/Configuration.Tests/ModuleInitializer.cs | 12 ++++++++++++ .../Tooling/test/Directory.Build.props | 3 ++- 31 files changed, 311 insertions(+), 5 deletions(-) create mode 100644 src/HotChocolate/AspNetCore/test/AspNetCore.CommandLine.Tests/ModuleInitializer.cs create mode 100644 src/HotChocolate/AspNetCore/test/Transport.Sockets.Client.Tests/ModuleInitializer.cs create mode 100644 src/HotChocolate/Core/test/Types.NodaTime.Tests/ModuleInitializer.cs create mode 100644 src/HotChocolate/Core/test/Types.Scalars.Tests/ModuleInitializer.cs create mode 100644 src/HotChocolate/Core/test/Validation.Tests/ModuleInitializer.cs create mode 100644 src/HotChocolate/Data/test/Data.AutoMapper.Tests/ModuleInitializer.cs create mode 100644 src/HotChocolate/Diagnostics/test/Diagnostics.Tests/ModuleInitializer.cs create mode 100644 src/HotChocolate/Language/test/Language.SyntaxTree.Tests/ModuleInitializer.cs create mode 100644 src/HotChocolate/Language/test/Language.Web.Tests/ModuleInitializer.cs create mode 100644 src/HotChocolate/MongoDb/test/Data.MongoDb.Paging.Tests/ModuleInitializer.cs create mode 100644 src/HotChocolate/MongoDb/test/Data.MongoDb.Projections.Tests/ModuleInitializer.cs create mode 100644 src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/ModuleInitializer.cs create mode 100644 src/HotChocolate/PersistedOperations/test/PersistedOperations.InMemory.Tests/ModuleInitializer.cs create mode 100644 src/HotChocolate/Raven/test/Data.Raven.Paging.Tests/ModuleInitializer.cs create mode 100644 src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/ModuleInitializer.cs create mode 100644 src/HotChocolate/Skimmed/test/Skimmed.Tests/ModuleInitializer.cs create mode 100644 src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/ModuleInitializer.cs create mode 100644 src/HotChocolate/Spatial/test/Data.Projections.SqlServer.Tests/ModuleInitializer.cs create mode 100644 src/HotChocolate/Spatial/test/Data.Tests/ModuleInitializer.cs create mode 100644 src/HotChocolate/Utilities/test/Utilities.Introspection.Tests/ModuleInitializer.cs create mode 100644 src/StrawberryShake/Client/test/Core.Tests/ModuleInitializer.cs create mode 100644 src/StrawberryShake/Client/test/Transport.Http.Tests/ModuleInitializer.cs create mode 100644 src/StrawberryShake/Client/test/Transport.InMemory.Tests/ModuleInitializer.cs create mode 100644 src/StrawberryShake/Client/test/Transport.WebSocket.Tests/ModuleInitializer.cs create mode 100644 src/StrawberryShake/Tooling/test/Configuration.Tests/ModuleInitializer.cs diff --git a/src/HotChocolate/AspNetCore/test/AspNetCore.CommandLine.Tests/ModuleInitializer.cs b/src/HotChocolate/AspNetCore/test/AspNetCore.CommandLine.Tests/ModuleInitializer.cs new file mode 100644 index 00000000000..8e7a89ae2fa --- /dev/null +++ b/src/HotChocolate/AspNetCore/test/AspNetCore.CommandLine.Tests/ModuleInitializer.cs @@ -0,0 +1,12 @@ +using System.Runtime.CompilerServices; + +namespace HotChocolate.AspNetCore.CommandLine; + +internal static class ModuleInitializer +{ + [ModuleInitializer] + public static void Initialize() + { + CookieCrumbleXunit.Initialize(); + } +} diff --git a/src/HotChocolate/AspNetCore/test/Transport.Sockets.Client.Tests/ModuleInitializer.cs b/src/HotChocolate/AspNetCore/test/Transport.Sockets.Client.Tests/ModuleInitializer.cs new file mode 100644 index 00000000000..eda31d9c0ea --- /dev/null +++ b/src/HotChocolate/AspNetCore/test/Transport.Sockets.Client.Tests/ModuleInitializer.cs @@ -0,0 +1,12 @@ +using System.Runtime.CompilerServices; + +namespace HotChocolate.Transport.Sockets; + +internal static class ModuleInitializer +{ + [ModuleInitializer] + public static void Initialize() + { + CookieCrumbleXunit.Initialize(); + } +} diff --git a/src/HotChocolate/Core/test/Types.NodaTime.Tests/ModuleInitializer.cs b/src/HotChocolate/Core/test/Types.NodaTime.Tests/ModuleInitializer.cs new file mode 100644 index 00000000000..ca2e22b0d65 --- /dev/null +++ b/src/HotChocolate/Core/test/Types.NodaTime.Tests/ModuleInitializer.cs @@ -0,0 +1,12 @@ +using System.Runtime.CompilerServices; + +namespace HotChocolate.Types.NodaTime.Tests; + +internal static class ModuleInitializer +{ + [ModuleInitializer] + public static void Initialize() + { + CookieCrumbleXunit.Initialize(); + } +} diff --git a/src/HotChocolate/Core/test/Types.Scalars.Tests/ModuleInitializer.cs b/src/HotChocolate/Core/test/Types.Scalars.Tests/ModuleInitializer.cs new file mode 100644 index 00000000000..565cd11b3d3 --- /dev/null +++ b/src/HotChocolate/Core/test/Types.Scalars.Tests/ModuleInitializer.cs @@ -0,0 +1,12 @@ +using System.Runtime.CompilerServices; + +namespace HotChocolate.Types; + +internal static class ModuleInitializer +{ + [ModuleInitializer] + public static void Initialize() + { + CookieCrumbleXunit.Initialize(); + } +} diff --git a/src/HotChocolate/Core/test/Validation.Tests/ModuleInitializer.cs b/src/HotChocolate/Core/test/Validation.Tests/ModuleInitializer.cs new file mode 100644 index 00000000000..dc38ad350af --- /dev/null +++ b/src/HotChocolate/Core/test/Validation.Tests/ModuleInitializer.cs @@ -0,0 +1,12 @@ +using System.Runtime.CompilerServices; + +namespace HotChocolate.Validation; + +internal static class ModuleInitializer +{ + [ModuleInitializer] + public static void Initialize() + { + CookieCrumbleXunit.Initialize(); + } +} diff --git a/src/HotChocolate/Data/test/Data.AutoMapper.Tests/ModuleInitializer.cs b/src/HotChocolate/Data/test/Data.AutoMapper.Tests/ModuleInitializer.cs new file mode 100644 index 00000000000..e3982079f1c --- /dev/null +++ b/src/HotChocolate/Data/test/Data.AutoMapper.Tests/ModuleInitializer.cs @@ -0,0 +1,12 @@ +using System.Runtime.CompilerServices; + +namespace HotChocolate.Data.Projections; + +internal static class ModuleInitializer +{ + [ModuleInitializer] + public static void Initialize() + { + CookieCrumbleXunit.Initialize(); + } +} diff --git a/src/HotChocolate/Diagnostics/test/Diagnostics.Tests/ModuleInitializer.cs b/src/HotChocolate/Diagnostics/test/Diagnostics.Tests/ModuleInitializer.cs new file mode 100644 index 00000000000..fab883e7ab9 --- /dev/null +++ b/src/HotChocolate/Diagnostics/test/Diagnostics.Tests/ModuleInitializer.cs @@ -0,0 +1,12 @@ +using System.Runtime.CompilerServices; + +namespace HotChocolate.Diagnostics; + +internal static class ModuleInitializer +{ + [ModuleInitializer] + public static void Initialize() + { + CookieCrumbleXunit.Initialize(); + } +} diff --git a/src/HotChocolate/Diagnostics/test/Directory.Build.props b/src/HotChocolate/Diagnostics/test/Directory.Build.props index aba3882a0c5..a3dc0e195f9 100644 --- a/src/HotChocolate/Diagnostics/test/Directory.Build.props +++ b/src/HotChocolate/Diagnostics/test/Directory.Build.props @@ -8,11 +8,12 @@ + - + diff --git a/src/HotChocolate/Fusion/test/Core.Tests/ModuleInitializer.cs b/src/HotChocolate/Fusion/test/Core.Tests/ModuleInitializer.cs index baeee20b013..4b0e1ed2d10 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/ModuleInitializer.cs +++ b/src/HotChocolate/Fusion/test/Core.Tests/ModuleInitializer.cs @@ -7,6 +7,7 @@ internal static class ModuleInitializer [ModuleInitializer] public static void Initialize() { + CookieCrumbleXunit.Initialize(); CookieCrumbleFusion.Initialize(); CookieCrumbleHotChocolate.Initialize(); } diff --git a/src/HotChocolate/Language/test/Language.SyntaxTree.Tests/ModuleInitializer.cs b/src/HotChocolate/Language/test/Language.SyntaxTree.Tests/ModuleInitializer.cs new file mode 100644 index 00000000000..b1b9d5fe2d1 --- /dev/null +++ b/src/HotChocolate/Language/test/Language.SyntaxTree.Tests/ModuleInitializer.cs @@ -0,0 +1,12 @@ +using System.Runtime.CompilerServices; + +namespace HotChocolate.Language.SyntaxTree; + +internal static class ModuleInitializer +{ + [ModuleInitializer] + public static void Initialize() + { + CookieCrumbleXunit.Initialize(); + } +} diff --git a/src/HotChocolate/Language/test/Language.Web.Tests/ModuleInitializer.cs b/src/HotChocolate/Language/test/Language.Web.Tests/ModuleInitializer.cs new file mode 100644 index 00000000000..cf95dfd1c90 --- /dev/null +++ b/src/HotChocolate/Language/test/Language.Web.Tests/ModuleInitializer.cs @@ -0,0 +1,12 @@ +using System.Runtime.CompilerServices; + +namespace HotChocolate.Language; + +internal static class ModuleInitializer +{ + [ModuleInitializer] + public static void Initialize() + { + CookieCrumbleXunit.Initialize(); + } +} diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Paging.Tests/ModuleInitializer.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Paging.Tests/ModuleInitializer.cs new file mode 100644 index 00000000000..ddb915ce361 --- /dev/null +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Paging.Tests/ModuleInitializer.cs @@ -0,0 +1,12 @@ +using System.Runtime.CompilerServices; + +namespace HotChocolate.Data.MongoDb.Paging; + +internal static class ModuleInitializer +{ + [ModuleInitializer] + public static void Initialize() + { + CookieCrumbleXunit.Initialize(); + } +} diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Projections.Tests/ModuleInitializer.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Projections.Tests/ModuleInitializer.cs new file mode 100644 index 00000000000..7ef38d94997 --- /dev/null +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Projections.Tests/ModuleInitializer.cs @@ -0,0 +1,12 @@ +using System.Runtime.CompilerServices; + +namespace HotChocolate.Data.MongoDb.Projections; + +internal static class ModuleInitializer +{ + [ModuleInitializer] + public static void Initialize() + { + CookieCrumbleXunit.Initialize(); + } +} diff --git a/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/ModuleInitializer.cs b/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/ModuleInitializer.cs new file mode 100644 index 00000000000..1f0d5b7b924 --- /dev/null +++ b/src/HotChocolate/MongoDb/test/Data.MongoDb.Sorting.Tests/ModuleInitializer.cs @@ -0,0 +1,12 @@ +using System.Runtime.CompilerServices; + +namespace HotChocolate.Data.MongoDb.Sorting; + +internal static class ModuleInitializer +{ + [ModuleInitializer] + public static void Initialize() + { + CookieCrumbleXunit.Initialize(); + } +} diff --git a/src/HotChocolate/PersistedOperations/test/PersistedOperations.InMemory.Tests/ModuleInitializer.cs b/src/HotChocolate/PersistedOperations/test/PersistedOperations.InMemory.Tests/ModuleInitializer.cs new file mode 100644 index 00000000000..bf527e671e6 --- /dev/null +++ b/src/HotChocolate/PersistedOperations/test/PersistedOperations.InMemory.Tests/ModuleInitializer.cs @@ -0,0 +1,12 @@ +using System.Runtime.CompilerServices; + +namespace HotChocolate.PersistedOperations.InMemory; + +internal static class ModuleInitializer +{ + [ModuleInitializer] + public static void Initialize() + { + CookieCrumbleXunit.Initialize(); + } +} diff --git a/src/HotChocolate/Raven/test/Data.Raven.Paging.Tests/ModuleInitializer.cs b/src/HotChocolate/Raven/test/Data.Raven.Paging.Tests/ModuleInitializer.cs new file mode 100644 index 00000000000..a3b5a9cffce --- /dev/null +++ b/src/HotChocolate/Raven/test/Data.Raven.Paging.Tests/ModuleInitializer.cs @@ -0,0 +1,12 @@ +using System.Runtime.CompilerServices; + +namespace HotChocolate.Data; + +internal static class ModuleInitializer +{ + [ModuleInitializer] + public static void Initialize() + { + CookieCrumbleXunit.Initialize(); + } +} diff --git a/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/ModuleInitializer.cs b/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/ModuleInitializer.cs new file mode 100644 index 00000000000..6a70e1031fd --- /dev/null +++ b/src/HotChocolate/Raven/test/Data.Raven.Projections.Tests/ModuleInitializer.cs @@ -0,0 +1,12 @@ +using System.Runtime.CompilerServices; + +namespace HotChocolate.Data.Raven; + +internal static class ModuleInitializer +{ + [ModuleInitializer] + public static void Initialize() + { + CookieCrumbleXunit.Initialize(); + } +} diff --git a/src/HotChocolate/Skimmed/test/Directory.Build.props b/src/HotChocolate/Skimmed/test/Directory.Build.props index e640393171a..5ee232e004d 100644 --- a/src/HotChocolate/Skimmed/test/Directory.Build.props +++ b/src/HotChocolate/Skimmed/test/Directory.Build.props @@ -8,11 +8,12 @@ + - + diff --git a/src/HotChocolate/Skimmed/test/Skimmed.Tests/ModuleInitializer.cs b/src/HotChocolate/Skimmed/test/Skimmed.Tests/ModuleInitializer.cs new file mode 100644 index 00000000000..ae99d219542 --- /dev/null +++ b/src/HotChocolate/Skimmed/test/Skimmed.Tests/ModuleInitializer.cs @@ -0,0 +1,12 @@ +using System.Runtime.CompilerServices; + +namespace HotChocolate.Skimmed; + +internal static class ModuleInitializer +{ + [ModuleInitializer] + public static void Initialize() + { + CookieCrumbleXunit.Initialize(); + } +} diff --git a/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/ModuleInitializer.cs b/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/ModuleInitializer.cs new file mode 100644 index 00000000000..aabeeb77b04 --- /dev/null +++ b/src/HotChocolate/Spatial/test/Data.Filters.SqlServer.Tests/ModuleInitializer.cs @@ -0,0 +1,12 @@ +using System.Runtime.CompilerServices; + +namespace HotChocolate.Data.Spatial.Filters; + +internal static class ModuleInitializer +{ + [ModuleInitializer] + public static void Initialize() + { + CookieCrumbleXunit.Initialize(); + } +} diff --git a/src/HotChocolate/Spatial/test/Data.Projections.SqlServer.Tests/ModuleInitializer.cs b/src/HotChocolate/Spatial/test/Data.Projections.SqlServer.Tests/ModuleInitializer.cs new file mode 100644 index 00000000000..b9d960a50e3 --- /dev/null +++ b/src/HotChocolate/Spatial/test/Data.Projections.SqlServer.Tests/ModuleInitializer.cs @@ -0,0 +1,12 @@ +using System.Runtime.CompilerServices; + +namespace HotChocolate.Data.Projections.Spatial; + +internal static class ModuleInitializer +{ + [ModuleInitializer] + public static void Initialize() + { + CookieCrumbleXunit.Initialize(); + } +} diff --git a/src/HotChocolate/Spatial/test/Data.Tests/ModuleInitializer.cs b/src/HotChocolate/Spatial/test/Data.Tests/ModuleInitializer.cs new file mode 100644 index 00000000000..474e535cc39 --- /dev/null +++ b/src/HotChocolate/Spatial/test/Data.Tests/ModuleInitializer.cs @@ -0,0 +1,12 @@ +using System.Runtime.CompilerServices; + +namespace HotChocolate.Data.Spatial; + +internal static class ModuleInitializer +{ + [ModuleInitializer] + public static void Initialize() + { + CookieCrumbleXunit.Initialize(); + } +} diff --git a/src/HotChocolate/Utilities/test/Directory.Build.props b/src/HotChocolate/Utilities/test/Directory.Build.props index 6e5f9f04197..04c5004ba5b 100644 --- a/src/HotChocolate/Utilities/test/Directory.Build.props +++ b/src/HotChocolate/Utilities/test/Directory.Build.props @@ -8,10 +8,11 @@ + - + diff --git a/src/HotChocolate/Utilities/test/Utilities.Introspection.Tests/ModuleInitializer.cs b/src/HotChocolate/Utilities/test/Utilities.Introspection.Tests/ModuleInitializer.cs new file mode 100644 index 00000000000..ccae5470d74 --- /dev/null +++ b/src/HotChocolate/Utilities/test/Utilities.Introspection.Tests/ModuleInitializer.cs @@ -0,0 +1,12 @@ +using System.Runtime.CompilerServices; + +namespace HotChocolate.Utilities.Introspection; + +internal static class ModuleInitializer +{ + [ModuleInitializer] + public static void Initialize() + { + CookieCrumbleXunit.Initialize(); + } +} diff --git a/src/StrawberryShake/Client/test/Core.Tests/ModuleInitializer.cs b/src/StrawberryShake/Client/test/Core.Tests/ModuleInitializer.cs new file mode 100644 index 00000000000..e0b9735f658 --- /dev/null +++ b/src/StrawberryShake/Client/test/Core.Tests/ModuleInitializer.cs @@ -0,0 +1,12 @@ +using System.Runtime.CompilerServices; + +namespace StrawberryShake; + +internal static class ModuleInitializer +{ + [ModuleInitializer] + public static void Initialize() + { + CookieCrumbleXunit.Initialize(); + } +} diff --git a/src/StrawberryShake/Client/test/Directory.Build.props b/src/StrawberryShake/Client/test/Directory.Build.props index 6dd3bd77dca..83ea79441d6 100644 --- a/src/StrawberryShake/Client/test/Directory.Build.props +++ b/src/StrawberryShake/Client/test/Directory.Build.props @@ -8,11 +8,12 @@ + - + diff --git a/src/StrawberryShake/Client/test/Transport.Http.Tests/ModuleInitializer.cs b/src/StrawberryShake/Client/test/Transport.Http.Tests/ModuleInitializer.cs new file mode 100644 index 00000000000..934c28cba32 --- /dev/null +++ b/src/StrawberryShake/Client/test/Transport.Http.Tests/ModuleInitializer.cs @@ -0,0 +1,12 @@ +using System.Runtime.CompilerServices; + +namespace StrawberryShake.Transport.Http; + +internal static class ModuleInitializer +{ + [ModuleInitializer] + public static void Initialize() + { + CookieCrumbleXunit.Initialize(); + } +} diff --git a/src/StrawberryShake/Client/test/Transport.InMemory.Tests/ModuleInitializer.cs b/src/StrawberryShake/Client/test/Transport.InMemory.Tests/ModuleInitializer.cs new file mode 100644 index 00000000000..5391f8798e9 --- /dev/null +++ b/src/StrawberryShake/Client/test/Transport.InMemory.Tests/ModuleInitializer.cs @@ -0,0 +1,12 @@ +using System.Runtime.CompilerServices; + +namespace StrawberryShake.Transport.InMemory; + +internal static class ModuleInitializer +{ + [ModuleInitializer] + public static void Initialize() + { + CookieCrumbleXunit.Initialize(); + } +} diff --git a/src/StrawberryShake/Client/test/Transport.WebSocket.Tests/ModuleInitializer.cs b/src/StrawberryShake/Client/test/Transport.WebSocket.Tests/ModuleInitializer.cs new file mode 100644 index 00000000000..cda35c206ca --- /dev/null +++ b/src/StrawberryShake/Client/test/Transport.WebSocket.Tests/ModuleInitializer.cs @@ -0,0 +1,12 @@ +using System.Runtime.CompilerServices; + +namespace StrawberryShake.Transport.WebSockets; + +internal static class ModuleInitializer +{ + [ModuleInitializer] + public static void Initialize() + { + CookieCrumbleXunit.Initialize(); + } +} diff --git a/src/StrawberryShake/Tooling/test/Configuration.Tests/ModuleInitializer.cs b/src/StrawberryShake/Tooling/test/Configuration.Tests/ModuleInitializer.cs new file mode 100644 index 00000000000..c89c9be0fb1 --- /dev/null +++ b/src/StrawberryShake/Tooling/test/Configuration.Tests/ModuleInitializer.cs @@ -0,0 +1,12 @@ +using System.Runtime.CompilerServices; + +namespace StrawberryShake.Tools.Configuration; + +internal static class ModuleInitializer +{ + [ModuleInitializer] + public static void Initialize() + { + CookieCrumbleXunit.Initialize(); + } +} diff --git a/src/StrawberryShake/Tooling/test/Directory.Build.props b/src/StrawberryShake/Tooling/test/Directory.Build.props index 1a81da46f59..a4d2e4638f1 100644 --- a/src/StrawberryShake/Tooling/test/Directory.Build.props +++ b/src/StrawberryShake/Tooling/test/Directory.Build.props @@ -8,10 +8,11 @@ + - + From dd23f41dd8354c0f1dcc66949f46847d5ea15565 Mon Sep 17 00:00:00 2001 From: Glen Date: Fri, 29 Nov 2024 17:36:55 +0200 Subject: [PATCH 5/8] Removed MSTest framework and tests --- src/CookieCrumble/CookieCrumble.sln | 16 +-- .../CookieCrumble.MSTest.csproj | 11 -- .../CookieCrumble.MSTest/MSTestFramework.cs | 15 -- .../src/CookieCrumble/Snapshot.cs | 6 +- .../CookieCrumble.MSTests.csproj | 26 ---- .../CookieCrumble.MSTests/SnapshotTests.cs | 131 ------------------ .../SnapshotMSTests.MatchSnapshot.snap | 3 - .../SnapshotMSTests.OneSnapshot.snap | 3 - ...pshotMSTests.OneSnapshot_Post_Fix_ABC.snap | 3 - ...pshotMSTests.OneSnapshot_Txt_Extension.txt | 3 - .../SnapshotMSTests.SnapshotBuilder.snap | 17 --- .../SnapshotMSTests.SnapshotBuilderAsync.snap | 17 --- ...lder_Segment_Custom_Global_Serializer.snap | 1 - ...Segment_Custom_Serializer_For_Segment.snap | 22 --- ...tMSTests.SnapshotBuilder_Segment_Name.snap | 18 --- ...ests.SnapshotBuilder_Segment_Name_All.snap | 20 --- .../SnapshotMSTests.ThreeSnapshot.snap | 17 --- .../SnapshotMSTests.TwoSnapshot.snap | 11 -- .../SnapshotTests.MatchSnapshot.snap | 3 - .../SnapshotTests.OneSnapshot.snap | 3 - ...napshotTests.OneSnapshot_Post_Fix_ABC.snap | 3 - ...napshotTests.OneSnapshot_Txt_Extension.txt | 3 - .../SnapshotTests.SnapshotBuilder.snap | 17 --- .../SnapshotTests.SnapshotBuilderAsync.snap | 17 --- ...lder_Segment_Custom_Global_Serializer.snap | 1 - ...Segment_Custom_Serializer_For_Segment.snap | 22 --- ...hotTests.SnapshotBuilder_Segment_Name.snap | 18 --- ...ests.SnapshotBuilder_Segment_Name_All.snap | 20 --- .../SnapshotTests.ThreeSnapshot.snap | 17 --- .../SnapshotTests.TwoSnapshot.snap | 11 -- src/Directory.Packages.props | 2 - 31 files changed, 3 insertions(+), 474 deletions(-) delete mode 100644 src/CookieCrumble/src/CookieCrumble.MSTest/CookieCrumble.MSTest.csproj delete mode 100644 src/CookieCrumble/src/CookieCrumble.MSTest/MSTestFramework.cs delete mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/CookieCrumble.MSTests.csproj delete mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/SnapshotTests.cs delete mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.MatchSnapshot.snap delete mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.OneSnapshot.snap delete mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.OneSnapshot_Post_Fix_ABC.snap delete mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.OneSnapshot_Txt_Extension.txt delete mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder.snap delete mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilderAsync.snap delete mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder_Segment_Custom_Global_Serializer.snap delete mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder_Segment_Custom_Serializer_For_Segment.snap delete mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder_Segment_Name.snap delete mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder_Segment_Name_All.snap delete mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.ThreeSnapshot.snap delete mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.TwoSnapshot.snap delete mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.MatchSnapshot.snap delete mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.OneSnapshot.snap delete mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.OneSnapshot_Post_Fix_ABC.snap delete mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.OneSnapshot_Txt_Extension.txt delete mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder.snap delete mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilderAsync.snap delete mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Custom_Global_Serializer.snap delete mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Custom_Serializer_For_Segment.snap delete mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Name.snap delete mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Name_All.snap delete mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.ThreeSnapshot.snap delete mode 100644 src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.TwoSnapshot.snap diff --git a/src/CookieCrumble/CookieCrumble.sln b/src/CookieCrumble/CookieCrumble.sln index bcab4977e38..295bfb931fe 100644 --- a/src/CookieCrumble/CookieCrumble.sln +++ b/src/CookieCrumble/CookieCrumble.sln @@ -1,4 +1,4 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.30114.105 @@ -11,14 +11,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CookieCrumble.Fusion", "src EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CookieCrumble.HotChocolate", "src\CookieCrumble.HotChocolate\CookieCrumble.HotChocolate.csproj", "{9B57E4BC-E62A-4B7B-94FB-462C5F92D35B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CookieCrumble.MSTest", "src\CookieCrumble.MSTest\CookieCrumble.MSTest.csproj", "{A7F12BB5-F71C-484D-BABA-2980FE873B59}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CookieCrumble.Xunit", "src\CookieCrumble.Xunit\CookieCrumble.Xunit.csproj", "{CEE25A68-69B5-4CFD-9C35-E82736B1E205}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{EB8F1D90-60D6-48FA-9744-D4180A0E4AC0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CookieCrumble.MSTests", "test\CookieCrumble.MSTests\CookieCrumble.MSTests.csproj", "{F83B1337-9535-4121-8B78-89EC970CA705}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CookieCrumble.Tests", "test\CookieCrumble.Tests\CookieCrumble.Tests.csproj", "{844E7501-7ED6-4548-8E99-D8E50D4F39A4}" EndProject Global @@ -42,18 +38,10 @@ Global {9B57E4BC-E62A-4B7B-94FB-462C5F92D35B}.Debug|Any CPU.Build.0 = Debug|Any CPU {9B57E4BC-E62A-4B7B-94FB-462C5F92D35B}.Release|Any CPU.ActiveCfg = Release|Any CPU {9B57E4BC-E62A-4B7B-94FB-462C5F92D35B}.Release|Any CPU.Build.0 = Release|Any CPU - {A7F12BB5-F71C-484D-BABA-2980FE873B59}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A7F12BB5-F71C-484D-BABA-2980FE873B59}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A7F12BB5-F71C-484D-BABA-2980FE873B59}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A7F12BB5-F71C-484D-BABA-2980FE873B59}.Release|Any CPU.Build.0 = Release|Any CPU {CEE25A68-69B5-4CFD-9C35-E82736B1E205}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CEE25A68-69B5-4CFD-9C35-E82736B1E205}.Debug|Any CPU.Build.0 = Debug|Any CPU {CEE25A68-69B5-4CFD-9C35-E82736B1E205}.Release|Any CPU.ActiveCfg = Release|Any CPU {CEE25A68-69B5-4CFD-9C35-E82736B1E205}.Release|Any CPU.Build.0 = Release|Any CPU - {F83B1337-9535-4121-8B78-89EC970CA705}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F83B1337-9535-4121-8B78-89EC970CA705}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F83B1337-9535-4121-8B78-89EC970CA705}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F83B1337-9535-4121-8B78-89EC970CA705}.Release|Any CPU.Build.0 = Release|Any CPU {844E7501-7ED6-4548-8E99-D8E50D4F39A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {844E7501-7ED6-4548-8E99-D8E50D4F39A4}.Debug|Any CPU.Build.0 = Debug|Any CPU {844E7501-7ED6-4548-8E99-D8E50D4F39A4}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -63,9 +51,7 @@ Global {8E71FA9B-8352-4675-A9B4-A934E40AF9E0} = {2465C122-714C-4D0A-A24D-D9C22A25D73A} {E6862862-986B-4A67-8703-49C70051DBDC} = {2465C122-714C-4D0A-A24D-D9C22A25D73A} {9B57E4BC-E62A-4B7B-94FB-462C5F92D35B} = {2465C122-714C-4D0A-A24D-D9C22A25D73A} - {A7F12BB5-F71C-484D-BABA-2980FE873B59} = {2465C122-714C-4D0A-A24D-D9C22A25D73A} {CEE25A68-69B5-4CFD-9C35-E82736B1E205} = {2465C122-714C-4D0A-A24D-D9C22A25D73A} - {F83B1337-9535-4121-8B78-89EC970CA705} = {EB8F1D90-60D6-48FA-9744-D4180A0E4AC0} {844E7501-7ED6-4548-8E99-D8E50D4F39A4} = {EB8F1D90-60D6-48FA-9744-D4180A0E4AC0} EndGlobalSection EndGlobal diff --git a/src/CookieCrumble/src/CookieCrumble.MSTest/CookieCrumble.MSTest.csproj b/src/CookieCrumble/src/CookieCrumble.MSTest/CookieCrumble.MSTest.csproj deleted file mode 100644 index bb7d45fa4f0..00000000000 --- a/src/CookieCrumble/src/CookieCrumble.MSTest/CookieCrumble.MSTest.csproj +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/src/CookieCrumble/src/CookieCrumble.MSTest/MSTestFramework.cs b/src/CookieCrumble/src/CookieCrumble.MSTest/MSTestFramework.cs deleted file mode 100644 index 4752cdfaf9e..00000000000 --- a/src/CookieCrumble/src/CookieCrumble.MSTest/MSTestFramework.cs +++ /dev/null @@ -1,15 +0,0 @@ -using CookieCrumble; -using System.Reflection; - -namespace CookieCrumble.MSTest; - -public class MSTestFramework : ITestFramework -{ - public bool IsValidTestMethod(MemberInfo? method) - => method?.GetCustomAttributes(typeof(Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute)).Any() ?? false; - - public void ThrowTestException(string message) - { - throw new Microsoft.VisualStudio.TestTools.UnitTesting.AssertFailedException(message); - } -} diff --git a/src/CookieCrumble/src/CookieCrumble/Snapshot.cs b/src/CookieCrumble/src/CookieCrumble/Snapshot.cs index 5f3bb475866..cfd566d8046 100644 --- a/src/CookieCrumble/src/CookieCrumble/Snapshot.cs +++ b/src/CookieCrumble/src/CookieCrumble/Snapshot.cs @@ -656,8 +656,7 @@ private static string GetFilename(StackFrame[] frames) throw new Exception( "The snapshot full name could not be evaluated. " + - "Only XUnit or MSTest test suites are supported. " + - "This error can also occur, if you use the snapshot match " + + "This error can occur, if you use the snapshot match " + "within a async test helper child method. To solve this issue, " + "use the Snapshot.FullName directly in the unit test to " + "get the snapshot name, then reach this name to your " + @@ -690,8 +689,7 @@ private static string CreateMarkdownTitle(StackFrame[] frames) throw new Exception( "The snapshot full name could not be evaluated. " + - "Only XUnit or MSTest test suites are supported. " + - "This error can also occur, if you use the snapshot match " + + "This error can occur, if you use the snapshot match " + "within a async test helper child method. To solve this issue, " + "use the Snapshot.FullName directly in the unit test to " + "get the snapshot name, then reach this name to your " + diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/CookieCrumble.MSTests.csproj b/src/CookieCrumble/test/CookieCrumble.MSTests/CookieCrumble.MSTests.csproj deleted file mode 100644 index 44d180738b0..00000000000 --- a/src/CookieCrumble/test/CookieCrumble.MSTests/CookieCrumble.MSTests.csproj +++ /dev/null @@ -1,26 +0,0 @@ - - - - false - - CookieCrumble.MSTests - CookieCrumble - - - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - - - - - - - - - - - diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/SnapshotTests.cs b/src/CookieCrumble/test/CookieCrumble.MSTests/SnapshotTests.cs deleted file mode 100644 index 4386a6c7a82..00000000000 --- a/src/CookieCrumble/test/CookieCrumble.MSTests/SnapshotTests.cs +++ /dev/null @@ -1,131 +0,0 @@ -using System.Buffers; -using System.Text; -using CookieCrumble.Formatters; -using HotChocolate.Language; -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace CookieCrumble.MSTests; - -[TestClass] -public class SnapshotMSTests -{ - [TestInitialize()] - public void Initialize() - { - CookieCrumble.Snapshot.RegisterTestFramework(new CookieCrumble.MSTest.MSTestFramework()); - } - - [TestMethod] - public void MatchSnapshot() - { - new MyClass().MatchSnapshot(); - } - - [TestMethod] - public void OneSnapshot() - { - Snapshot.Match(new MyClass()); - } - - [TestMethod] - public void OneSnapshot_Txt_Extension() - { - Snapshot.Match(new MyClass(), extension: ".txt"); - } - - [TestMethod] - public void OneSnapshot_Post_Fix() - { - Snapshot.Match(new MyClass(), "ABC"); - } - - [TestMethod] - public void TwoSnapshot() - { - Snapshot.Match(new MyClass(), new MyClass()); - } - - [TestMethod] - public void ThreeSnapshot() - { - Snapshot.Match(new MyClass(), new MyClass(), new MyClass()); - } - - [TestMethod] - public void SnapshotBuilder() - { - var snapshot = new Snapshot(); - snapshot.Add(new MyClass()); - snapshot.Add(new MyClass { Foo = "Bar" }); - snapshot.Add(new MyClass { Foo = "Baz" }); - snapshot.Match(); - } - - [TestMethod] - public async Task SnapshotBuilderAsync() - { - var snapshot = new Snapshot(); - snapshot.Add(new MyClass()); - snapshot.Add(new MyClass { Foo = "Bar" }); - snapshot.Add(new MyClass { Foo = "Baz" }); - await snapshot.MatchAsync(); - } - - [TestMethod] - public void SnapshotBuilder_Segment_Name() - { - var snapshot = new Snapshot(); - snapshot.Add(new MyClass()); - snapshot.Add(new MyClass { Foo = "Bar" }, "Bar:"); - snapshot.Add(new MyClass { Foo = "Baz" }); - snapshot.Match(); - } - - [TestMethod] - public void SnapshotBuilder_Segment_Name_All() - { - var snapshot = new Snapshot(); - snapshot.Add(new MyClass(), "Segment 1:"); - snapshot.Add(new MyClass { Foo = "Bar" }, "Segment 2:"); - snapshot.Add(new MyClass { Foo = "Baz" }, "Segment 3:"); - snapshot.Match(); - } - - [TestMethod] - public void SnapshotBuilder_Segment_Custom_Serializer_For_Segment() - { - var snapshot = new Snapshot(); - snapshot.Add(new MyClass()); - snapshot.Add(new MyClass { Foo = "Baz" }, "Bar:", new CustomSerializer()); - snapshot.Add(new MyClass { Foo = "Baz" }); - snapshot.Add(new MyClass { Foo = "Baz" }); - snapshot.Match(); - } - - [TestMethod] - public void SnapshotBuilder_Segment_Custom_Global_Serializer() - { - Snapshot.RegisterFormatter(new CustomSerializer()); - - var snapshot = new Snapshot(); - snapshot.Add(new MyClass { Foo = "123" }); - snapshot.Match(); - } - - public class MyClass - { - public string Foo { get; set; } = "Bar"; - } - - public class CustomSerializer : ISnapshotValueFormatter - { - public bool CanHandle(object? value) - => value is MyClass { Foo: "123" }; - - public void Format(IBufferWriter snapshot, object? value) - { - var myClass = (MyClass)value!; - Encoding.UTF8.GetBytes(myClass.Foo.AsSpan(), snapshot); - } - } -} diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.MatchSnapshot.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.MatchSnapshot.snap deleted file mode 100644 index 002cafd4c19..00000000000 --- a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.MatchSnapshot.snap +++ /dev/null @@ -1,3 +0,0 @@ -{ - "Foo": "Bar" -} diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.OneSnapshot.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.OneSnapshot.snap deleted file mode 100644 index 002cafd4c19..00000000000 --- a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.OneSnapshot.snap +++ /dev/null @@ -1,3 +0,0 @@ -{ - "Foo": "Bar" -} diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.OneSnapshot_Post_Fix_ABC.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.OneSnapshot_Post_Fix_ABC.snap deleted file mode 100644 index 002cafd4c19..00000000000 --- a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.OneSnapshot_Post_Fix_ABC.snap +++ /dev/null @@ -1,3 +0,0 @@ -{ - "Foo": "Bar" -} diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.OneSnapshot_Txt_Extension.txt b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.OneSnapshot_Txt_Extension.txt deleted file mode 100644 index 002cafd4c19..00000000000 --- a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.OneSnapshot_Txt_Extension.txt +++ /dev/null @@ -1,3 +0,0 @@ -{ - "Foo": "Bar" -} diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder.snap deleted file mode 100644 index 30a62919f50..00000000000 --- a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder.snap +++ /dev/null @@ -1,17 +0,0 @@ ---------------- -{ - "Foo": "Bar" -} ---------------- - ---------------- -{ - "Foo": "Bar" -} ---------------- - ---------------- -{ - "Foo": "Baz" -} ---------------- diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilderAsync.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilderAsync.snap deleted file mode 100644 index 30a62919f50..00000000000 --- a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilderAsync.snap +++ /dev/null @@ -1,17 +0,0 @@ ---------------- -{ - "Foo": "Bar" -} ---------------- - ---------------- -{ - "Foo": "Bar" -} ---------------- - ---------------- -{ - "Foo": "Baz" -} ---------------- diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder_Segment_Custom_Global_Serializer.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder_Segment_Custom_Global_Serializer.snap deleted file mode 100644 index 190a18037c6..00000000000 --- a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder_Segment_Custom_Global_Serializer.snap +++ /dev/null @@ -1 +0,0 @@ -123 diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder_Segment_Custom_Serializer_For_Segment.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder_Segment_Custom_Serializer_For_Segment.snap deleted file mode 100644 index 60005ece07f..00000000000 --- a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder_Segment_Custom_Serializer_For_Segment.snap +++ /dev/null @@ -1,22 +0,0 @@ ---------------- -{ - "Foo": "Bar" -} ---------------- - -Bar: ---------------- -Baz ---------------- - ---------------- -{ - "Foo": "Baz" -} ---------------- - ---------------- -{ - "Foo": "Baz" -} ---------------- diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder_Segment_Name.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder_Segment_Name.snap deleted file mode 100644 index fecc879c52d..00000000000 --- a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder_Segment_Name.snap +++ /dev/null @@ -1,18 +0,0 @@ ---------------- -{ - "Foo": "Bar" -} ---------------- - -Bar: ---------------- -{ - "Foo": "Bar" -} ---------------- - ---------------- -{ - "Foo": "Baz" -} ---------------- diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder_Segment_Name_All.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder_Segment_Name_All.snap deleted file mode 100644 index 71225eaeefc..00000000000 --- a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.SnapshotBuilder_Segment_Name_All.snap +++ /dev/null @@ -1,20 +0,0 @@ -Segment 1: ---------------- -{ - "Foo": "Bar" -} ---------------- - -Segment 2: ---------------- -{ - "Foo": "Bar" -} ---------------- - -Segment 3: ---------------- -{ - "Foo": "Baz" -} ---------------- diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.ThreeSnapshot.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.ThreeSnapshot.snap deleted file mode 100644 index cfd5e7f6e49..00000000000 --- a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.ThreeSnapshot.snap +++ /dev/null @@ -1,17 +0,0 @@ ---------------- -{ - "Foo": "Bar" -} ---------------- - ---------------- -{ - "Foo": "Bar" -} ---------------- - ---------------- -{ - "Foo": "Bar" -} ---------------- diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.TwoSnapshot.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.TwoSnapshot.snap deleted file mode 100644 index f9b5b954f12..00000000000 --- a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotMSTests.TwoSnapshot.snap +++ /dev/null @@ -1,11 +0,0 @@ ---------------- -{ - "Foo": "Bar" -} ---------------- - ---------------- -{ - "Foo": "Bar" -} ---------------- diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.MatchSnapshot.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.MatchSnapshot.snap deleted file mode 100644 index a045e0a6e4a..00000000000 --- a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.MatchSnapshot.snap +++ /dev/null @@ -1,3 +0,0 @@ -{ - "Foo": "Bar" -} \ No newline at end of file diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.OneSnapshot.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.OneSnapshot.snap deleted file mode 100644 index a045e0a6e4a..00000000000 --- a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.OneSnapshot.snap +++ /dev/null @@ -1,3 +0,0 @@ -{ - "Foo": "Bar" -} \ No newline at end of file diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.OneSnapshot_Post_Fix_ABC.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.OneSnapshot_Post_Fix_ABC.snap deleted file mode 100644 index a045e0a6e4a..00000000000 --- a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.OneSnapshot_Post_Fix_ABC.snap +++ /dev/null @@ -1,3 +0,0 @@ -{ - "Foo": "Bar" -} \ No newline at end of file diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.OneSnapshot_Txt_Extension.txt b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.OneSnapshot_Txt_Extension.txt deleted file mode 100644 index a045e0a6e4a..00000000000 --- a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.OneSnapshot_Txt_Extension.txt +++ /dev/null @@ -1,3 +0,0 @@ -{ - "Foo": "Bar" -} \ No newline at end of file diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder.snap deleted file mode 100644 index 30a62919f50..00000000000 --- a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder.snap +++ /dev/null @@ -1,17 +0,0 @@ ---------------- -{ - "Foo": "Bar" -} ---------------- - ---------------- -{ - "Foo": "Bar" -} ---------------- - ---------------- -{ - "Foo": "Baz" -} ---------------- diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilderAsync.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilderAsync.snap deleted file mode 100644 index 30a62919f50..00000000000 --- a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilderAsync.snap +++ /dev/null @@ -1,17 +0,0 @@ ---------------- -{ - "Foo": "Bar" -} ---------------- - ---------------- -{ - "Foo": "Bar" -} ---------------- - ---------------- -{ - "Foo": "Baz" -} ---------------- diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Custom_Global_Serializer.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Custom_Global_Serializer.snap deleted file mode 100644 index d800886d9c8..00000000000 --- a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Custom_Global_Serializer.snap +++ /dev/null @@ -1 +0,0 @@ -123 \ No newline at end of file diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Custom_Serializer_For_Segment.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Custom_Serializer_For_Segment.snap deleted file mode 100644 index 60005ece07f..00000000000 --- a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Custom_Serializer_For_Segment.snap +++ /dev/null @@ -1,22 +0,0 @@ ---------------- -{ - "Foo": "Bar" -} ---------------- - -Bar: ---------------- -Baz ---------------- - ---------------- -{ - "Foo": "Baz" -} ---------------- - ---------------- -{ - "Foo": "Baz" -} ---------------- diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Name.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Name.snap deleted file mode 100644 index fecc879c52d..00000000000 --- a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Name.snap +++ /dev/null @@ -1,18 +0,0 @@ ---------------- -{ - "Foo": "Bar" -} ---------------- - -Bar: ---------------- -{ - "Foo": "Bar" -} ---------------- - ---------------- -{ - "Foo": "Baz" -} ---------------- diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Name_All.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Name_All.snap deleted file mode 100644 index 71225eaeefc..00000000000 --- a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.SnapshotBuilder_Segment_Name_All.snap +++ /dev/null @@ -1,20 +0,0 @@ -Segment 1: ---------------- -{ - "Foo": "Bar" -} ---------------- - -Segment 2: ---------------- -{ - "Foo": "Bar" -} ---------------- - -Segment 3: ---------------- -{ - "Foo": "Baz" -} ---------------- diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.ThreeSnapshot.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.ThreeSnapshot.snap deleted file mode 100644 index cfd5e7f6e49..00000000000 --- a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.ThreeSnapshot.snap +++ /dev/null @@ -1,17 +0,0 @@ ---------------- -{ - "Foo": "Bar" -} ---------------- - ---------------- -{ - "Foo": "Bar" -} ---------------- - ---------------- -{ - "Foo": "Bar" -} ---------------- diff --git a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.TwoSnapshot.snap b/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.TwoSnapshot.snap deleted file mode 100644 index f9b5b954f12..00000000000 --- a/src/CookieCrumble/test/CookieCrumble.MSTests/__snapshots__/SnapshotTests.TwoSnapshot.snap +++ /dev/null @@ -1,11 +0,0 @@ ---------------- -{ - "Foo": "Bar" -} ---------------- - ---------------- -{ - "Foo": "Bar" -} ---------------- diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index d434cdfac6f..90e301d4f3b 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -35,8 +35,6 @@ - - From 74cfafadbcd16d5b2b2ba140d9fe8a51729ce6f4 Mon Sep 17 00:00:00 2001 From: Glen Date: Fri, 29 Nov 2024 17:43:17 +0200 Subject: [PATCH 6/8] Reverted unnecessary changes --- src/CookieCrumble/src/CookieCrumble/Snapshot.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CookieCrumble/src/CookieCrumble/Snapshot.cs b/src/CookieCrumble/src/CookieCrumble/Snapshot.cs index cfd566d8046..b2d26c7c951 100644 --- a/src/CookieCrumble/src/CookieCrumble/Snapshot.cs +++ b/src/CookieCrumble/src/CookieCrumble/Snapshot.cs @@ -30,9 +30,9 @@ public class Snapshot private static ITestFramework _testFramework = null!; private readonly List _segments = []; private readonly string _title; + private readonly string _fileName; private string _extension; private string? _postFix; - private string? _fileName; public Snapshot(string? postFix = null, string? extension = null) { @@ -43,7 +43,7 @@ public Snapshot(string? postFix = null, string? extension = null) var frames = new StackTrace(true).GetFrames(); _title = CreateMarkdownTitle(frames); - _fileName = GetFilename(frames); + _fileName = CreateFileName(frames); _postFix = postFix; _extension = extension ?? ".snap"; } @@ -630,7 +630,7 @@ private string CreateMarkdownSnapshotFileName() : string.Concat(fileName, "_", _postFix, extension); } - private static string GetFilename(StackFrame[] frames) + private static string CreateFileName(StackFrame[] frames) { foreach (var stackFrame in frames) { From c3c5dec251530ad668bedffb438791c1311779ef Mon Sep 17 00:00:00 2001 From: Glen Date: Fri, 29 Nov 2024 17:56:54 +0200 Subject: [PATCH 7/8] Cleanup --- .../src/CookieCrumble.Xunit/XunitFramework.cs | 45 +++++++++---------- .../src/CookieCrumble/ITestFramework.cs | 3 +- .../src/CookieCrumble/Snapshot.cs | 2 +- .../CookieCrumble.Tests.csproj | 1 - .../test/CookieCrumble.Tests/SnapshotTests.cs | 3 +- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/CookieCrumble/src/CookieCrumble.Xunit/XunitFramework.cs b/src/CookieCrumble/src/CookieCrumble.Xunit/XunitFramework.cs index 805e0f8908e..33c453353d5 100644 --- a/src/CookieCrumble/src/CookieCrumble.Xunit/XunitFramework.cs +++ b/src/CookieCrumble/src/CookieCrumble.Xunit/XunitFramework.cs @@ -1,23 +1,22 @@ -using CookieCrumble; -using System.Reflection; -using Xunit; -using Xunit.Sdk; - -namespace CookieCrumble.Xunit; - -public class XunitFramework : ITestFramework -{ - public bool IsValidTestMethod(MemberInfo? method) - => IsFactTestMethod(method) || IsTheoryTestMethod(method); - - private static bool IsFactTestMethod(MemberInfo? method) - => method?.GetCustomAttributes(typeof(FactAttribute)).Any() ?? false; - - private static bool IsTheoryTestMethod(MemberInfo? method) - => method?.GetCustomAttributes(typeof(TheoryAttribute)).Any() ?? false; - - public void ThrowTestException(string message) - { - throw new XunitException(message); - } -} \ No newline at end of file +using System.Reflection; +using Xunit; +using Xunit.Sdk; + +namespace CookieCrumble.Xunit; + +public class XunitFramework : ITestFramework +{ + public bool IsValidTestMethod(MemberInfo? method) + => IsFactTestMethod(method) || IsTheoryTestMethod(method); + + private static bool IsFactTestMethod(MemberInfo? method) + => method?.GetCustomAttributes(typeof(FactAttribute)).Any() ?? false; + + private static bool IsTheoryTestMethod(MemberInfo? method) + => method?.GetCustomAttributes(typeof(TheoryAttribute)).Any() ?? false; + + public void ThrowTestException(string message) + { + throw new XunitException(message); + } +} diff --git a/src/CookieCrumble/src/CookieCrumble/ITestFramework.cs b/src/CookieCrumble/src/CookieCrumble/ITestFramework.cs index a2c6d3023a3..518467c13e2 100644 --- a/src/CookieCrumble/src/CookieCrumble/ITestFramework.cs +++ b/src/CookieCrumble/src/CookieCrumble/ITestFramework.cs @@ -5,5 +5,6 @@ namespace CookieCrumble; public interface ITestFramework { bool IsValidTestMethod(MemberInfo? method); + void ThrowTestException(string message); -} \ No newline at end of file +} diff --git a/src/CookieCrumble/src/CookieCrumble/Snapshot.cs b/src/CookieCrumble/src/CookieCrumble/Snapshot.cs index b2d26c7c951..6a1163d39f4 100644 --- a/src/CookieCrumble/src/CookieCrumble/Snapshot.cs +++ b/src/CookieCrumble/src/CookieCrumble/Snapshot.cs @@ -38,7 +38,7 @@ public Snapshot(string? postFix = null, string? extension = null) { if (_testFramework is null) { - throw new Exception("Please initialise a test framework before using Snapshot"); + throw new Exception("Please initialize a test framework before using Snapshot"); } var frames = new StackTrace(true).GetFrames(); diff --git a/src/CookieCrumble/test/CookieCrumble.Tests/CookieCrumble.Tests.csproj b/src/CookieCrumble/test/CookieCrumble.Tests/CookieCrumble.Tests.csproj index 7f7c6691485..184a5075f7b 100644 --- a/src/CookieCrumble/test/CookieCrumble.Tests/CookieCrumble.Tests.csproj +++ b/src/CookieCrumble/test/CookieCrumble.Tests/CookieCrumble.Tests.csproj @@ -22,7 +22,6 @@ - diff --git a/src/CookieCrumble/test/CookieCrumble.Tests/SnapshotTests.cs b/src/CookieCrumble/test/CookieCrumble.Tests/SnapshotTests.cs index 6016592f6b3..6016d6ad76d 100644 --- a/src/CookieCrumble/test/CookieCrumble.Tests/SnapshotTests.cs +++ b/src/CookieCrumble/test/CookieCrumble.Tests/SnapshotTests.cs @@ -1,6 +1,7 @@ using System.Buffers; using System.Text; using CookieCrumble.Formatters; +using CookieCrumble.Xunit; namespace CookieCrumble.XunitTests; @@ -8,7 +9,7 @@ public class SnapshotTests { public SnapshotTests() { - CookieCrumble.Snapshot.RegisterTestFramework(new CookieCrumble.Xunit.XunitFramework()); + Snapshot.RegisterTestFramework(new XunitFramework()); } [Fact] From b6d6814a6f2ed0fff38737ec82afad64b9b98239 Mon Sep 17 00:00:00 2001 From: Glen Date: Fri, 29 Nov 2024 18:05:54 +0200 Subject: [PATCH 8/8] More cleanup --- src/CookieCrumble/test/CookieCrumble.Tests/SnapshotTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CookieCrumble/test/CookieCrumble.Tests/SnapshotTests.cs b/src/CookieCrumble/test/CookieCrumble.Tests/SnapshotTests.cs index 6016d6ad76d..56cbeae2caa 100644 --- a/src/CookieCrumble/test/CookieCrumble.Tests/SnapshotTests.cs +++ b/src/CookieCrumble/test/CookieCrumble.Tests/SnapshotTests.cs @@ -3,11 +3,11 @@ using CookieCrumble.Formatters; using CookieCrumble.Xunit; -namespace CookieCrumble.XunitTests; +namespace CookieCrumble; public class SnapshotTests { - public SnapshotTests() + static SnapshotTests() { Snapshot.RegisterTestFramework(new XunitFramework()); }