コード例 #1
0
        public void SetUp()
        {
            messageSerializers = new IMessageSerializer[]
            {new BinarySerializer(), new BasicJsonMessageSerializer(), new XmlMessageSerializer()};
            theGraph = new ChannelGraph();
            theSerializer = new EnvelopeSerializer(theGraph, messageSerializers);

            theAddress = new Address {City = "Jasper", State = "Missouri"};
        }
コード例 #2
0
        public void can_round_trip()
        {
            var address1 = new Address
            {
                City = "Austin",
                State = "Texas"
            };

            var stream = new MemoryStream();
            var serializer = new BinarySerializer();
            serializer.Serialize(address1, stream);

            stream.Position = 0;

            var address2 = serializer.Deserialize(stream).ShouldBeOfType<Address>();
            address1.ShouldBe(address2);
        }
コード例 #3
0
 protected bool Equals(Address other)
 {
     return string.Equals(City, other.City) && string.Equals(State, other.State);
 }