Skip to content

Commit

Permalink
Add test (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
sungam3r authored Jan 29, 2024
1 parent c43f2a4 commit e0576f7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Destructurama.Attributed.Tests/AttributedDestructuringTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public void AttributesAreConsultedWhenDestructuring()
props["ScalarAnyway"].LiteralValue().ShouldBeOfType<NotAScalar>();
props["Struct1"].LiteralValue().ShouldBeOfType<Struct1>();
props["Struct2"].LiteralValue().ShouldBeOfType<Struct2>();
props["StructReturningNull"].LiteralValue().ShouldBeNull();

var str = sv.ToString();
str.Contains("This is a username").ShouldBeTrue();
Expand Down Expand Up @@ -152,6 +153,9 @@ public class Customized
public Struct1 Struct1 { get; set; }

public Struct2 Struct2 { get; set; }

[LogAsScalar(isMutable: true)]
public StructReturningNull StructReturningNull { get; set; }
}

public class UserAuthData
Expand All @@ -174,4 +178,10 @@ public struct Struct2
public int SomeProperty { get; set; }
public override string ToString() => "BBB";
}

public struct StructReturningNull
{
public int SomeProperty { get; set; }
public override string ToString() => null!;
}
}

0 comments on commit e0576f7

Please sign in to comment.