public void ExportHierarchy_ShouldReturnRoot_WhenSucceeds()
        {
            var DALwh = new DAL.Warehouse();

            _mock.Setup(x => x.GetWarehouseRoot()).Returns(DALwh);
            // Act
            var result = _controller.ExportHierarchy();

            // Assert
            Assert.IsInstanceOf <BL.Warehouse>(result);
        }
        public void StaffReportHop_ShouldReturnTrue_WhenSucceeds_Truck()
        {
            string trackingId = "PYJRB4HZ6";
            string code       = "BNDA04";

            DAL.Receipient customer = new DAL.Receipient()
            {
                Name       = "Johannes",
                Street     = "Street",
                PostalCode = "A-1230"
            };
            var hop = new DAL.HopArrival()
            {
                Code = "BNDA04"
            };

            DAL.Parcel DALp = new DAL.Parcel()
            {
                TrackingId = trackingId,
                Receipient = customer,
                Sender     = customer
            };

            DAL.Warehouse wh = new DAL.Warehouse()
            {
                Code        = "ABC233",
                Description = "Truck",
                HopType     = "Truck"
            };

            DALp.FutureHops.Add(hop);
            DALp.FutureHops.Add(hop);
            _mock.Setup(x => x.GetByTrackingID(trackingId)).Returns(DALp);
            _mockHOP.Setup(x => x.GetByCode(code)).Returns(wh);
            _mock.Setup(x => x.Update(It.IsAny <DAL.Parcel>()));
            //moq
            // Act
            var result = _controller.StaffReportHop(trackingId, code);

            // Assert
            Assert.IsTrue(result);
        }
Exemple #3
0
        public SenderLogicTest()
        {
            var config = new MapperConfiguration(cfg => cfg.AddProfile(new SKSLayerMapper()));

            _mapper     = new AutoMapper.Mapper(config);
            _mockParcel = new Mock <IParcelRepository>();
            _mockHop    = new Mock <IHopRepository>();
            _agent      = new Mock <IGeocoderAgent>();
            _controller = new SenderLogic(_mockParcel.Object, _mockHop.Object, _mapper, _agent.Object, new LoggerFactory().CreateLogger <SenderLogic>());

            customer = new Receipient()
            {
                Name       = "Johannes",
                Street     = "Street",
                PostalCode = "A-1230"
            };
            DALcustomer = new DAL.Receipient()
            {
                Name       = "Johannes",
                Street     = "Street",
                PostalCode = "A-1230"
            };
            parcel = new Parcel()
            {
                Weight     = 1,
                State      = Parcel.StateEnum.InTransportEnum,
                Receipient = customer,
                Sender     = customer,
                TrackingId = "ABCDEF123"
            };
            DALparcel = new DAL.Parcel()
            {
                Weight     = 1,
                State      = DAL.Parcel.StateEnum.InTransportEnum,
                Receipient = DALcustomer,
                Sender     = DALcustomer,
                TrackingId = "ABCDEF123"
            };
            DALtruck = new DAL.Truck()
            {
                Code        = "AUTA05",
                NumberPlate = "lul"
            };
            roothop = new DAL.Warehouse()
            {
                Code        = "AUTA05",
                Description = "DEBUG",
                HopType     = "Warehouse",
                NextHops    = new List <DAL.WarehouseNextHops>()
                {
                    new DAL.WarehouseNextHops()
                    {
                        HopACode = "AUTA05",
                        HopBCode = "BNDA04",
                        HopB     = new DAL.Warehouse()
                        {
                            Code = "BNDA04"
                        }
                    }
                }
            };
        }