コード例 #1
0
        public void Get_ResturnsNotFound()
        {
            long        customerID    = 1;
            string      email         = "*****@*****.**";
            InquiryView serviceResult = null;

            inquiryServiceMock.Setup(x => x.GetByCustomerID(1)).ReturnsAsync(serviceResult);

            InquiryController controller = new InquiryController(inquiryServiceMock.Object);
            var responce       = controller.Get(customerID, email).Result;
            var objectResponse = responce as NotFoundResult;

            Assert.IsInstanceOf <NotFoundResult>(responce);
        }
コード例 #2
0
        public void Get_ResturnsBadRequest()
        {
            long?       customerID    = null;
            string      email         = null;
            InquiryView serviceResult = null;

            inquiryServiceMock.Setup(x => x.GetByCustomerID(1)).ReturnsAsync(serviceResult);

            InquiryController controller = new InquiryController(inquiryServiceMock.Object);
            var responce       = controller.Get(customerID, email).Result;
            var objectResponse = responce as BadRequestObjectResult;

            Assert.IsInstanceOf <BadRequestObjectResult>(responce);
        }
コード例 #3
0
        public void Get_ResturnsInquiryView()
        {
            long        customerID    = 1;
            string      email         = "*****@*****.**";
            InquiryView serviceResult = new InquiryView {
                CustomerID = customerID
            };

            inquiryServiceMock.Setup(x => x.GetByCustomerID(1)).ReturnsAsync(serviceResult);

            InquiryController controller = new InquiryController(inquiryServiceMock.Object);
            var responce       = controller.Get(customerID, email).Result;
            var objectResponse = responce as OkObjectResult;

            Assert.IsInstanceOf <OkObjectResult>(responce);
            Assert.AreEqual(serviceResult, objectResponse.Value);
        }