Exemple #1
0
        public void ShouldCallCreateOrderMethodFromOrdersFactory(string userId,
                                                                 string street,
                                                                 string city,
                                                                 string country,
                                                                 string phoneNumber,
                                                                 OrderPaymentStatusType orderPaymentStatusType,
                                                                 OrderStatusType orderStatusType)
        {
            // Arrange
            var sendOn = new DateTime(2017, 4, 6);

            // Act
            this.mockedView.Raise(v => v.CheckingOut += null, new CheckOutEventArgs(userId,
                                                                                    street,
                                                                                    city,
                                                                                    country,
                                                                                    phoneNumber,
                                                                                    sendOn,
                                                                                    orderPaymentStatusType,
                                                                                    orderStatusType));

            // Assert
            this.mockedOrdersFactory.Verify(of => of.CreateOrder(userId,
                                                                 this.user,
                                                                 sendOn,
                                                                 this.shoppingCart.Total,
                                                                 this.address.Id,
                                                                 this.address,
                                                                 phoneNumber,
                                                                 orderPaymentStatusType,
                                                                 orderStatusType), Times.Once);
        }
Exemple #2
0
        public void ShouldCallAddAddressMethodFromAddressesService(string userId,
                                                                   string street,
                                                                   string city,
                                                                   string country,
                                                                   string phoneNumber,
                                                                   OrderPaymentStatusType orderPaymentStatusType,
                                                                   OrderStatusType orderStatusType)
        {
            // Arrange
            var sendOn = new DateTime(2017, 4, 6);

            // Act
            this.mockedView.Raise(v => v.CheckingOut += null, new CheckOutEventArgs(userId,
                                                                                    street,
                                                                                    city,
                                                                                    country,
                                                                                    phoneNumber,
                                                                                    sendOn,
                                                                                    orderPaymentStatusType,
                                                                                    orderStatusType));

            // Assert
            this.mockedAddressesService.Verify(ads =>
                                               ads.AddAddress(this.address), Times.Once);
        }
Exemple #3
0
 public CheckOutEventArgs(string userId,
                          string street,
                          string city,
                          string country,
                          string phoneNumber,
                          DateTime sendOn,
                          OrderPaymentStatusType orderPaymentStatusType,
                          OrderStatusType orderStatusType)
 {
     this.UserId                 = userId;
     this.Street                 = street;
     this.City                   = city;
     this.Country                = country;
     this.PhoneNumber            = phoneNumber;
     this.SendOn                 = sendOn;
     this.OrderStatusType        = orderStatusType;
     this.OrderPaymentStatusType = orderPaymentStatusType;
 }
Exemple #4
0
 public Order(string userId,
              User user,
              DateTime sendOn,
              decimal total,
              int addressId,
              Address address,
              string phoneNumber,
              OrderPaymentStatusType orderPaymentStatusType,
              OrderStatusType orderStatusType) : this()
 {
     this.UserId                 = userId;
     this.User                   = user;
     this.SendOn                 = sendOn;
     this.Total                  = total;
     this.AddressId              = addressId;
     this.Address                = address;
     this.PhoneNumber            = phoneNumber;
     this.OrderPaymentStatusType = orderPaymentStatusType;
     this.OrderStatusType        = orderStatusType;
 }
Exemple #5
0
        public void ShouldSetOrderProductsFromShoppingCartPermanentProducts(string userId,
                                                                            string street,
                                                                            string city,
                                                                            string country,
                                                                            string phoneNumber,
                                                                            OrderPaymentStatusType orderPaymentStatusType,
                                                                            OrderStatusType orderStatusType)
        {
            // Arrange
            var sendOn = new DateTime(2017, 4, 6);

            // Act
            this.mockedView.Raise(v => v.CheckingOut += null, new CheckOutEventArgs(userId,
                                                                                    street,
                                                                                    city,
                                                                                    country,
                                                                                    phoneNumber,
                                                                                    sendOn,
                                                                                    orderPaymentStatusType,
                                                                                    orderStatusType));

            // Assert
            CollectionAssert.AreEquivalent(this.shoppingCart.PermamentProducts, this.order.Products);
        }
Exemple #6
0
        public void ShouldCallGetCartMethodFromShoppingCartsService(string userId,
                                                                    string street,
                                                                    string city,
                                                                    string country,
                                                                    string phoneNumber,
                                                                    OrderPaymentStatusType orderPaymentStatusType,
                                                                    OrderStatusType orderStatusType)
        {
            // Arrange
            var sendOn = new DateTime(2017, 4, 6);

            // Act
            this.mockedView.Raise(v => v.CheckingOut += null, new CheckOutEventArgs(userId,
                                                                                    street,
                                                                                    city,
                                                                                    country,
                                                                                    phoneNumber,
                                                                                    sendOn,
                                                                                    orderPaymentStatusType,
                                                                                    orderStatusType));

            // Assert
            this.mockedShoppingCartsService.Verify(scs => scs.GetCart(userId), Times.Once);
        }