コード例 #1
0
        public void WhenSerializingNullableAmount_AndTheValueIsNull_IGetCorrectlyFormattedValue()
        {
            var testData = new AmountNullableStub
            {
                Amount = null
            };

            var serializedData = JsonConvert.SerializeObject(testData);

            serializedData.Should().Be("{\"amount\":null}");
        }
コード例 #2
0
        public void WhenSerializingNullableAmount_IGetCorrectlyFormattedValue()
        {
            var testData = new AmountNullableStub
            {
                Amount = 10.11m
            };

            var serializedData = JsonConvert.SerializeObject(testData);

            serializedData.Should().Be("{\"amount\":\"10.11\"}");
        }