public void ExceptionTestFor_ProductDetailsCannotblank()
        {
            Product product = new Product()
            {
                ProductId   = 1,
                Pic         = "",
                Price       = 1,
                ProductName = "",
                ProductType = "",
                UsedSpan    = "",
                UserId      = 1
            };
            //Assert
            var ex = Assert.Throws <FieldscannotEmptyException>(() => _UserServices.AddProduct(product));

            Assert.Equal("Fields can not be blank ", ex.Messages);
        }
        public void ExceptionTestFor_FieldsCannotblankforProduct()
        {
            Product product = new Product()
            {
                ProductName         = "",
                ShortDescription    = "abc",
                DetailedDescription = "",
                Category            = "",
                StartingPrice       = 1500,
                BidEnddate          = DateTime.Now,
                FinalPrice          = 5000,
                BuyerId             = 3,
                SellerId            = 5
            };
            //Assert
            var ex = Assert.Throws <FieldscannotEmptyException>(() => _Userservice.AddProduct(product));

            Assert.Equal("Fields can not be blank ", ex.Messages);
        }
Exemplo n.º 3
0
        public void Test_for_AddProduct()
        {
            Product product = new Product()
            {
                ProductId           = 1,
                ProductName         = "aa",
                Category            = "dd",
                DetailedDescription = "dd",
                ShortDescription    = "dd",
                BidEnddate          = DateTime.Now,
                BuyerId             = 1,
                FinalPrice          = 11,
                SellerId            = 2,
                StartingPrice       = 33,
            };
            var Result = _Userservice.AddProduct(product);

            Assert.True(Result);
        }
        public void TestFor_AddProduct()
        {
            Product product = new Product()
            {
                ProductId   = 1,
                ProductName = "Sofa",
                ProductType = "",
                Price       = 5000,
                Pic         = "",
                UsedSpan    = "3 months",
                UserId      = 1
            };


            var IsAdded = _Userservice.AddProduct(product);
            var Result  = IsAdded.ToString();

            //Assert
            Assert.NotNull(Result);
        }