示例#1
0
        public void AddingInvalidPriceReturnsErrorMessage()
        {
            Mock <IRepository <Product> > mockPriceRepository = new Mock <IRepository <Product> >();

            mockPriceRepository.Setup(x => x.Save(invalidProduct));

            PriceDataAccessor priceDataAccessor = new PriceDataAccessor(mockPriceRepository.Object);

            var result = priceDataAccessor.Save(invalidProduct);

            Assert.AreEqual(result, "Error: Price must be bigger than 0.");
        }
示例#2
0
        public void AddingValidPriceReturnsSuccess()
        {
            Mock <IRepository <Product> > mockPriceRepository = new Mock <IRepository <Product> >();

            mockPriceRepository.Setup(x => x.Save(validProduct));

            PriceDataAccessor priceDataAccessor = new PriceDataAccessor(mockPriceRepository.Object);

            var result = priceDataAccessor.Save(validProduct);

            Assert.AreEqual(result, "Success.");
        }