コード例 #1
0
        public void TrackArrival_PackageDoesNotExist_ThrowsException()
        {
            var mockMapper = new Mock <AutoMapper.IMapper>();
            var mapper     = mockMapper.Object;
            var mockTrackingLogicLogger = new Mock <ILogger <TrackingLogic> >();
            ILogger <TrackingLogic> trackingLogicLogger = mockTrackingLogicLogger.Object;

            TrackingLogic trLogic = new TrackingLogic(mockParcelRepo, mockHopRepo, trackingLogicLogger, mapper);

            Assert.ThrowsException <BlException>(() => trLogic.TrackParcel("12"));
        }
コード例 #2
0
        public void TrackArrival_ValidInputArguments_ReturnsTrackingInformation()
        {
            var mockMapper = new Mock <AutoMapper.IMapper>();

            mockMapper.Setup(m => m.Map <Entities.Parcel>(It.IsAny <DataAccess.Entities.Parcel>())).Returns(validBLParcel);
            mockMapper.Setup(m => m.Map <IO.Swagger.Models.TrackingInformation>(It.IsAny <Entities.TrackingInformation>())).Returns(validSwagInfo);
            var mapper = mockMapper.Object;
            var mockTrackingLogicLogger = new Mock <ILogger <TrackingLogic> >();
            ILogger <TrackingLogic> trackingLogicLogger = mockTrackingLogicLogger.Object;

            TrackingLogic trLogic = new TrackingLogic(mockParcelRepo, mockHopRepo, trackingLogicLogger, mapper);

            IO.Swagger.Models.TrackingInformation swagTrInfo = trLogic.TrackParcel("TN000001");

            Assert.IsNotNull(swagTrInfo);
        }