コード例 #1
0
        public async void WithIncorrectId_ShouldThrowException()
        {
            var dbContext = this.GetDbContext();
            var service   = this.GetService(dbContext);
            var id        = Guid.NewGuid().ToString();

            var model = FuelTypeServiceModelMethods.Create(id);

            var exception = await Assert.ThrowsAsync <ArgumentException>(async() => await service.EditAsync(model));

            Assert.Equal(ErrorConstants.IncorrectId, exception.Message);
        }
コード例 #2
0
        public async void WithCorrectId_ShouldEditFuelType()
        {
            var dbContext  = this.GetDbContext();
            var service    = this.GetService(dbContext);
            var dbFuelType = SeedFuelTypesMethods.SeedFuelType(dbContext);
            var name       = Guid.NewGuid().ToString();

            var model = FuelTypeServiceModelMethods.Create(dbFuelType.Id, name);

            await service.EditAsync(model);

            Assert.Equal(model.Name, dbFuelType.Name);
        }