Пример #1
0
        public void TestRemoveConfigurationBad()
        {
            AdcpConfiguration config = new AdcpConfiguration();
            SerialNumber serial = new SerialNumber("01230000000000000000000000000004");
            Dictionary<string, AdcpSubsystemConfig> result = config.SetCepo("233", serial);

            Subsystem ss2 = new Subsystem("2", 0);                                   // Subsystem code and Index within serial number
            Subsystem ss3 = new Subsystem("3", 1);                                   // Subsystem code and Index within serial number
            SubsystemConfiguration ssConfig20 = new SubsystemConfiguration(ss2, 0, 0);         // Configuration SS2 with Config Number 0
            //SubsystemConfiguration ssConfig21 = new SubsystemConfiguration(ss2, 1, 1);         // Configuration SS2 with Config Number 1
            //SubsystemConfiguration ssConfig22 = new SubsystemConfiguration(ss2, 2, 2);         // Configuration SS2 with Config Number 2
            SubsystemConfiguration ssConfig30 = new SubsystemConfiguration(ss3, 1, 1);         // Configuration SS3 with Config Number 0
            SubsystemConfiguration ssConfig31 = new SubsystemConfiguration(ss3, 2, 2);         // Configuration SS3 with Config Number 1
            SubsystemConfiguration ssConfig32 = new SubsystemConfiguration(ss3, 3, 3);         // Configuration SS3 with Config Number 2

            AdcpSubsystemConfig asConfig3_2 = config.GetAdcpSubsystemConfig(ssConfig32);        // Get the Subsystem 3 Configuration 0

            bool resultRemove = config.RemoveAdcpSubsystemConfig(asConfig3_2);

            Assert.IsNull(asConfig3_2, "Config 3_2 is incorrect.");
            Assert.AreEqual(false, resultRemove, "ResultRemove is incorrect.");
            Assert.AreEqual("233", config.Commands.CEPO, "Commands CEPO is incorrect.");
        }
Пример #2
0
        public void TestRemoveConfiguration()
        {
            AdcpConfiguration config = new AdcpConfiguration();
            SerialNumber serial = new SerialNumber("01230000000000000000000000000004");
            Dictionary<string, AdcpSubsystemConfig> result = config.SetCepo("233232", serial);

            Subsystem ss2 = new Subsystem("2", 0);                                   // Subsystem code and Index within serial number
            Subsystem ss3 = new Subsystem("3", 1);                                   // Subsystem code and Index within serial number
            SubsystemConfiguration ssConfig20 = new SubsystemConfiguration(ss2, 0, 0);         // Configuration SS2 with Config Number 0
            SubsystemConfiguration ssConfig21 = new SubsystemConfiguration(ss2, 3, 3);         // Configuration SS2 with Config Number 1
            SubsystemConfiguration ssConfig22 = new SubsystemConfiguration(ss2, 5, 5);         // Configuration SS2 with Config Number 2
            SubsystemConfiguration ssConfig30 = new SubsystemConfiguration(ss3, 1, 1);         // Configuration SS3 with Config Number 0
            SubsystemConfiguration ssConfig31 = new SubsystemConfiguration(ss3, 2, 2);         // Configuration SS3 with Config Number 1
            SubsystemConfiguration ssConfig32 = new SubsystemConfiguration(ss3, 4, 4);         // Configuration SS3 with Config Number 2

            AdcpSubsystemConfig asConfig3_0 = config.GetAdcpSubsystemConfig(ssConfig30);        // Get the Subsystem 3 Configuration 0
            AdcpSubsystemConfig asConfig3_2 = config.GetAdcpSubsystemConfig(ssConfig32);        // Get the Subsystem 3 Configuration 2

            // Verify 3 configuration exist for Subsystem 3 and Subsystem 2
            Assert.AreEqual(true, config.AdcpSubsystemConfigExist(ssConfig20), "Config Exist 2_0 True is incorrect.");
            Assert.AreEqual(true, config.AdcpSubsystemConfigExist(ssConfig21), "Config Exist 2_1 True is incorrect.");
            Assert.AreEqual(true, config.AdcpSubsystemConfigExist(ssConfig22), "Config Exist 2_2 True is incorrect.");
            Assert.AreEqual(true, config.AdcpSubsystemConfigExist(ssConfig30), "Config Exist 3_0 True is incorrect.");
            Assert.AreEqual(true, config.AdcpSubsystemConfigExist(ssConfig31), "Config Exist 3_1 True is incorrect.");
            Assert.AreEqual(true, config.AdcpSubsystemConfigExist(ssConfig32), "Config Exist 3_2 True is incorrect.");
            Assert.AreEqual(6, config.SubsystemConfigDict.Count, "SubsystemConfigDict pre count is incorrect.");
            Assert.AreEqual(0, config.GetAdcpSubsystemConfig(ssConfig20).SubsystemConfig.CepoIndex, "CEPO index 2_0 pre is incorrect.");
            Assert.AreEqual(0, config.GetAdcpSubsystemConfig(ssConfig20).Commands.SubsystemConfig.CepoIndex, "Commands CEPO index 2_0 pre is incorrect.");
            Assert.AreEqual(1, config.GetAdcpSubsystemConfig(ssConfig30).SubsystemConfig.CepoIndex, "CEPO index 3_0 pre is incorrect.");
            Assert.AreEqual(1, config.GetAdcpSubsystemConfig(ssConfig30).Commands.SubsystemConfig.CepoIndex, "Commands CEPO index 3_0 pre is incorrect.");
            Assert.AreEqual(2, config.GetAdcpSubsystemConfig(ssConfig31).SubsystemConfig.CepoIndex, "CEPO index 3_1 pre is incorrect.");
            Assert.AreEqual(2, config.GetAdcpSubsystemConfig(ssConfig31).Commands.SubsystemConfig.CepoIndex, "Commands CEPO index 3_1 pre is incorrect.");
            Assert.AreEqual(3, config.GetAdcpSubsystemConfig(ssConfig21).SubsystemConfig.CepoIndex, "CEPO index 2_1 pre is incorrect.");
            Assert.AreEqual(3, config.GetAdcpSubsystemConfig(ssConfig21).Commands.SubsystemConfig.CepoIndex, "Commands CEPO index 2_1 pre is incorrect.");
            Assert.AreEqual(4, config.GetAdcpSubsystemConfig(ssConfig32).SubsystemConfig.CepoIndex, "CEPO index 3_2 pre is incorrect.");
            Assert.AreEqual(4, config.GetAdcpSubsystemConfig(ssConfig32).Commands.SubsystemConfig.CepoIndex, "Commands CEPO index 3_2 pre is incorrect.");
            Assert.AreEqual(5, config.GetAdcpSubsystemConfig(ssConfig22).SubsystemConfig.CepoIndex, "CEPO index 2_2 pre is incorrect.");
            Assert.AreEqual(5, config.GetAdcpSubsystemConfig(ssConfig22).Commands.SubsystemConfig.CepoIndex, "Commands CEPO index 2_2 pre is incorrect.");

            bool resultRemove = config.RemoveAdcpSubsystemConfig(asConfig3_0);                                                      // Remove the first Subsystem 3 Configuration

            Assert.AreEqual(true, resultRemove, "ResultRemove is incorrect.");
            Assert.AreEqual("23232", config.Commands.CEPO, "Commands CEPO is incorrect.");
            //Assert.AreEqual(true, config.AdcpSubsystemConfigExist(ssConfig20), "Config Exist 2_0 True 1 is incorrect.");
            //Assert.AreEqual(true, config.AdcpSubsystemConfigExist(ssConfig21), "Config Exist 2_1 True 1 is incorrect.");
            //Assert.AreEqual(true, config.AdcpSubsystemConfigExist(ssConfig22), "Config Exist 2_2 True 1 is incorrect.");
            //Assert.AreEqual(true, config.AdcpSubsystemConfigExist(ssConfig30), "Config Exist 3_0 True 1 is incorrect.");
            //Assert.AreEqual(true, config.AdcpSubsystemConfigExist(ssConfig31), "Config Exist 3_1 True 1 is incorrect.");
            //Assert.AreEqual(false, config.AdcpSubsystemConfigExist(ssConfig32), "Config Exist 3_2 False 1 is incorrect.");
            //Assert.AreEqual(5, config.SubsystemConfigDict.Count, "SubsystemConfigDict post count is incorrect.");
            //Assert.AreEqual(0, config.GetAdcpSubsystemConfig(ssConfig20).SubsystemConfig.CepoIndex, "CEPO index 2_0 is incorrect.");
            //Assert.AreEqual(0, config.GetAdcpSubsystemConfig(ssConfig20).Commands.SubsystemConfig.CepoIndex, "Commands CEPO index 2_0 pre is incorrect.");
            //Assert.AreEqual(1, config.GetAdcpSubsystemConfig(ssConfig30).SubsystemConfig.CepoIndex, "CEPO index 3_0 is incorrect.");
            //Assert.AreEqual(1, config.GetAdcpSubsystemConfig(ssConfig30).Commands.SubsystemConfig.CepoIndex, "Commands CEPO index 3_0 pre is incorrect.");
            //Assert.AreEqual(2, config.GetAdcpSubsystemConfig(ssConfig21).SubsystemConfig.CepoIndex, "CEPO index 2_1 is incorrect.");
            //Assert.AreEqual(2, config.GetAdcpSubsystemConfig(ssConfig21).Commands.SubsystemConfig.CepoIndex, "Commands CEPO index 2_1 pre is incorrect.");
            //Assert.AreEqual(3, config.GetAdcpSubsystemConfig(ssConfig31).SubsystemConfig.CepoIndex, "CEPO index 3_1 is incorrect.");
            //Assert.AreEqual(3, config.GetAdcpSubsystemConfig(ssConfig31).Commands.SubsystemConfig.CepoIndex, "Commands CEPO index 3_1 pre is incorrect.");
            //Assert.AreEqual(4, config.GetAdcpSubsystemConfig(ssConfig22).SubsystemConfig.CepoIndex, "CEPO index 2_2 is incorrect.");
            //Assert.AreEqual(4, config.GetAdcpSubsystemConfig(ssConfig22).Commands.SubsystemConfig.CepoIndex, "Commands CEPO index 2_2 pre is incorrect.");
        }