Esempio n. 1
0
        public void Should_build_routing_slip()
        {
            var builder = new RoutingSlipBuilder();

            var routingSlipId = Guid.NewGuid();

            RoutingSlip routingSlip = builder.CreateRoutingSlip(routingSlipId, "foo");

            routingSlip.ShouldNotBeNull();
            routingSlip.Id.ShouldEqual(routingSlipId);
            routingSlip.Itinerary.Count().ShouldEqual(1);
            routingSlip.Itinerary.First().Address.ShouldEqual("foo");
        }
        public void Should_be_able_to_serialize()
        {
            var builder     = new RoutingSlipBuilder();
            var routingSlip = builder.CreateRoutingSlip(Guid.NewGuid(), "foo", "bar");

            routingSlip.Log.Add(new ProcessingStepResult {
                Address = "baz"
            });

            var result = JsonConvert.SerializeObject(routingSlip);

            var deserialized = JsonConvert.DeserializeObject <RoutingSlip>(result);

            deserialized.Id.ShouldEqual(routingSlip.Id);
            deserialized.Itinerary.Count.ShouldEqual(2);
            deserialized.Itinerary[0].Address.ShouldEqual("foo");
            deserialized.Itinerary[1].Address.ShouldEqual("bar");
            deserialized.Log.Count.ShouldEqual(1);
            deserialized.Log[0].Address.ShouldEqual("baz");
        }