public void OrdersByCountDescending() { InitFields(); ProductsDTOFacade productsDTOFacade = new ProductsDTOFacade( productsRepositoryMock.Object, GetMapper(), priorityUserProductsRespositoryMock.Object); ProductDTO top1product; user2product4.Count = 2; user2product5.Count = 1; top1product = productsDTOFacade.GetAllProductsForUser(secondUserGuid).First(); Assert.Equal(top1product.Id, product4.Id); user2product4.Count = 1; user2product5.Count = 2; top1product = productsDTOFacade.GetAllProductsForUser(secondUserGuid).First(); Assert.Equal(top1product.Id, product5.Id); }
public void ReturnsAllProductsGivenFromRepository() { InitFields(); ProductsDTOFacade productsDTOFacade = new ProductsDTOFacade( productsRepositoryMock.Object, GetMapper(), priorityUserProductsRespositoryMock.Object); int productsForUserCount = productsRepositoryMock.Object.GetAllProductsForUser(firstUserGuid).Count(); int sortedProductsForUserCount = productsDTOFacade.GetAllProductsForUser(firstUserGuid).Count(); Assert.Equal(productsForUserCount, sortedProductsForUserCount); }
public IEnumerable <ProductDTO> GetAllProductsForUser() { var UserId = GetUserId(); return(_productsDTOFacade.GetAllProductsForUser(UserId)); }