From 5a0fba9f8fc0229ffd080539430b311db34eeafa Mon Sep 17 00:00:00 2001 From: Daniel Weber Date: Tue, 6 Jun 2023 12:48:46 +0200 Subject: [PATCH] Don't run tests that call Debug.Assert (everything Fody.NullGuard) in Debug mode. --- test/Core.Tests/GraphModelTest.cs | 4 ++-- test/Core.Tests/QueryAssertions.cs | 4 ++-- .../ReleaseOnlyFactAttribute.cs | 13 +++++++++++++ 3 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 test/Tests.Infrastructure/ReleaseOnlyFactAttribute.cs diff --git a/test/Core.Tests/GraphModelTest.cs b/test/Core.Tests/GraphModelTest.cs index cd540f9596..74ffe68ea4 100644 --- a/test/Core.Tests/GraphModelTest.cs +++ b/test/Core.Tests/GraphModelTest.cs @@ -22,7 +22,7 @@ public GraphModelTest() : base() } - [Fact] + [ReleaseOnlyFact] public void Fody_works() { g @@ -44,7 +44,7 @@ public void MemberMetadata_name_cannot_be_null() .Throw(); } - [Fact] + [ReleaseOnlyFact] public void ElementMetadata_name_cannot_be_null() { var m = default(ElementMetadata); diff --git a/test/Core.Tests/QueryAssertions.cs b/test/Core.Tests/QueryAssertions.cs index 5bfd54bdab..39dcb14ffc 100644 --- a/test/Core.Tests/QueryAssertions.cs +++ b/test/Core.Tests/QueryAssertions.cs @@ -18,7 +18,7 @@ public QueryAssertions() .IncludeAssembliesOfBaseTypes()))); } - [Fact] + [ReleaseOnlyFact] public virtual void VertexProperty_throws_on_null_value() { default(int) @@ -104,7 +104,7 @@ public virtual void Mid_query_g_throws() } - [Fact] + [ReleaseOnlyFact] public virtual void NullGuard_works() { _g diff --git a/test/Tests.Infrastructure/ReleaseOnlyFactAttribute.cs b/test/Tests.Infrastructure/ReleaseOnlyFactAttribute.cs new file mode 100644 index 0000000000..e039604a42 --- /dev/null +++ b/test/Tests.Infrastructure/ReleaseOnlyFactAttribute.cs @@ -0,0 +1,13 @@ +namespace ExRam.Gremlinq.Core.Tests +{ + public sealed class ReleaseOnlyFactAttribute : FactAttribute + { + public ReleaseOnlyFactAttribute() + { +#if DEBUG + Skip = "Skipped in Debug mode"; +#endif + } + + } +}