コード例 #1
0
        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);
        }
コード例 #2
0
        public void Get_WhenCalled_ReturnsOkResult()
        {
            // Act
            var okResult = _controller.Get();

            // Assert
            // Assert.IsType<OkObjectResult>(okResult.Result);
        }
コード例 #3
0
        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);
        }