Пример #1
0
        public void CreateTimeStamp_FromInitial_CreatesATimestampAMinuteInFuture()
        {
            const int expectedDay          = 0;
            const int expectedTime         = 1;
            const int expectedOriginalTime = 0;

            DayTime next = _dayTime.CreateTimestamp(1);

            Assert.AreEqual(_dayTime.Day, expectedDay);
            Assert.AreEqual(_dayTime.Time, expectedOriginalTime);
            Assert.AreEqual(next.Day, expectedDay);
            Assert.AreEqual(next.Time, expectedTime);
        }
        public void ReceiveProduct_CompletesOrder()
        {
            DayTime       completedDate     = _dayTime.CreateTimestamp(20);
            List <string> expected_complete = new List <string>()
            {
                test_type + " ; " + ConvertTime(_dayTime) + " ; " + ConvertTime(completedDate)
            };

            _subject.CreateOrder(test_type, _dayTime);
            _subject.ReceiveProduct(test_type, completedDate);

            CollectionAssert.IsEmpty(_subject.ActiveOrders);
            CollectionAssert.AreEquivalent(expected_complete, _subject.CompleteOrders);
        }
        public void Transport_AtFirstStop_UpdatesLocationAndReceivesCargo()
        {
            Dictionary <int, string> expected = new Dictionary <int, string>();

            expected.Add(_wo1.Id, PLANT2_NAME);

            DayTime newTime = _first.CreateTimestamp(10);

            _subject.Work(newTime);

            Assert.AreEqual(PLANT1_NAME, _subject.CurrentLocation);
            Assert.IsNotEmpty(_subject.Inventory());
            CollectionAssert.AreEquivalent(_subject.Inventory(), expected);
        }
        public void ReceiveProduct_ShouldKeepCompletedOrderDate()
        {
            DayTime day2 = _dayTime.CreateTimestamp(1440);
            DayTime day3 = day2.CreateTimestamp(1440);
            DayTime day4 = day3.CreateTimestamp(1440);

            List <string> expected = new List <string>();

            _subject.CreateOrder(test_type, _dayTime);
            _subject.CreateOrder(test_type, day2);
            _subject.CreateOrder(test_type, day3);
            _subject.CreateOrder(test_type, day4);

            CollectionAssert.AreEquivalent(expected, _subject.CompleteOrders);

            _subject.ReceiveProduct(test_type, _dayTime);

            expected.Add(test_type + " ; 0 ; 0");
            CollectionAssert.AreEquivalent(expected, _subject.CompleteOrders);

            _subject.ReceiveProduct(test_type, day2);

            expected.Add(test_type + " ; 1 ; 1");
            CollectionAssert.AreEquivalent(expected, _subject.CompleteOrders);

            _subject.ReceiveProduct(test_type, day2);

            expected.Add(test_type + " ; 2 ; 1");
            CollectionAssert.AreEquivalent(expected, _subject.CompleteOrders);

            _subject.ReceiveProduct(test_type, day4);

            expected.Add(test_type + " ; 3 ; 3");
            CollectionAssert.AreEquivalent(expected, _subject.CompleteOrders);
        }
Пример #5
0
 private DayTime NextDumpTime(DayTime currentDumpTime)
 {
     //TODO Update MES Dump Time to be based on a configuration.
     return(_schedule switch
     {
         _ => currentDumpTime.CreateTimestamp(24 * 60)
     });
Пример #6
0
// private pure
        private DayTime NextDumpTime(DayTime currentDumpTime)
        {
            //TODO Create configuration for ERP to update MES's
            return(_schedule switch
            {
                _ => currentDumpTime.CreateTimestamp(24 * 60)
            });
        protected void SetUp()
        {
            _plant1 = Substitute.For <IPlant>();
            _plant1.Name.Returns(PLANT1_NAME);

            _wo1 = Substitute.For <IWork>();
            _plant1.ShipToOtherPlants().Returns(new Dictionary <IWork, string>()
            {
                { _wo1, PLANT2_NAME }
            });

            _plant2 = Substitute.For <IPlant>();
            _plant2.Name.Returns(PLANT2_NAME);

            _wo2 = Substitute.For <IWork>();
            _plant2.ShipToOtherPlants().Returns(new Dictionary <IWork, string>()
            {
                { _wo2, PLANT1_NAME }
            });

            var dock = Substitute.For <IReceive>();

            dock.Name.Returns("Shipping Dock");
            _plant1.Dock().Returns(dock);
            _plant2.Dock().Returns(dock);

            _enterprise = Substitute.For <IEnterprise>();
            _enterprise.Plants.Returns(new List <IPlant>()
            {
                _plant1, _plant2
            });

            _first  = new DayTime();
            _routes = new Dictionary <DayTime, string>()
            {
                { _first.CreateTimestamp(10), PLANT1_NAME },
                { _first.CreateTimestamp(20), PLANT2_NAME },
                { _first.CreateTimestamp(30), PLANT1_NAME },
                { _first.CreateTimestamp(40), PLANT2_NAME }
            };

            _subject = new Transport(_enterprise, _routes);
        }