Esempio n. 1
0
        public async Task Add_Product_Should_Return_Added_Product()
        {
            MongoProductStore productStore = new MongoProductStore();
            var product = await productStore.AddProductAsync(demoProductEntity);

            Assert.Equal(product.Name, demoProductEntity.Name);
            Assert.Equal(product.SellerId, demoProductEntity.SellerId);
            Assert.Equal(product.Name, demoProductEntity.Name);
            Assert.Equal(product.Description, demoProductEntity.Description);
            Assert.Equal(product.HeroImage, demoProductEntity.HeroImage);
            Assert.Equal(product.Price.Money.Amount, demoProductEntity.Price.Money.Amount);
            Assert.Equal(product.Price.Money.Currency, demoProductEntity.Price.Money.Currency);
            Assert.Equal(product.Price.IsNegotiable, demoProductEntity.Price.IsNegotiable);
            Assert.Equal(product.Category, demoProductEntity.Category);
            Assert.Equal(product.Status, demoProductEntity.Status);
            Assert.Equal(product.PostDateTime.ToString(), demoProductEntity.PostDateTime.ToString());
            Assert.Equal(product.ExpirationDate.ToString(), demoProductEntity.ExpirationDate.ToString());
            for (var i = 0; i < demoProductEntity.Images.Count; i++)
            {
                Assert.Equal(product.Images[i], demoProductEntity.Images[i]);
            }
            Assert.Equal(product.PurchasedDate.ToString(), demoProductEntity.PurchasedDate.ToString());
            Assert.Equal(product.PickupAddress.Line1, demoProductEntity.PickupAddress.Line1);
            Assert.Equal(product.PickupAddress.Line2, demoProductEntity.PickupAddress.Line2);
            Assert.Equal(product.PickupAddress.City, demoProductEntity.PickupAddress.City);
            Assert.Equal(product.PickupAddress.State, demoProductEntity.PickupAddress.State);
            Assert.Equal(product.PickupAddress.Pincode, demoProductEntity.PickupAddress.Pincode);
        }
Esempio n. 2
0
        public async Task Add_Product_Should_Not_Add_When_Database_Is_Down()
        {
            MongoProductStore productStore = new MongoProductStore();
            Exception         ex           = await Assert.ThrowsAsync <BaseException>(() => productStore.AddProductAsync(demoProductEntity));

            Assert.Equal("Unexpected Error Occured, Please Try Again Later", ex.Message);
        }