public void ImmutableStruct() { var @struct = new PropertiesSample.ImmutableStruct(property: "value"); TestValueAnalysis(@struct.Property, @struct.Property == null /*Expect:ConditionIsAlwaysTrueOrFalse[Prps && !RtRT]*/); @struct.Property.Should().Be("value"); }
public void ImmutableStructAndDefaultCtor() { var @struct = new PropertiesSample.ImmutableStruct(); // Here the implicit NotNull is wrong, but we have the NullGuard check at the property getter: Action act = () => { var value = @struct.Property; TestValueAnalysis(value, value == null /*Expect:ConditionIsAlwaysTrueOrFalse[Prps && !RtRT]*/); }; act.ShouldThrow <InvalidOperationException>().WithMessage("[NullGuard] Return value * is null."); }