Ejemplo n.º 1
0
 public void EnactCommand(SpecifyShippingInfo command)
 {
     RecordEvent(new ShippingMethodSelected
     {
         Address         = command.Address,
         City            = command.City,
         StateOrProvince = command.StateOrProvince,
         Country         = command.Country,
         DeliverBy       = command.DeliverBy,
         RecipientName   = command.RecipientName,
     });
 }
Ejemplo n.º 2
0
        public void The_event_Actor_is_set_from_the_Command_Principal()
        {
            // arrange
            var customer = new Customer(Any.FullName());
            var serviceRepresentative = new CustomerServiceRepresentative
            {
                Name = Any.FullName()
            };
            var command = new SpecifyShippingInfo
            {
                Principal = serviceRepresentative
            };

            var order = new Order(new CreateOrder(customer.Name)
            {
                Principal = customer
            });

            // act
            order.Apply(command);

            // assert
            order.Events()
                 .OfType<Order.Created>()
                 .Single()
                 .Actor()
                 .Should()
                 .Be(customer.Name);

            order.Events()
                 .OfType<Order.ShippingMethodSelected>()
                 .Single()
                 .Actor()
                 .Should()
                 .Be(serviceRepresentative.Name);
        }
Ejemplo n.º 3
0
        public void The_event_Actor_is_set_from_the_Command_Principal()
        {
            // arrange
            var customer = new Customer(Any.FullName());
            var serviceRepresentative = new CustomerServiceRepresentative
            {
                Name = Any.FullName()
            };
            var command = new SpecifyShippingInfo
            {
                Principal = serviceRepresentative
            };

            var order = new Order(new CreateOrder(customer.Name)
            {
                Principal = customer
            });

            // act
            order.Apply(command);

            // assert
            order.Events()
            .OfType <Order.Created>()
            .Single()
            .Actor()
            .Should()
            .Be(customer.Name);

            order.Events()
            .OfType <Order.ShippingMethodSelected>()
            .Single()
            .Actor()
            .Should()
            .Be(serviceRepresentative.Name);
        }