public void TestArticlesAreInBasketShouldReturnValidData()
        {
            var articleOne = new Article {
                Price = 19.99M, Quantity = 2
            };
            var articleTwo = new Article {
                Price = 69.99M, Quantity = 1
            };

            var interactor = new GetBasketInteractor <IViewModel>(
                new TestGetBasketPresenter(),
                new InMemoryBasketRepository(new Basket("*****@*****.**")
            {
                Articles = new List <Article> {
                    articleOne, articleTwo
                }
            }));

            interactor.ExecuteAsync(new GetBasketRequest {
                Email = "*****@*****.**"
            });

            var response = ((TestGetBasketPresenter)interactor.Presenter).GetBasketResponse();

            Assert.AreEqual(2, response.ArticleCount);
            Assert.AreEqual(109.97M, response.BasketValue);
            Assert.AreEqual("*****@*****.**", response.Email);
        }
        public void TestNoArticlesAreInBasketShouldHaveArticleCountOfZero()
        {
            var interactor = new GetBasketInteractor <IViewModel>(new TestGetBasketPresenter(), new InMemoryBasketRepository());

            interactor.ExecuteAsync(new GetBasketRequest {
                Email = "*****@*****.**"
            });

            var response = ((TestGetBasketPresenter)interactor.Presenter).GetBasketResponse();

            Assert.AreEqual(0, response.ArticleCount);
            Assert.AreEqual(0M, response.BasketValue);
        }
Beispiel #3
0
 public HomeController()
 {
     GetBasketInteractor  = new GetBasketInteractor <BasketModel>(new GetBasketPresenter(), new CacheBasketRepository());
     AddArticleInteractor =
         new AddArticleInteractor <BasketModel>(new AddArticlePresenter(), new CacheBasketRepository());
 }