public void GetSetsLocationHeader() { // Arrange ContactDetailsController controller = new ContactDetailsController(_contactService); controller.Request = new HttpRequestMessage { RequestUri = new Uri("https://*****:*****@gmail.com", PhoneNo = "9876543210", Status = false }; var response = controller.Get(); // Assert Assert.AreEqual("https://localhost:44336/api/ContactDetails", response.RequestMessage.RequestUri); }
public void Get_WhenCalled_ReturnsOkResult() { // Act var okResult = _controller.Get(); // Assert // Assert.IsType<OkObjectResult>(okResult.Result); }
public void GetReturnsProduct() { // Arrange var controller = new ContactDetailsController(_contactService); controller.Request = new HttpRequestMessage(); controller.Configuration = new HttpConfiguration(); // Act var response = controller.Get(3); // Assert ContactDetails contactDetails; Assert.IsTrue(response.TryGetContentValue <ContactDetails>(out contactDetails)); Assert.AreEqual(3, contactDetails.ID); }