public async Task put_model_throw_bad_request() { var db = BaseDbContextMock.GetDbContext(); var controller = new BaseControllerMock(db); var item = db.Models.Find(1); var actionResult = await controller.PutItemAsync(item, 3); Assert.IsType <BadRequestResult>(actionResult); }
public async Task put_model() { var db = BaseDbContextMock.GetDbContext(); var controller = new BaseControllerMock(db); var item = await db.Models.FindAsync(1); item.ParentModelId = 2; var actionResult = await controller.PutItemAsync(item, item.Id); Assert.IsType <NoContentResult>(actionResult); Assert.Equal(await db.Models.FindAsync(1), item); }