Пример #1
0
        public void Contains_Ok_Status_Code_When_Use_Case_Succeeds()
        {
            // arrange
            var presenter = new DeleteUserByIdPresenter();

            // act
            presenter.Handle(new DeleteUserByIdResponse("Success result message", true));

            // assert
            Assert.Equal((int)HttpStatusCode.OK, presenter.ContentResult.StatusCode);
        }
Пример #2
0
        public void Contains_Errors_When_Use_Case_Fails()
        {
            // arrange
            var presenter = new DeleteUserByIdPresenter();

            // act
            presenter.Handle(new DeleteUserByIdResponse(new Core.Dto.Error[] { new Core.Dto.Error("ERR404", "Error Description") }, true));

            // assert
            dynamic data = JsonConvert.DeserializeObject(presenter.ContentResult.Content);

            Assert.False(data.success.Value);
            Assert.Equal("Missing first name", data.errors.First.Value);
        }
Пример #3
0
        public void Contains_Id_When_Use_Case_Succeeds()
        {
            // arrange
            var presenter = new DeleteUserByIdPresenter();

            // act
            presenter.Handle(new DeleteUserByIdResponse("Success result message", true));

            // assert
            dynamic data = JsonConvert.DeserializeObject(presenter.ContentResult.Content);

            Assert.True(data.success.Value);
            Assert.Equal("2", data.id.Value);
        }