public void Can_Dump_Class_With_Custom_TypeHandler()
    {
        // Arrange
        var input = new MyImmutableClass("test", 3);

        // Act
        var actual = Dump(input, new MyCustomTypeHandler());

        // Assert
        actual.Should().Be(@"MyImmutableClass.Create(@""test"", 3)");
    }
Ejemplo n.º 2
0
    public void ProcessInstance_Returns_True_When_PropertyValue_On_Immutable_Instance_Is_Null()
    {
        // Arrange
        var sut          = new DefaultObjectHandler();
        var instance     = new MyImmutableClass("test");
        var command      = new ObjectHandlerRequest(instance, typeof(MyImmutableClass), 0, typeof(MyImmutableClass), false);
        var callbackMock = new Mock <ICsharpExpressionDumperCallback>();

        // Act
        var actual = sut.ProcessInstance(command, callbackMock.Object);

        // Assert
        actual.Should().BeTrue();
    }
    public void Can_Dump_Class_With_Custom_TypeNameFormatter()
    {
        // Arrange
        var input = new MyImmutableClass("test", 3);

        // Act
        var actual = Dump(input, new[] { new MyCustomTypeFormatter() });

        // Assert
        actual.Should().Be(@"new MYIMMUTABLECLASS
(
    property1: @""test"",
    property2: 3
)");
    }
    public void Can_Dump_Immutable_Class_With_One_Constructor()
    {
        // Arrange
        var input = new MyImmutableClass("test", 2);

        // Act
        var actual = Dump(input);

        // Assert
        actual.Should().Be(@"new CsharpExpressionDumper.Core.Tests.TestData.MyImmutableClass
(
    property1: @""test"",
    property2: 2
)");
    }