public async Task UpdateNotFound() { var sut = new GizmosController(_ctx); var actual = await sut.Update(0, new Gizmo { Id = 0 }); Assert.Equal(typeof(NotFoundResult), actual.GetType()); }
public async Task UpdateBadRequestNull() { var sut = new GizmosController(_ctx); var actual = await sut.Update(0, null); Assert.Equal(typeof(BadRequestResult), actual.GetType()); }
public async Task UpdateBadRequestIdsNotMatch() { var sut = new GizmosController(_ctx); var actual = await sut.Update(1, new Gizmo { Id = 0 }); Assert.Equal(typeof(BadRequestResult), actual.GetType()); }
public async Task Update() { var sut = new GizmosController(_ctx); var gizmo = _ctx.Gizmos.Last(); gizmo.Name = "Bar"; var actual = await sut.Update(gizmo.Id, gizmo); Assert.Equal(typeof(NoContentResult), actual.GetType()); var result1 = _ctx.Gizmos.Single(x => x.Id == gizmo.Id); Assert.Equal("Bar", result1.Name); }