Example #1
0
        public void TrackParcel_ParcelNotFound()
        {
            string id = "123456789";

            Mock <IParcelRepository> mock = new Mock <IParcelRepository>();

            DA.Parcel wh = new DA.Parcel()
            {
                TrackingId = id, State = DA.Parcel.StateEnum.DeliveredEnum
            };

            mock.Setup(foo => foo.GetByTrackingId(id)).Throws(new ParcelNotFoundExpection());

            IRecipientLogic receipientLogic = new RecipientLogic(mapper, mock.Object, NullLogger <RecipientLogic> .Instance);

            Assert.Throws <BusinessLayerException>(() => receipientLogic.TrackParcel(id));
        }
Example #2
0
        public void TrackParcel_ReturnParcel()
        {
            string id = "123456789";

            Mock <IParcelRepository> mock = new Mock <IParcelRepository>();

            DA.Parcel wh = new DA.Parcel()
            {
                TrackingId = id, State = DA.Parcel.StateEnum.DeliveredEnum
            };
            mock.Setup(foo => foo.GetByTrackingId(id)).Returns(wh);

            IRecipientLogic receipientLogic = new RecipientLogic(mapper, mock.Object, NullLogger <RecipientLogic> .Instance);

            Parcel p = receipientLogic.TrackParcel(id);

            Assert.NotNull(p);
            Assert.Equal(p.TrackingId, id);
            Assert.Equal(Parcel.StateEnum.DeliveredEnum, p.State);
        }