public void AddingInvalidMarkdownReturnsErrorMessage()
        {
            Mock <IRepository <Markdown> > mockMarkdownRepository = new Mock <IRepository <Markdown> >();

            mockMarkdownRepository.Setup(x => x.Save(invalidMarkdown));

            Mock <IRepository <Product> > mockPriceRepository = new Mock <IRepository <Product> >();

            mockPriceRepository.Setup(x => x.GetAll()).Returns(productList);

            MarkdownDataAccessor markdownDataAccessor = new MarkdownDataAccessor(mockMarkdownRepository.Object,
                                                                                 mockPriceRepository.Object);

            var result = markdownDataAccessor.Save(invalidMarkdown);

            Assert.AreEqual(result, "Error: Markdown must be smaller than price.");
        }
        public void AddingMarkdownForNonExistentReturnsErrorMessage()
        {
            Mock <IRepository <Markdown> > mockMarkdownRepository = new Mock <IRepository <Markdown> >();

            mockMarkdownRepository.Setup(x => x.Save(markdownForNonExistentPrice));

            Mock <IRepository <Product> > mockPriceRepository = new Mock <IRepository <Product> >();

            mockPriceRepository.Setup(x => x.GetAll()).Returns(productList);

            MarkdownDataAccessor markdownDataAccessor = new MarkdownDataAccessor(mockMarkdownRepository.Object,
                                                                                 mockPriceRepository.Object);

            var result = markdownDataAccessor.Save(markdownForNonExistentPrice);

            Assert.AreEqual(result, "Error: Cannot add markdown for a product that doesn't have a price.");
        }
        public void AddingValidMarkdownReturnsSuccess()
        {
            Mock <IRepository <Markdown> > mockMarkdownRepository = new Mock <IRepository <Markdown> >();

            mockMarkdownRepository.Setup(x => x.Save(validMarkdown));

            Mock <IRepository <Product> > mockPriceRepository = new Mock <IRepository <Product> >();

            mockPriceRepository.Setup(x => x.GetAll()).Returns(productList);

            MarkdownDataAccessor markdownDataAccessor = new MarkdownDataAccessor(mockMarkdownRepository.Object,
                                                                                 mockPriceRepository.Object);

            var result = markdownDataAccessor.Save(validMarkdown);

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