public void CheckForUserCreated() { IUserService usersService = new UserService(usersRepoMock.Object); IKartService kartsService = new KartService(kartsMock.Object, usersService, productsServiceMock.Object); Kart kart = new Kart(); kartsService.Create(kart); Assert.True(userList.Count == 1); Assert.True(kart.User == userList.LastOrDefault()); }
public void CheckValidAddedProductsAddedToKart(int id, int quant) { IKartService kartsService = new KartService(kartsMock.Object, usersServiceMock.Object, productsServiceMock.Object); Product product = new Product { Id = id, Quantity = quant }; productList.Add(product); kartsService.AddProduct(id, 5); }
public void CheckInvalidAddedProductsAddedToKart(int id, int quant) { IKartService kartsService = new KartService(kartsMock.Object, usersServiceMock.Object, productsServiceMock.Object); Product product = new Product { Id = id, Quantity = quant }; productList.Add(product); try { kartsService.AddProduct(id, 5); Assert.True(false); } catch (ArgumentException) { } }