public void ReturnCorrectData_WhenInvoked()
        {
            // Arrange
            Mapper.Reset();
            AutomapperConfiguration.Initialize();
            var mockContext = new Mock <IOnlineStoreContext>();
            var products    = new List <Product> {
                new Product {
                    Name = "Testproduct", Quantity = 5, Category = new Category {
                        Name = "Patki"
                    }
                }
            };
            var fakemapper          = new Mock <IMapper>();
            var fakeCategoryService = new Mock <ICategoryService>();
            var mockSet             = new Mock <DbSet <Product> >();

            mockSet.SetupData(products);
            mockContext.Setup(s => s.Products).Returns(mockSet.Object);
            var service = new Logic.Services.ProductService(mockContext.Object, fakemapper.Object, fakeCategoryService.Object);

            // Act
            var productsGot = service.GetAllProducts();

            //Assert
            Assert.AreEqual(products.Count, productsGot.Count());
        }
        public void ReturnInstanceOfTypeIEnumerableProductModel_WhenInvoked()
        {
            // Arrange
            Mapper.Reset();
            AutomapperConfiguration.Initialize();
            var mockContext  = new Mock <IOnlineStoreContext>();
            var productsMock = new List <Product> {
                new Product {
                    Name = "Testproduct", Quantity = 5
                }
            }.GetQueryableMockDbSet();

            var fakemapper          = new Mock <IMapper>();
            var fakeCategoryService = new Mock <ICategoryService>();

            mockContext.Setup(s => s.Products).Returns(productsMock.Object);

            var service = new Logic.Services.ProductService(mockContext.Object, fakemapper.Object, fakeCategoryService.Object);

            // Act
            var products = service.GetAllProducts();

            //Assert
            Assert.IsInstanceOfType(products, typeof(IEnumerable <ProductModel>));
        }