public async void WithCorrectId_ShouldDeleteOption() { var dbContext = this.GetDbContext(); var dbOption = SeedOptionsMethods.SeedOption(dbContext); var service = this.GetService(dbContext); await service.DeleteAsync(dbOption.Id); Assert.Empty(dbContext.Options); }
public async void WithCorrectId_ShouldReturnOption() { var dbContext = this.GetDbContext(); var dbOption = SeedOptionsMethods.SeedOptionWithOptionType(dbContext); var service = this.GetService(dbContext); var model = await service.GetByIdAsync(dbOption.Id); Assert.NotNull(model); }
public void WithOption_ShouldReturnOption() { var dbContext = this.GetDbContext(); SeedOptionsMethods.SeedOptionWithOptionType(dbContext); var service = this.GetService(dbContext); var models = service.GetAll(); Assert.Single(models); }
public async void WithCorrectId_ShouldEditOption() { var dbContext = this.GetDbContext(); var dbOption = SeedOptionsMethods.SeedOption(dbContext); var service = this.GetService(dbContext); var modelName = Guid.NewGuid().ToString(); var model = OptionServiceModelMethods.Create(dbOption.Id, modelName); await service.EditAsync(model); Assert.Equal(model.Name, dbOption.Name); }
public async void WithOptions_ShouldReplaceOptions() { var dbContext = this.GetDbContext(); var carOption = SeedOptionsMethods.SeedOption(dbContext); var dbCarOptions = EntitiesCreateMethods.CreateCarOption(carOption); var dbCar = SeedCarsMethods.SeedCar <NewCar>(dbContext, dbCarOptions); var service = this.GetService(dbContext); var inputOption = SeedOptionsMethods.SeedOption(dbContext); var model = CarServiceModelCreateMethods.Create(dbCar.Id, inputOption); await service.EditAsync <NewCar>(model); Assert.True(dbCar.Options.All(o => inputOption.Id == o.OptionId)); }