Exemplo n.º 1
0
        public void Then_an_OrderAlreadyPaidForException_should_be_thrown()
        {
            var productTitle = new ProductTitle();

            productTitle.Name     = "Hat";
            productTitle.Price    = 9.00m;
            productTitle.Brand    = new Brand();
            productTitle.Category = new Category();
            productTitle.Color    = new ProductColor();
            productTitle.Products = new List <Product>();

            Product product = new Product();

            product.Title = productTitle;
            product.Size  = new ProductSize();

            this.AddItem(product, 1);

            var payment = new Payment(DateTime.Now, "fffljhkjkj", "PayPal", product.Price);

            this.SetPayment(payment);

            Action act = () => this.SetPayment(payment);

            act.Should().Throw <OrderAlreadyPaidForException>();
        }
Exemplo n.º 2
0
        public GetProductResponse GetProduct(GetProductRequest request)
        {
            GetProductResponse response     = new GetProductResponse();
            ProductTitle       productTitle = _productTitleRepository.FindBy(request.ProductId);

            response.Product = _mapper.Map <ProductTitle, ProductView>(productTitle);

            return(response);
        }
Exemplo n.º 3
0
        public GetProductResponse GetProduct(GetProductRequest request)
        {
            GetProductResponse response = new GetProductResponse();

            ProductTitle productTitle = _productTitleRepository.FindBy(request.ProductId);

            response.Product = productTitle.ConvertToProductDetailView();

            return(response);
        }
        public void GivenIHaveAnOrderButNotPaidForIt()
        {
            _order = new Order();

            ProductTitle productTitle = new ProductTitle("Hat", 9.00m, new Brand(), new Category(), new ProductColour(),
                                                         new List<Product> {_product});

            _product = new Product(productTitle, new ProductSize());

            _order.AddItem(_product, 1);
        }
        private Product GetHatProduct()
        {
            List<Product> products = new List<Product>();

            ProductTitle productTitle = new ProductTitle("Hat", 9.00m, new Brand(), new Category(), new ProductColour(),
                                                        products);

            Product product = new Product(productTitle, new ProductSize()) {Id = 1};

            products.Add(product);

            return product;
        }
Exemplo n.º 6
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = NextChargeScheduledAt.GetHashCode();
         hashCode = (hashCode * 397) ^ Price.GetHashCode();
         hashCode = (hashCode * 397) ^ Quantity.GetHashCode();
         hashCode = (hashCode * 397) ^ ShopifyVariantId.GetHashCode();
         hashCode = (hashCode * 397) ^ (ProductTitle != null ? ProductTitle.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ ShopifyProductId.GetHashCode();
         return(hashCode);
     }
 }
        public void Given()
        {
            DomainEvents.DomainEventHandlerFactory = new StubDomaubinEventHandlerFactory();

            _order = new Order();

            ProductTitle productTitle = new ProductTitle("Hat", 9.00m, new Brand(), new Category(), new ProductColour(),
                                                         new List<Product>());

            Product product = new Product(productTitle, new ProductSize());

            _order.AddItem(product, 1);
        }
        public void Given()
        {
            DomainEvents.DomainEventHandlerFactory = new StubDomaubinEventHandlerFactory();

            _order = new Order();

            ProductTitle productTitle = new ProductTitle("Hat", 9.00m, new Brand(), new Category(), new ProductColour(),
                                                         new List <Product>());

            Product product = new Product(productTitle, new ProductSize());

            _order.AddItem(product, 1);
        }
Exemplo n.º 9
0
        public void GivenIHaveAnOrderButNotPaidForIt()
        {
            _order = new Order();

            ProductTitle productTitle = new ProductTitle("Hat", 9.00m, new Brand(), new Category(), new ProductColour(),
                                                         new List <Product> {
                _product
            });

            _product = new Product(productTitle, new ProductSize());

            _order.AddItem(_product, 1);
        }
        public void Given()
        {
            _order = new Order();

            ProductTitle productTitle = new ProductTitle("Hat", 9.00m, new Brand(), new Category(), new ProductColour(),
                                                         new List<Product>());

            Product product = new Product(productTitle, new ProductSize());

            _order.AddItem(product, 1);

            Payment payment = new Payment(DateTime.Now, "fffljhkjkj", "PayPal", product.Price);

            _order.SetPayment(payment);
        }
        public void Given()
        {
            _order = new Order();

            ProductTitle productTitle = new ProductTitle("Hat", 9.00m, new Brand(), new Category(), new ProductColour(),
                                                         new List <Product>());

            Product product = new Product(productTitle, new ProductSize());

            _order.AddItem(product, 1);

            Payment payment = new Payment(DateTime.Now, "fffljhkjkj", "PayPal", product.Price);

            _order.SetPayment(payment);
        }
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Quantity.GetHashCode();
         hashCode = (hashCode * 397) ^ ShopifyProductId.GetHashCode();
         hashCode = (hashCode * 397) ^ ShopifyVariantId.GetHashCode();
         hashCode = (hashCode * 397) ^ (Price != null ? Price.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ProductTitle != null ? ProductTitle.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Grams.GetHashCode();
         hashCode = (hashCode * 397) ^ (Vendor != null ? Vendor.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Sku != null ? Sku.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (VariantTitle != null ? VariantTitle.GetHashCode() : 0);
         return(hashCode);
     }
 }
        private Product GetHatProduct()
        {
            List <Product> products = new List <Product>();

            ProductTitle productTitle = new ProductTitle("Hat", 9.00m, new Brand(), new Category(), new ProductColour(),
                                                         products);

            Product product = new Product(productTitle, new ProductSize())
            {
                Id = 1
            };

            products.Add(product);

            return(product);
        }
        public void Given()
        {
            _basket = new Basket.Basket();

            var productTitle = new ProductTitle();

            productTitle.Name     = "Product A";
            productTitle.Price    = 15.00m;
            productTitle.Brand    = new Brand();
            productTitle.Category = new Category();
            productTitle.Color    = new ProductColor();
            productTitle.Products = null;

            _product       = new Product();
            _product.Title = productTitle;
            _product.Size  = new ProductSize();

            _basket.Add(_product);
        }
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (OrderIntervalUnit != null ? OrderIntervalUnit.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ OrderIntervalFrequency.GetHashCode();
         hashCode = (hashCode * 397) ^ ChargeIntervalFrequency.GetHashCode();
         hashCode = (hashCode * 397) ^ (ProductTitle != null ? ProductTitle.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (VariantTitle != null ? VariantTitle.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Price.GetHashCode();
         hashCode = (hashCode * 397) ^ Quantity.GetHashCode();
         hashCode = (hashCode * 397) ^ ShopifyVariantId.GetHashCode();
         hashCode = (hashCode * 397) ^ OrderDayOfWeek.GetHashCode();
         hashCode = (hashCode * 397) ^ OrderDayOfMonth.GetHashCode();
         hashCode = (hashCode * 397) ^ ExpireAfterSpecificNumberOfCharges.GetHashCode();
         hashCode = (hashCode * 397) ^ (Sku != null ? Sku.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ SkuOverride.GetHashCode();
         return(hashCode);
     }
 }
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = AddressId.GetHashCode();
         hashCode = (hashCode * 397) ^ NextChargeScheduledAt.GetHashCode();
         hashCode = (hashCode * 397) ^ ShopifyVariantId.GetHashCode();
         hashCode = (hashCode * 397) ^ Quantity.GetHashCode();
         hashCode = (hashCode * 397) ^ (OrderIntervalUnit != null ? OrderIntervalUnit.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (OrderIntervalFrequency != null ? OrderIntervalFrequency.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ NumberChargesUntilExpiration.GetHashCode();
         hashCode = (hashCode * 397) ^ (ChargeIntervalFrequency != null ? ChargeIntervalFrequency.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ CustomerId.GetHashCode();
         hashCode = (hashCode * 397) ^ (Status != null ? Status.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Price.GetHashCode();
         hashCode = (hashCode * 397) ^ (ProductTitle != null ? ProductTitle.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ OrderDayOfMonth.GetHashCode();
         hashCode = (hashCode * 397) ^ OrderDayOfWeek.GetHashCode();
         return(hashCode);
     }
 }
Exemplo n.º 17
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = AddressId.GetHashCode();
         hashCode = (hashCode * 397) ^ CreatedAt.GetHashCode();
         hashCode = (hashCode * 397) ^ CustomerId.GetHashCode();
         hashCode = (hashCode * 397) ^ Id.GetHashCode();
         hashCode = (hashCode * 397) ^ NextChargeScheduledAt.GetHashCode();
         hashCode = (hashCode * 397) ^ Price.GetHashCode();
         hashCode = (hashCode * 397) ^ (ProductTitle != null ? ProductTitle.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Quantity.GetHashCode();
         hashCode = (hashCode * 397) ^ RechargeProductId.GetHashCode();
         hashCode = (hashCode * 397) ^ ShopifyProductId.GetHashCode();
         hashCode = (hashCode * 397) ^ ShopifyVariantId.GetHashCode();
         hashCode = (hashCode * 397) ^ (Sku != null ? Sku.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Status != null ? Status.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ UpdatedAt.GetHashCode();
         hashCode = (hashCode * 397) ^ (VariantTitle != null ? VariantTitle.GetHashCode() : 0);
         return(hashCode);
     }
 }
        public void Given()
        {
            DomainEvents.DomainEventHandlerFactory = new StubDomainEventHandlerFactory();

            _order = new Order();

            var productTitle = new ProductTitle();

            productTitle.Name     = "Hat";
            productTitle.Price    = 9.00m;
            productTitle.Brand    = new Brand();
            productTitle.Category = new Category();
            productTitle.Color    = new ProductColor();
            productTitle.Products = new List <Product>();

            var product = new Product();

            product.Title = productTitle;
            product.Size  = new ProductSize();

            _order.AddItem(product, 1);
        }
Exemplo n.º 19
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = RechargeProductId.GetHashCode();
         hashCode = (hashCode * 397) ^ SkuOverride.GetHashCode();
         hashCode = (hashCode * 397) ^ Id.GetHashCode();
         hashCode = (hashCode * 397) ^ AddressId.GetHashCode();
         hashCode = (hashCode * 397) ^ CustomerId.GetHashCode();
         hashCode = (hashCode * 397) ^ CreatedAt.GetHashCode();
         hashCode = (hashCode * 397) ^ UpdatedAt.GetHashCode();
         hashCode = (hashCode * 397) ^ NextChargeScheduledAt.GetHashCode();
         hashCode = (hashCode * 397) ^ CancelledAt.GetHashCode();
         hashCode = (hashCode * 397) ^ (ProductTitle != null ? ProductTitle.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (VariantTitle != null ? VariantTitle.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Price.GetHashCode();
         hashCode = (hashCode * 397) ^ Quantity.GetHashCode();
         hashCode = (hashCode * 397) ^ (Status != null ? Status.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ ShopifyProductId.GetHashCode();
         hashCode = (hashCode * 397) ^ ShopifyVariantId.GetHashCode();
         hashCode = (hashCode * 397) ^ (Sku != null ? Sku.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (OrderIntervalUnit != null ? OrderIntervalUnit.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^
                    (OrderIntervalFrequency != null ? OrderIntervalFrequency.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^
                    (ChargeIntervalFrequency != null ? ChargeIntervalFrequency.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (CancellationReason != null ? CancellationReason.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^
                    (CancellationReasonComments != null ? CancellationReasonComments.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ OrderDayOfWeek.GetHashCode();
         hashCode = (hashCode * 397) ^ OrderDayOfMonth.GetHashCode();
         hashCode = (hashCode * 397) ^ ExpireAfterSpecificNumberOfCharges.GetHashCode();
         hashCode = (hashCode * 397) ^ MaxRetriesReached.GetHashCode();
         hashCode = (hashCode * 397) ^ HasQueuedCharges.GetHashCode();
         hashCode = (hashCode * 397) ^ CommitUpdate.GetHashCode();
         return(hashCode);
     }
 }
        public void Given()
        {
            _order = new Order();

            ProductTitle productTitle = new ProductTitle();

            productTitle.Name     = "Hat";
            productTitle.Price    = 9.00m;
            productTitle.Brand    = new Brand();
            productTitle.Category = new Category();
            productTitle.Color    = new ProductColor();
            productTitle.Products = new List <Product>();

            Product product = new Product();

            product.Title = productTitle;
            product.Size  = new ProductSize();

            _order.AddItem(product, 1);

            Payment payment = new Payment(DateTime.Now, "fffljhkjkj", "PayPal", product.Price);

            _order.SetPayment(payment);
        }
Exemplo n.º 21
0
 public static ProductView ToProductView(this ProductTitle product)
 => Mapper.Map <ProductTitle, ProductView>(product);
Exemplo n.º 22
0
 public static ProductView ConvertToProductDetailView(this ProductTitle product)
 {
     return(Mapper.Map <ProductTitle, ProductView>(product));
 }