Example #1
0
        public void DeleteMapping(MdmRequestInfo requestInfo)
        {
            var requester = new Mock <IMessageRequester>();
            var service   = new MdmEntityService <SourceSystem>("sourcesystem", requester.Object);

            requester.Setup(x => x.Delete <SourceSystem>("sourcesystem/77/mapping/33", requestInfo ?? It.IsAny <MdmRequestInfo>())).Returns(new WebResponse <SourceSystem>()
            {
                Code = HttpStatusCode.OK, IsValid = true
            });

            // Act
            var result = (requestInfo == null) ? service.DeleteMapping(77, 33) : service.DeleteMapping(77, 33, requestInfo);

            // Assert
            Assert.AreEqual(HttpStatusCode.OK, result.Code, "Status code differ");
            Assert.AreEqual(true, result.IsValid, "IsValid differ");
        }
Example #2
0
        public void DeleteMappingFails()
        {
            var requester = new Mock <IMessageRequester>();
            var service   = new MdmEntityService <SourceSystem>("sourcesystem", requester.Object);
            var fault     = new Fault()
            {
                Message = "faulting"
            };

            requester.Setup(x => x.Delete <SourceSystem>("sourcesystem/77/mapping/33", It.IsAny <MdmRequestInfo>())).Returns(new WebResponse <SourceSystem>()
            {
                Code = HttpStatusCode.InternalServerError, IsValid = false, Fault = fault
            });

            // Act
            var result = service.DeleteMapping(77, 33);

            // Assert
            Assert.AreEqual(HttpStatusCode.InternalServerError, result.Code, "Status code differ");
            Assert.AreEqual(false, result.IsValid, "IsValid differ");
            Assert.AreEqual(fault, result.Fault, "Fault not returned");
        }
        public void DeleteMappingFails()
        {
            var requester = new Mock<IMessageRequester>();
            var service = new MdmEntityService<SourceSystem>("sourcesystem", requester.Object);
            var fault = new Fault() { Message = "faulting" };

            requester.Setup(x => x.Delete<SourceSystem>("sourcesystem/77/mapping/33", It.IsAny<MdmRequestInfo>())).Returns(new WebResponse<SourceSystem>() { Code = HttpStatusCode.InternalServerError, IsValid = false, Fault = fault });

            // Act
            var result = service.DeleteMapping(77, 33);

            // Assert
            Assert.AreEqual(HttpStatusCode.InternalServerError, result.Code, "Status code differ");
            Assert.AreEqual(false, result.IsValid, "IsValid differ");
            Assert.AreEqual(fault, result.Fault, "Fault not returned");
        }
        public void DeleteMapping(MdmRequestInfo requestInfo)
        {
            var requester = new Mock<IMessageRequester>();
            var service = new MdmEntityService<SourceSystem>("sourcesystem", requester.Object);

            requester.Setup(x => x.Delete<SourceSystem>("sourcesystem/77/mapping/33",requestInfo?? It.IsAny<MdmRequestInfo>())).Returns(new WebResponse<SourceSystem>() { Code = HttpStatusCode.OK, IsValid = true });

            // Act
            var result = (requestInfo == null) ? service.DeleteMapping(77, 33) : service.DeleteMapping(77, 33,requestInfo);

            // Assert
            Assert.AreEqual(HttpStatusCode.OK, result.Code, "Status code differ");
            Assert.AreEqual(true, result.IsValid, "IsValid differ");
        }