示例#1
0
        public void CanBuildAddressFromJson()
        {
            var correctAddress = new Address
            {
                Id     = 1,
                Street = "667 Massachusetts Avenue",
                City   = "Cambridge",
                State  = "MA",
                Zip    = "02139"
            };

            // Generate an address from an XML string using the factory method
            var address = AddressParser.ParseAddressFromJson
                          (
                @"{
                    ""UniqueId"": 1,
                    ""Street"": ""667 Massachusetts Avenue"",
                    ""City"": ""Cambridge"",
	                ""State"": ""MA"",
	                ""Zip"": ""02139""
                }"
                          );

            Assert.True(address.Equals(correctAddress));
        }