public async Task TestGetAllAccessorie_WithGivenType_ShouldReturnAllAccessorie() { // Arrange var context = ApplicationDbContextInMemoryFactory.InitializeContext(); var groupRepository = new EfDeletableEntityRepository <Product_Group>(context); var productRepository = new EfDeletableEntityRepository <Product>(context); var accessorieRepository = new EfDeletableEntityRepository <Accessorie>(context); var groupService = new GroupService(groupRepository); var prodcutService = new ProductService(productRepository, groupService); var cloudinaryService = new FakeCloudinary(); var accessorieService = new AccessoriesService(accessorieRepository, prodcutService, groupService, cloudinaryService); var seeder = new DbContextTestsSeeder(); await seeder.SeedUsersAsync(context); await seeder.SeedGroupAsync(context); await seeder.SeedAccessorieAsync(context); // Act AutoMapperConfig.RegisterMappings(typeof(AllAccessorieViewModel).Assembly); var result = accessorieService.GetAllAccessorieAsync <AllAccessorieViewModel>(); var expected = result.ToList().Count; var actual = context.Accessories.Count(); // Assert Assert.True(expected == actual, string.Format(ErrorMessage, "GetAllAccessorie")); }