From 5a364dc804fee59c6b7ba31f08c00cafa04c4cd1 Mon Sep 17 00:00:00 2001 From: Dennis Doomen Date: Fri, 18 Oct 2024 20:53:55 +0200 Subject: [PATCH] SAVEPOINT --- .../TypeExtensionsSpecs.GetProperties.cs | 49 +++++++++++++++++++ .../{Types => Common}/TypeExtensionsSpecs.cs | 4 +- .../FluentAssertions.Specs.csproj | 1 + 3 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 Tests/FluentAssertions.Specs/Common/TypeExtensionsSpecs.GetProperties.cs rename Tests/FluentAssertions.Specs/{Types => Common}/TypeExtensionsSpecs.cs (99%) diff --git a/Tests/FluentAssertions.Specs/Common/TypeExtensionsSpecs.GetProperties.cs b/Tests/FluentAssertions.Specs/Common/TypeExtensionsSpecs.GetProperties.cs new file mode 100644 index 000000000..816de6721 --- /dev/null +++ b/Tests/FluentAssertions.Specs/Common/TypeExtensionsSpecs.GetProperties.cs @@ -0,0 +1,49 @@ +#if NET6_0_OR_GREATER +using Xunit; + +namespace FluentAssertions.Specs.Common; + +public partial class TypeExtensionsSpecs +{ + public class GetProperties + { + [Fact] + public void Test() + { + // Act + var properties = typeof(SuperClass).GetProperties(); + + // Assert + properties.Should().HaveCount(4); + } + + private class SuperClass : BaseClass, IInterfaceWithDefaultProperty + { + public string NormalProperty { get; set; } + + public new int NewProperty { get; set; } + + public string BarProperty { get; set; } + + public string FooProperty { get; set; } + } + + private class BaseClass + { + public string NewProperty { get; set; } + } + + private interface IInterfaceWithDefaultProperty : IInterfaceWithSingleProperty + { + string FooProperty { get; set; } + + string DefaultProperty => "Default"; + } + + private interface IInterfaceWithSingleProperty + { + string BarProperty { get; set; } + } + } +} +#endif diff --git a/Tests/FluentAssertions.Specs/Types/TypeExtensionsSpecs.cs b/Tests/FluentAssertions.Specs/Common/TypeExtensionsSpecs.cs similarity index 99% rename from Tests/FluentAssertions.Specs/Types/TypeExtensionsSpecs.cs rename to Tests/FluentAssertions.Specs/Common/TypeExtensionsSpecs.cs index 2ea5de12c..b26742657 100644 --- a/Tests/FluentAssertions.Specs/Types/TypeExtensionsSpecs.cs +++ b/Tests/FluentAssertions.Specs/Common/TypeExtensionsSpecs.cs @@ -7,9 +7,9 @@ using FluentAssertions.Common; using Xunit; -namespace FluentAssertions.Specs.Types; +namespace FluentAssertions.Specs.Common; -public class TypeExtensionsSpecs +public partial class TypeExtensionsSpecs { [Fact] public void When_comparing_types_and_types_are_same_it_should_return_true() diff --git a/Tests/FluentAssertions.Specs/FluentAssertions.Specs.csproj b/Tests/FluentAssertions.Specs/FluentAssertions.Specs.csproj index e79bf1df4..503ae2861 100644 --- a/Tests/FluentAssertions.Specs/FluentAssertions.Specs.csproj +++ b/Tests/FluentAssertions.Specs/FluentAssertions.Specs.csproj @@ -7,6 +7,7 @@ false $(NoWarn),IDE0052,1573,1591,1712,CS8002 full + 12