Ejemplo n.º 1
0
        public void ImportWarehouse_IsOk()
        {
            Mock <IWarehouseRepository> mock = new Mock <IWarehouseRepository>();

            WarehouseNextHops nexthop1 = new WarehouseNextHops()
            {
                Hop = new Warehouse(), TraveltimeMins = 1
            };
            WarehouseNextHops nexthop2 = new WarehouseNextHops()
            {
                Hop = new Warehouse(), TraveltimeMins = 2
            };
            IEnumerable <WarehouseNextHops> nextHops = new List <WarehouseNextHops>()
            {
                nexthop1, nexthop2
            };
            Warehouse wh = new Warehouse()
            {
                Code = "123456789", Description = "a valid one", ProcessingDelayMins = 1, NextHops = nextHops
            };

            IWarehouseManagementLogic warehouseManagementLogic = new WarehouseManagementLogic(mapper, mock.Object, NullLogger <WarehouseManagementLogic> .Instance);

            warehouseManagementLogic.ImportWarehouse(wh);

            /// if it doesn't throw we good
        }
Ejemplo n.º 2
0
        public void ImportWarehouse_InvalidWarehouse(string code, string description)
        {
            Mock <IWarehouseRepository> mock = new Mock <IWarehouseRepository>();

            WarehouseNextHops nexthop1 = new WarehouseNextHops()
            {
                Hop = new Warehouse(), TraveltimeMins = 1
            };
            WarehouseNextHops nexthop2 = new WarehouseNextHops()
            {
                Hop = new Warehouse(), TraveltimeMins = 2
            };
            IEnumerable <WarehouseNextHops> nextHops = new List <WarehouseNextHops>()
            {
                nexthop1, nexthop2
            };
            Warehouse wh = new Warehouse()
            {
                Code = code, Description = description, ProcessingDelayMins = 1, NextHops = nextHops
            };

            IWarehouseManagementLogic warehouseManagementLogic = new WarehouseManagementLogic(mapper, mock.Object, NullLogger <WarehouseManagementLogic> .Instance);

            Assert.Throws <InvalidWarehouseException>(() => warehouseManagementLogic.ImportWarehouse(wh));
        }