Beispiel #1
0
    public void DisplayFormatString_LastSettingWins()
    {
        // Arrange
        var displayMetadata = new DisplayMetadata();

        // Act 1
        displayMetadata.DisplayFormatString = "first string";

        // Assert 1
        Assert.Equal("first string", displayMetadata.DisplayFormatString);
        Assert.Equal("first string", displayMetadata.DisplayFormatStringProvider());

        // Act 2
        displayMetadata.DisplayFormatStringProvider = () => "second string";

        // Assert 2
        Assert.Equal("second string", displayMetadata.DisplayFormatString);
        Assert.Equal("second string", displayMetadata.DisplayFormatStringProvider());

        // Act 3
        displayMetadata.DisplayFormatString = "third string";

        // Assert 3
        Assert.Equal("third string", displayMetadata.DisplayFormatString);
        Assert.Equal("third string", displayMetadata.DisplayFormatStringProvider());
    }
Beispiel #2
0
    public void DisplayFormatString_AffectsBothDisplayFormatProperties()
    {
        // Arrange
        var displayMetadata = new DisplayMetadata();

        // Act
        displayMetadata.DisplayFormatString = "expected string";

        // Assert
        Assert.Equal("expected string", displayMetadata.DisplayFormatString);
        Assert.Equal("expected string", displayMetadata.DisplayFormatStringProvider());
    }