public async Task <int> AddColor(string colorName)
        {
            IColorService manager = new ColorService();

            return(await manager.AddAsync(new Color()
            {
                ColorName = colorName
            }));
        }
        public async Task AddAsyncShouldThrowNullException(string name)
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(databaseName: "AddAsync").Options;
            var dbContext = new ApplicationDbContext(options);

            var repository = new EfDeletableEntityRepository <Color>(dbContext);
            var service    = new ColorService(repository);
            await Assert.ThrowsAsync <ArgumentNullException>(() => service.AddAsync(name));
        }
        public async Task AddAsyncShouldWork(string name)
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(databaseName: "AddAsync").Options;
            var dbContext = new ApplicationDbContext(options);

            var repository = new EfDeletableEntityRepository <Color>(dbContext);
            var service    = new ColorService(repository);
            await service.AddAsync(name);

            Assert.True(repository.All().Any(x => x.Name == name));
        }
        public async Task GetByNameShouldWork(string name)
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(databaseName: "GetByName").Options;
            var dbContext = new ApplicationDbContext(options);

            var repository = new EfDeletableEntityRepository <Color>(dbContext);
            var service    = new ColorService(repository);
            await service.AddAsync(name);

            Assert.Equal(name, service.GetColorByName(name).Name);
        }