public void ItReturnsCollectionOfColorDetail() { // Arrange // Act var colors = _colorService.GetAll(); // Assert Assert.NotNull(colors); Assert.IsAssignableFrom <IEnumerable <ColorDetail> >(colors); }
private List <SelectListItem> BuildListColor(string[] listColorSelected = null) { return(ColorService.GetAll().AsEnumerable() .Select(c => new SelectListItem { Value = c.Code, Text = c.Name, Selected = (listColorSelected != null && listColorSelected.Length > 0 && listColorSelected.Contains(c.Code)) }).ToList()); }
private static void GetAllColor(ColorService colorService) { Console.WriteLine("List of Color"); var result = colorService.GetAll(); if (result.Success) { foreach (var brand in result.Data) { Console.WriteLine(brand.Name); } } }
public async Task GetAllGenericShouldWork() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(databaseName: "GetAllGeneric").Options; var dbContext = new ApplicationDbContext(options); dbContext.Colors.Add(new Color()); dbContext.Colors.Add(new Color()); dbContext.Colors.Add(new Color()); await dbContext.SaveChangesAsync(); var repository = new EfDeletableEntityRepository <Color>(dbContext); var service = new ColorService(repository); Assert.Equal(3, service.GetAll <Color>().Count()); }
[Route("getColors")] //api/customer/product/getProducts public async Task <IActionResult> GetColors() { return(Ok(await colorService.GetAll())); }
public IEnumerable <Color> GetColor() { Guid activeId = new Guid("87577063-322E-4901-98D2-FF519341D992"); return(colorService.GetAll().Result.Where(m => m.StatusId == activeId)); }