コード例 #1
0
 private void BtnDeliverySettings_Click(object sender, EventArgs e)
 {
     if (deliverySettings == null)
     {
         deliverySettings = new DeliverySettings();
         Contain(deliverySettings);
     }
     else
     {
         Contain(deliverySettings);
     }
 }
コード例 #2
0
        public void ShouldNotDeliverMoreThanTenBlocks()
        {
            uint droneId      = 1;
            var  droneService = new DroneService(DeliverySettings.Create(blocksToDeliver: 10));
            var  commandList  = new List <string> {
                "AAAAAAAAAAA", "AAAIAAA", "IAAAIAAA"
            };
            var expectedList = new List <string> {
                DroneService.OUTFILE_HEADER, "(0, 0) Ahead North", "(-3, 3) Ahead West", "(0, 0) Ahead East"
            };

            DeliverOrdersAndAssert(droneService, droneId, commandList, expectedList);
        }
コード例 #3
0
        public void ShouldNotDeliverMoreThanThreeOrders()
        {
            uint droneId      = 1;
            var  droneService = new DroneService(DeliverySettings.Create());
            var  commandList  = new List <string> {
                "AAAAIAA", "DDDAIAD", "AAIADAD", "IGNORED"
            };
            var expectedList = new List <string> {
                DroneService.OUTFILE_HEADER, "(-2, 4) Ahead West", "(-1, 3) Ahead South", "(0, 0) Ahead West"
            };

            DeliverOrdersAndAssert(droneService, droneId, commandList, expectedList);
        }
コード例 #4
0
        public void ShouldReturnDronePositionFromCommandList_AsUnderstood()
        {
            uint droneId      = 1;
            var  droneService = new DroneService(DeliverySettings.Create());
            var  commandList  = new List <string> {
                "AAAAIAA", "DDDAIAD", "AAIADAD"
            };
            var expectedList = new List <string> {
                DroneService.OUTFILE_HEADER, "(-2, 4) Ahead West", "(-1, 3) Ahead South", "(0, 0) Ahead West"
            };

            DeliverOrdersAndAssert(droneService, droneId, commandList, expectedList);
        }
コード例 #5
0
        public void ShouldNotProcessMoreThanOneDrone()
        {
            // Given
            var workingPath       = Path.Combine(".", "Infraestructure", "Services", "Resources");
            var expectedfilesInfo = Directory.GetFiles(workingPath, "expected-out*.txt").Select(fn => new FileInfo(fn));

            // When
            IDroneDeliveryService droneDeliveryService = new DroneDeliveryService(DeliverySettings.Create(droneCount: 1));

            droneDeliveryService.DeliverOrders(workingPath, workingPath);

            var outFiles = Directory.GetFiles(workingPath, "out*.txt").Select(fn => new FileInfo(fn));

            // Then
            Assert.NotNull(outFiles);
            Assert.Single(outFiles);
            outFiles.ToList().ForEach(AssertFileContentAndDeleteOutFile);
        }
コード例 #6
0
 void StaticClear()
 {
     CheckOutApp.itemApps.Clear();
     CheckOut.TotalPrice = 0;
     if (CheckOut.lblTotalPrice != null)
     {
         CheckOut.lblTotalPrice.Text = "0.00";
     }
     if (Item.btnCheckOut != null)
     {
         Item.btnCheckOut = null;
     }
     btnCheckOut.Text = "( " + CheckOutApp.TotalItems() + " )    Check Out";
     user             = null;
     menuAllItems     = null;
     personalInfo     = null;
     checkOut         = null;
     //CheckOut.clearCartDel.Invoke();
     deliverySettings = null;
 }