コード例 #1
0
        public void Should_get_null_if_string_property_not_found()
        {
            var sut = new AssetMetadata();

            var found = sut.TryGetString("other", out var result);

            Assert.False(found);
            Assert.Null(result);
        }
コード例 #2
0
        public void Should_get_null_if_property_is_not_string()
        {
            var sut = new AssetMetadata
            {
                ["string"] = JsonValue.Create(12)
            };

            var found = sut.TryGetString("string", out var result);

            Assert.False(found);
            Assert.Null(result);
        }
コード例 #3
0
        public void Should_get_string_if_found()
        {
            var value = "Hello";

            var sut = new AssetMetadata
            {
                ["string"] = JsonValue.Create(value)
            };

            var found = sut.TryGetString("string", out var result);

            Assert.True(found);
            Assert.Equal(value, result);
        }