public void Contains_Ok_Status_Code_When_Use_Case_Succeeds() { // arrange var presenter = new UpdateUserByIdPresenter(); // act presenter.Handle(new UpdateUserByIdResponse(1, true)); // assert Assert.Equal((int)HttpStatusCode.OK, presenter.ContentResult.StatusCode); }
public void Contains_Errors_When_Use_Case_Fails() { // arrange var presenter = new UpdateUserByIdPresenter(); // act presenter.Handle(new UpdateUserByIdResponse(new[] { "UserId not exists" }, true)); // assert dynamic data = JsonConvert.DeserializeObject(presenter.ContentResult.Content); Assert.False(data.success.Value); Assert.Equal("missing first name", data.errors.First.Value); }
public void Contains_Id_When_Use_Case_Succeeds() { // arrange var presenter = new UpdateUserByIdPresenter(); // act presenter.Handle(new UpdateUserByIdResponse(1, true)); // assert dynamic data = JsonConvert.DeserializeObject(presenter.ContentResult.Content); Assert.True(data.success.Value); Assert.Equal("2", data.id.Value); }