Exemplo n.º 1
0
        public async void DeleteOneExperience_NotFound()
        {
            // arrange
            mockRepo.Setup(x => x.GetFirstByExpressionAsync(It.IsAny <Expression <Func <Experience, bool> > >())).ReturnsAsync(() => null);
            var id = Guid.NewGuid();

            // act
            var result = await controller.DeleteOneExperience(id);

            // assert
            var resultValue = Assert.IsAssignableFrom <NotFoundObjectResult>(result);
            var returnedObj = Assert.IsType <ErrorObject>(resultValue.Value);

            Assert.Equal("Could not find experience to delete", returnedObj.Error);
            Assert.Equal("DELETE", returnedObj.Method);
            Assert.Equal($"/api/experiences/{id}", returnedObj.At);
            Assert.Equal(404, returnedObj.StatusCode);
        }