示例#1
0
        public void TestDeleteNotExistentClaim()
        {
            string        newClaimNumber = TestDataGenerator.GenerateUniqueClaimNumber();
            MitchellClaim testClaim      = TestDataGenerator.GetTestClaim(newClaimNumber);

            HttpResponseMessage response = ClaimsController.Post(testClaim);

            Assert.AreEqual(HttpStatusCode.Created, response.StatusCode, "A POST of a new claim should succeed.");

            MitchellClaim retrievedClaim = ClaimsController.Get(newClaimNumber);

            Assert.AreEqual(testClaim, retrievedClaim, "The posted and retrieved claim should have the same values.");

            response = ClaimsController.Delete(newClaimNumber);
            Assert.AreEqual(HttpStatusCode.OK, response.StatusCode, "Deleting an existing claim should succeed.");

            try
            {
                response = ClaimsController.Delete(newClaimNumber);
                Assert.Fail("An attempt to delete a claim that does not exist should result in an error.");
            }
            catch (HttpResponseException ex) when(ex.Response.StatusCode == HttpStatusCode.NotFound)
            {
                // This is the expected behavior
            }
        }
示例#2
0
        public void ClaimsController_DeleteById()
        {
            ClaimsController _controller = new ClaimsController(_mockService.Object, _logger.Object);
            var result = _controller.Delete(1);

            Assert.IsNotNull(result);
        }
        public async Task Delete_UnexistedClaimdIdPassed_ProperMethodsCalledAndReturNotFoundResult()
        {
            _mediatorMock.Setup(mediator => mediator.Send(It.IsAny <DeleteClaimCommand>(), It.IsAny <CancellationToken>())).ReturnsAsync(false).Verifiable();
            //Act
            var controller = new ClaimsController(_mediatorMock.Object);
            var result     = await controller.Delete(1);

            //Assert
            Assert.IsAssignableFrom <NotFoundResult>(result);
            _mediatorMock.Verify();
        }
示例#4
0
        public void ClaimsController_DeleteFromBody()
        {
            Claim application = new Claim()
            {
                ClaimCode   = "VIEW_ONLY",
                ClaimId     = 1,
                Description = "View Only",
                Title       = "View Only Claim"
            };
            ClaimsController _controller = new ClaimsController(_mockService.Object, _logger.Object);
            var result = _controller.Delete(application);

            Assert.IsNotNull(result);
        }
示例#5
0
        //[TestMethod]
        async public Task DeleteClaim()
        {
            var result = await controller.Delete("22c9c23bac142856018ce14a26b6c2991");

            Assert.AreEqual("Success", result);
        }