public void Post_Returns_Valid_Response()
        {
            //Arrange
            _mockContactRepository.Setup(c => c.AddContact(It.IsAny <Contact>())).Returns(true);

            //Act
            var response = _contactsController.Post(Requests.ContactRequest());

            //Assert
            BaseResponse <bool> contactAddedResponse;

            Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
            Assert.IsTrue(response.TryGetContentValue <BaseResponse <bool> >(out contactAddedResponse));
            Assert.IsFalse(contactAddedResponse.IsError);
            Assert.IsTrue(contactAddedResponse.Data);
        }
        public void Post_Returns_Exception()
        {
            //Arrange
            _mockContactRepository.Setup(c => c.AddContact(It.IsAny <Contact>())).Throws(new Exception());

            //Act
            var response = _contactsController.Post(Requests.ContactRequest());

            //Assert
            BaseResponse <BasicError> contactAddedResponse;

            Assert.AreEqual(response.StatusCode, HttpStatusCode.InternalServerError);
            Assert.IsTrue(response.TryGetContentValue <BaseResponse <BasicError> >(out contactAddedResponse));
            Assert.IsTrue(contactAddedResponse.IsError);
            Assert.AreEqual(contactAddedResponse.Errors.ErrorCode, ErrorCodes.TechnicalError.ToString());
        }
        public void Put_Returns_Failure_Response()
        {
            //Arrange
            _mockContactRepository.Setup(c => c.UpdateContact(It.IsAny <Contact>())).Returns(false);

            //Act
            var response = _contactsController.Put(Requests.ContactRequest());

            //Assert
            BaseResponse <BasicError> contactUpdatedResponse;

            Assert.AreEqual(response.StatusCode, HttpStatusCode.NotFound);
            Assert.IsTrue(response.TryGetContentValue <BaseResponse <BasicError> >(out contactUpdatedResponse));
            Assert.IsTrue(contactUpdatedResponse.IsError);
            Assert.AreEqual(contactUpdatedResponse.Errors.ErrorCode, ErrorCodes.DataNotFoundError.ToString());
        }