예제 #1
0
        public void Should_get_null_if_number_property_not_found()
        {
            var sut = new AssetMetadata();

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

            Assert.False(found);
            Assert.Equal(0, result);
        }
예제 #2
0
        public void Should_get_null_if_property_is_not_number()
        {
            var sut = new AssetMetadata
            {
                ["number"] = JsonValue.Create(true)
            };

            var found = sut.TryGetNumber("number", out var result);

            Assert.False(found);
            Assert.Equal(0, result);
        }
예제 #3
0
        public void Should_get_number_if_found()
        {
            var value = 12.5;

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

            var found = sut.TryGetNumber("number", out var result);

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