Beispiel #1
0
        public void DragDropCopyTest()
        {
            TECManufacturer manufacturer = new TECManufacturer();
            var             copy         = manufacturer.DropData() as TECManufacturer;

            Assert.AreEqual(manufacturer, copy);
        }
        public void SaveNew_Templates_Equipment()
        {
            //Arrange
            TECSubScope     actualEquipSubScope = actualEquipment.SubScope.First(item => item.Devices.Count > 0 && item.Points.Count > 0);
            TECDevice       actualChildDevice   = actualEquipSubScope.Devices[0] as TECDevice;
            TECPoint        actualEquipPoint    = actualEquipSubScope.Points[0];
            TECManufacturer actualChildMan      = actualChildDevice.Manufacturer;

            TECSubScope     expectedEquipSubScope = expectedEquipment.SubScope.First(item => item.Guid == actualEquipSubScope.Guid);
            TECDevice       expectedChildDevice   = expectedEquipSubScope.Devices[0] as TECDevice;
            TECPoint        expectedEquipPoint    = expectedEquipSubScope.Points[0];
            TECManufacturer expectedChildMan      = expectedChildDevice.Manufacturer;

            //Assert
            Assert.AreEqual(expectedEquipment.Name, actualEquipment.Name);
            Assert.AreEqual(expectedEquipment.Description, actualEquipment.Description);
            Assert.AreEqual(expectedEquipment.Tags[0].Label, actualEquipment.Tags[0].Label);

            Assert.AreEqual(expectedEquipSubScope.Name, actualEquipSubScope.Name);
            Assert.AreEqual(expectedEquipSubScope.Description, actualEquipSubScope.Description);
            Assert.AreEqual(expectedEquipSubScope.Tags[0].Label, actualEquipSubScope.Tags[0].Label);

            Assert.AreEqual(expectedChildDevice.Name, actualChildDevice.Name);
            Assert.AreEqual(expectedChildDevice.Description, actualChildDevice.Description);
            Assert.AreEqual(expectedChildDevice.Cost, actualChildDevice.Cost, DELTA);

            Assert.AreEqual(expectedEquipPoint.Label, actualEquipPoint.Label);
            Assert.AreEqual(expectedEquipPoint.Quantity, actualEquipPoint.Quantity);
            Assert.AreEqual(expectedEquipPoint.Type, actualEquipPoint.Type);

            Assert.AreEqual(expectedChildMan.Label, actualChildMan.Label);
            Assert.AreEqual(expectedChildMan.Multiplier, actualChildMan.Multiplier, DELTA);
        }
        public void SaveNew_Templates_SubScope()
        {
            //Arrange
            IEndDevice      actualChildDevice = actualSubScope.Devices[0];
            TECPoint        actualSSPoint     = actualSubScope.Points[0];
            TECManufacturer actualChildMan    = (actualChildDevice as TECHardware).Manufacturer;

            IEndDevice      expectedChildDevice = expectedSubScope.Devices.First(x => x.Guid == actualChildDevice.Guid);
            TECPoint        expectedSSPoint     = expectedSubScope.Points.First(x => x.Guid == actualSSPoint.Guid);
            TECManufacturer expectedChildMan    = (expectedChildDevice as TECHardware).Manufacturer;

            //Assert
            Assert.AreEqual(expectedSubScope.Name, actualSubScope.Name);
            Assert.AreEqual(expectedSubScope.Description, actualSubScope.Description);
            Assert.AreEqual(expectedSubScope.Tags[0].Label, actualSubScope.Tags[0].Label);
            Assert.AreEqual(expectedSubScope.AssociatedCosts[0].Name, actualSubScope.AssociatedCosts[0].Name);

            Assert.AreEqual(expectedChildDevice.Name, actualChildDevice.Name);
            Assert.AreEqual(expectedChildDevice.Description, actualChildDevice.Description);
            Assert.AreEqual((expectedChildDevice as TECHardware).Cost, (actualChildDevice as TECHardware).Cost, DELTA);
            Assert.IsTrue(expectedChildDevice.HardwiredConnectionTypes.Any(x => x.Guid == actualChildDevice.HardwiredConnectionTypes[0].Guid));
            Assert.AreEqual((expectedChildDevice as TECHardware).Tags[0].Label, (actualChildDevice as TECHardware).Tags[0].Label);

            Assert.AreEqual(expectedSSPoint.Label, actualSSPoint.Label);
            Assert.AreEqual(expectedSSPoint.Quantity, actualSSPoint.Quantity);
            Assert.AreEqual(expectedSSPoint.Type, actualSSPoint.Type);

            Assert.AreEqual(expectedChildMan.Label, actualChildMan.Label);
            Assert.AreEqual(expectedChildMan.Multiplier, actualChildMan.Multiplier, DELTA);
        }
Beispiel #4
0
        public static TECManufacturer TestManufacturer(Random rand)
        {
            TECManufacturer man = new TECManufacturer();

            man.AssignTestLabel();
            man.Multiplier = (rand.NextDouble() * 100);
            return(man);
        }
Beispiel #5
0
        public static TECPanelType TestPanelType(TECCatalogs catalogs, Random rand)
        {
            TECManufacturer man  = catalogs.Manufacturers.RandomElement(rand);
            TECPanelType    type = new TECPanelType(man);

            type.Description = string.Format("Test Panel Type");
            type.AssignRandomCostProperties(catalogs, rand);
            return(type);
        }
Beispiel #6
0
        public void DeleteDeviceUserInputNo()
        {
            //Arrange
            TECTemplates      templatesManager = new TECTemplates();
            TECScopeTemplates templates        = templatesManager.Templates;

            TECManufacturer man = new TECManufacturer();

            templatesManager.Catalogs.Add(man);

            TECDevice dev = new TECDevice(new List <TECConnectionType>(), new List <TECProtocol>(), man);

            templatesManager.Catalogs.Add(dev);

            TECSystem sys = new TECSystem();

            templates.SystemTemplates.Add(sys);
            TECEquipment sysEquip = new TECEquipment();

            sys.Equipment.Add(sysEquip);
            TECSubScope sysSS = new TECSubScope();

            sysEquip.SubScope.Add(sysSS);
            sysSS.Devices.Add(dev);

            TECEquipment equip = new TECEquipment();

            templates.EquipmentTemplates.Add(equip);
            TECSubScope equipSS = new TECSubScope();

            equip.SubScope.Add(equipSS);
            equipSS.Devices.Add(dev);

            TECSubScope ss = new TECSubScope();

            templates.SubScopeTemplates.Add(ss);
            ss.Devices.Add(dev);

            //Act
            Mock <IUserConfirmable> mockMessageBox = new Mock <IUserConfirmable>();

            mockMessageBox
            .Setup(x => x.Show(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <MessageBoxButton>(), It.IsAny <MessageBoxImage>()))
            .Returns(MessageBoxResult.No);

            DeleteEndDeviceVM vm = new DeleteEndDeviceVM(dev, templatesManager);

            vm.messageBox = mockMessageBox.Object;
            vm.DeleteCommand.Execute(null);

            //Assert
            Assert.IsTrue(templatesManager.Catalogs.Devices.Contains(dev), "Device not removed from device templates properly.");
            Assert.IsTrue(sysSS.Devices.Contains(dev), "Device not removed from system template properly.");
            Assert.IsTrue(equipSS.Devices.Contains(dev), "Device not removed from equipment template properly.");
            Assert.IsTrue(ss.Devices.Contains(dev), "Device not removed from subscope template properly.");
        }
Beispiel #7
0
        public static TECValve TestValve(TECCatalogs catalogs, Random rand)
        {
            TECManufacturer man   = catalogs.Manufacturers.RandomElement(rand);
            TECDevice       dev   = catalogs.Devices.RandomElement(rand);
            TECValve        valve = new TECValve(man, dev);

            valve.Description = string.Format("Test Valve");
            valve.AssignRandomCostProperties(catalogs, rand);
            return(valve);
        }
Beispiel #8
0
        public static TECDevice TestDevice(TECCatalogs catalogs, Random rand)
        {
            List <TECConnectionType> types     = catalogs.ConnectionTypes.RandomElements(rand, false, 10);
            List <TECProtocol>       protocols = catalogs.Protocols.RandomElements(rand, true, 10);
            TECManufacturer          man       = catalogs.Manufacturers.RandomElement(rand);
            TECDevice dev = new TECDevice(types, protocols, man);

            dev.Description = string.Format("Test Device");
            dev.AssignRandomCostProperties(catalogs, rand);
            return(dev);
        }
Beispiel #9
0
        public void CatalogCopyTest()
        {
            Random          rand     = new Random(0);
            TECCatalogs     catalogs = ModelCreation.TestCatalogs(rand);
            TECManufacturer man      = ModelCreation.TestManufacturer(rand);
            var             copy     = man.CatalogCopy();

            Assert.AreNotEqual(man.Guid, copy.Guid);
            Assert.AreEqual(man.Label, copy.Label);
            Assert.AreEqual(man.Multiplier, copy.Multiplier);
        }
Beispiel #10
0
        private void addManufacturerExecute()
        {
            TECManufacturer newMan = new TECManufacturer();

            newMan.Label      = this.NewManName;
            newMan.Multiplier = this.NewManMultiplier;

            this.Templates.Catalogs.Add(newMan);

            this.NewManName       = "";
            this.NewManMultiplier = 0;
        }
Beispiel #11
0
        public static TECIOModule TestIOModule(TECCatalogs catalogs, Random rand)
        {
            TECManufacturer man = catalogs.Manufacturers.RandomElement(rand);
            TECIOModule     mod = new TECIOModule(man);

            mod.Description = string.Format("Test Module");
            mod.IO.Add(TestIO(rand, IOType.AI));
            mod.IO.Add(TestIO(rand, IOType.AO));
            mod.IO.Add(TestIO(rand, IOType.DI));
            mod.IO.Add(TestIO(rand, IOType.DO));
            mod.AssignRandomCostProperties(catalogs, rand);
            return(mod);
        }
        public void MyTestInitialize()
        {
            bid                     = new TECBid();
            manufacturer            = new TECManufacturer();
            manufacturer.Multiplier = 1;
            ChangeWatcher watcher = new ChangeWatcher(bid);

            costs = new CostBatch();
            watcher.CostChanged += (e) =>
            {
                costs += e;
            };
        }
        public void SaveNew_Templates_System()
        {
            //Arrange
            TECEquipment    expectedSysEquipment = expectedSystem.Equipment.First();
            TECSubScope     expectedSysSubScope  = expectedSysEquipment.SubScope.First();
            TECDevice       expectedChildDevice  = expectedSysSubScope.Devices[0] as TECDevice;
            TECPoint        expectedSysPoint     = expectedSysSubScope.Points.First();
            TECManufacturer expectedChildMan     = expectedChildDevice.Manufacturer;

            TECEquipment    actualSysEquipment = actualSystem.Equipment.First(item => item.Guid == expectedSysEquipment.Guid);
            TECSubScope     actualSysSubScope  = actualSysEquipment.SubScope.First(item => item.Guid == expectedSysSubScope.Guid);
            TECDevice       actualChildDevice  = actualSysSubScope.Devices[0] as TECDevice;
            TECPoint        actualSysPoint     = actualSysSubScope.Points.First(item => item.Guid == expectedSysPoint.Guid);
            TECManufacturer actualChildMan     = actualChildDevice.Manufacturer;

            //Assert
            Assert.AreEqual(expectedSystem.Name, actualSystem.Name);
            Assert.AreEqual(expectedSystem.Description, actualSystem.Description);
            Assert.AreEqual(expectedSystem.Tags[0].Label, actualSystem.Tags[0].Label);

            Assert.AreEqual(expectedSysEquipment.Name, actualSysEquipment.Name);
            Assert.AreEqual(expectedSysEquipment.Description, actualSysEquipment.Description);
            Assert.AreEqual(expectedSysEquipment.Tags[0].Label, actualSysEquipment.Tags[0].Label);

            Assert.AreEqual(expectedSysSubScope.Name, actualSysSubScope.Name);
            Assert.AreEqual(expectedSysSubScope.Description, actualSysSubScope.Description);
            Assert.AreEqual(expectedSysSubScope.Tags[0].Label, actualSysSubScope.Tags[0].Label);

            Assert.AreEqual(expectedChildDevice.Name, actualChildDevice.Name);
            Assert.AreEqual(expectedChildDevice.Description, actualChildDevice.Description);
            Assert.AreEqual(expectedChildDevice.Cost, actualChildDevice.Cost, DELTA);
            Assert.AreEqual(expectedChildDevice.HardwiredConnectionTypes[0].Guid, actualChildDevice.HardwiredConnectionTypes[0].Guid);
            Assert.AreEqual(expectedChildDevice.Tags[0].Label, actualChildDevice.Tags[0].Label);

            Assert.AreEqual(expectedSysPoint.Label, actualSysPoint.Label);
            Assert.AreEqual(expectedSysPoint.Quantity, actualSysPoint.Quantity);
            Assert.AreEqual(expectedSysPoint.Type, actualSysPoint.Type);

            Assert.AreEqual(expectedChildMan.Label, actualChildMan.Label);
            Assert.AreEqual(expectedChildMan.Multiplier, actualChildMan.Multiplier, DELTA);

            ////Controlled scope tests]
            //TECSystem expectedConScope = expectedSystem;
            //TECSystem actualConScope = actualSystem;
            //Assert.AreEqual(expectedConScope.Name, actualConScope.Name);
            //Assert.AreEqual(expectedConScope.Description, actualConScope.Description);
            //Assert.AreEqual(expectedConScope.Equipment[0].Name, actualConScope.Equipment[0].Name);
            //Assert.AreEqual(expectedConScope.Panels[0].Name, actualConScope.Panels[0].Name);
            //Assert.AreEqual(expectedConScope.Controllers[0].Name, actualConScope.Controllers[0].Name);
            //Assert.AreEqual(42, actualConScope.Controllers[0].ChildrenConnections[0].Length);
        }
Beispiel #14
0
        public static TECControllerType TestControllerType(TECCatalogs catalogs, Random rand)
        {
            TECManufacturer   man  = catalogs.Manufacturers.RandomElement(rand);
            TECControllerType type = new TECControllerType(man);

            type.Description = string.Format("Test Controller Type");
            type.IO.Add(TestIO(rand, IOType.AI));
            type.IO.Add(TestIO(rand, IOType.AO));
            type.IO.Add(TestIO(rand, IOType.DI));
            type.IO.Add(TestIO(rand, IOType.DO));
            type.IO.Add(TestIO(rand, catalogs.Protocols.RandomElement(rand)));
            type.AssignRandomCostProperties(catalogs, rand);
            return(type);
        }
        public static void ClassInitialize(TestContext TestContext)
        {
            rand = new Random(0);
            //Arrange
            expectedTemplates = ModelCreation.TestTemplates(rand);
            ModelCreation.AddSyncronizerItems(expectedTemplates);
            expectedSystem         = expectedTemplates.Templates.SystemTemplates.First();
            expectedEquipment      = expectedTemplates.Templates.EquipmentTemplates.First();
            expectedSubScope       = expectedTemplates.Templates.SubScopeTemplates.First();
            expectedDevice         = expectedTemplates.Catalogs.Devices.First();
            expectedManufacturer   = expectedTemplates.Catalogs.Manufacturers.First();
            expectedTag            = expectedTemplates.Catalogs.Tags[0];
            expectedController     = (TECProvidedController)expectedTemplates.Templates.ControllerTemplates.First(sys => sys is TECProvidedController);
            expectedAssociatedCost = expectedTemplates.Catalogs.AssociatedCosts[0];
            expectedConnectionType = expectedTemplates.Catalogs.ConnectionTypes[0];
            expectedConduitType    = expectedTemplates.Catalogs.ConduitTypes[0];

            path = Path.GetTempFileName();

            //Act
            DatabaseManager <TECTemplates> manager = new DatabaseManager <TECTemplates>(path);
            bool success = manager.New(expectedTemplates);

            Assert.IsTrue(success, "New method in DatabaseManager returned false.");
            actualTemplates = manager.Load();

            if (actualTemplates.Templates.SystemTemplates.Count == 0)
            {
                string failDirectory = Path.GetTempPath() + "Estimating Tools\\";
                Directory.CreateDirectory(failDirectory);
                string failPath = failDirectory + "SaveNewTemplatesTestFailed.tdb";
                if (File.Exists(failPath))
                {
                    File.Delete(failPath);
                }
                File.Copy(path, failPath);
                Assert.Fail(string.Format("No systems loaded into templates. File saved at: {0}", failPath));
            }

            actualSystem         = actualTemplates.Templates.SystemTemplates.First(x => x.Guid == expectedSystem.Guid);
            actualEquipment      = actualTemplates.Templates.EquipmentTemplates.First(x => x.Guid == expectedEquipment.Guid);
            actualSubScope       = actualTemplates.Templates.SubScopeTemplates.First(x => x.Guid == expectedSubScope.Guid);
            actualDevice         = actualTemplates.Catalogs.Devices.First(x => x.Guid == expectedDevice.Guid);
            actualManufacturer   = actualTemplates.Catalogs.Manufacturers.First(x => x.Guid == expectedManufacturer.Guid);
            actualTag            = actualTemplates.Catalogs.Tags.First(x => x.Guid == expectedTag.Guid);
            actualController     = actualTemplates.Templates.ControllerTemplates.First(x => x.Guid == expectedController.Guid) as TECProvidedController;
            actualAssociatedCost = actualTemplates.Catalogs.AssociatedCosts.First(x => x.Guid == expectedAssociatedCost.Guid);
            actualConnectionType = actualTemplates.Catalogs.ConnectionTypes.First(x => x.Guid == expectedConnectionType.Guid);
            actualConduitType    = actualTemplates.Catalogs.ConduitTypes.First(x => x.Guid == expectedConduitType.Guid);
        }
        public void SaveNew_Templates_Device()
        {
            //Arrange
            TECManufacturer actualChildMan   = actualDevice.Manufacturer;
            TECManufacturer expectedChildMan = expectedDevice.Manufacturer;

            //Assert
            Assert.AreEqual(expectedDevice.Name, actualDevice.Name);
            Assert.AreEqual(expectedDevice.Description, actualDevice.Description);
            Assert.AreEqual(expectedDevice.Cost, actualDevice.Cost, DELTA);
            Assert.AreEqual(expectedDevice.HardwiredConnectionTypes[0].Guid, actualDevice.HardwiredConnectionTypes[0].Guid);
            Assert.AreEqual(expectedDevice.Tags[0].Label, actualDevice.Tags[0].Label);
            Assert.AreEqual(expectedDevice.Manufacturer.Guid, actualDevice.Manufacturer.Guid);

            Assert.AreEqual(expectedChildMan.Label, actualChildMan.Label);
            Assert.AreEqual(expectedChildMan.Multiplier, actualChildMan.Multiplier, DELTA);
        }
        public void Redo_Template_Device_Manufacturer()
        {
            //Arrange
            var             Template = ModelCreation.TestTemplates(rand);
            TECManufacturer edit     = new TECManufacturer();

            //Act
            ChangeWatcher watcher = new ChangeWatcher(Template); DoStacker testStack = new DoStacker(watcher);

            (Template.Templates.SystemTemplates[0].Equipment[0].SubScope[0].Devices[0] as TECDevice).Manufacturer = edit;
            testStack.Undo();
            testStack.Redo();

            //assert
            TECManufacturer actual = (Template.Templates.SystemTemplates[0].Equipment[0].SubScope[0].Devices[0] as TECDevice).Manufacturer;

            Assert.AreEqual(edit, actual, "Not Redone");
        }
        public void Undo_Template_Device_Manufacturer()
        {
            //Arrange
            var             Template = ModelCreation.TestTemplates(rand);
            var             device   = Template.Catalogs.Devices[0];
            Guid            expected = new Guid(device.Manufacturer.Guid.ToString());
            TECManufacturer edit     = new TECManufacturer();

            //Act
            ChangeWatcher watcher = new ChangeWatcher(Template); DoStacker testStack = new DoStacker(watcher);

            device.Manufacturer = edit;
            //Assert.AreEqual(1, testStack.UndoCount(), "Not added to undo stack");
            testStack.Undo();

            //assert
            Guid actual = new Guid(device.Manufacturer.Guid.ToString());

            Assert.AreEqual(expected, actual, "Not Undone");
        }
        public void Load_Templates_Manufacturer()
        {
            //Arrange
            Guid   expectedGuid       = new Guid("90cd6eae-f7a3-4296-a9eb-b810a417766d");
            string expectedName       = "Test Manufacturer";
            double expectedMultiplier = 0.5;


            TECManufacturer actualManufacturer = null;

            foreach (TECManufacturer man in actualTemplates.Catalogs.Manufacturers)
            {
                if (man.Guid == expectedGuid)
                {
                    actualManufacturer = man;
                    break;
                }
            }

            //Assert
            Assert.AreEqual(expectedName, actualManufacturer.Label);
            Assert.AreEqual(expectedMultiplier, actualManufacturer.Multiplier);
        }
Beispiel #20
0
        public static void ClassInitialize(TestContext TestContext)
        {
            rand = new Random(0);
            //Arrange
            expectedBid        = ModelCreation.TestBid(rand);
            expectedLabor      = expectedBid.ExtraLabor;
            expectedParameters = expectedBid.Parameters;
            expectedSystem     = expectedBid.Systems.First(x => x.Location != null);
            expectedSystem1    = expectedBid.Systems.First(x => x != expectedSystem);

            expectedEquipment = expectedSystem.Equipment.First(x => x.SubScope.Count > 0 && x.Location != null);
            expectedSubScope  = expectedEquipment.SubScope.First(x => x.Location != null);
            expectedDevice    = expectedBid.Catalogs.Devices.Where(x => x.Tags.Count > 0).First();

            expectedManufacturer = expectedDevice.Manufacturer;
            expectedPoint        = expectedSubScope.Points[0];

            expectedBranch    = expectedBid.ScopeTree.First(x => x.Branches.Count > 0 && x.Branches[0].Branches.Count > 0);
            expectedNote      = expectedBid.Notes[0];
            expectedExclusion = expectedBid.Exclusions[0];
            expectedTag       = expectedBid.Catalogs.Tags[0];

            expectedController = (TECProvidedController)expectedBid.Controllers.First(item => item is TECProvidedController);

            path = Path.GetTempFileName();

            //Act
            DatabaseManager <TECBid> manager = new DatabaseManager <TECBid>(path);

            manager.New(expectedBid);
            actualBid = manager.Load();

            if (actualBid.Systems.Count == 0)
            {
                string failDirectory = Path.GetTempPath() + "Estimating Tools\\";
                Directory.CreateDirectory(failDirectory);
                string failPath = failDirectory + "SaveNewBidTestFailed.edb";
                if (File.Exists(failPath))
                {
                    File.Delete(failPath);
                }
                File.Copy(path, failPath);
                Assert.Fail(string.Format("No systems loaded into bid. File saved at: {0}", failPath));
            }

            actualLabor          = actualBid.ExtraLabor;
            actualBid.Parameters = actualBid.Parameters;
            actualSystem         = actualBid.FindChild(expectedSystem.Guid) as TECTypical;
            actualSystem1        = actualBid.FindChild(expectedSystem1.Guid) as TECTypical;
            actualEquipment      = actualBid.FindChild(expectedEquipment.Guid) as TECEquipment;
            actualSubScope       = actualBid.FindChild(expectedSubScope.Guid) as TECSubScope;
            actualDevices        = actualSubScope.Devices;
            actualDevice         = actualBid.FindChild(expectedDevice.Guid) as TECDevice;
            actualPoint          = actualBid.FindChild(expectedPoint.Guid) as TECPoint;
            actualManufacturer   = actualBid.FindChild(expectedManufacturer.Guid) as TECManufacturer;
            actualBranch         = actualBid.FindChild(expectedBranch.Guid) as TECScopeBranch;
            actualNote           = actualBid.FindChild(expectedNote.Guid) as TECLabeled;
            actualExclusion      = actualBid.FindChild(expectedExclusion.Guid) as TECLabeled;
            actualTag            = actualBid.FindChild(expectedTag.Guid) as TECTag;
            actualController     = actualBid.FindChild(expectedController.Guid) as TECProvidedController;
        }
        public static TECCatalogs CreateTestCatalogs()
        {
            TECCatalogs outCatalogs = new TECCatalogs();

            //Associated Costs
            TECAssociatedCost elecCost = new TECAssociatedCost(CostType.Electrical);

            elecCost.Name  = "Elec Cost";
            elecCost.Cost  = 156.61;
            elecCost.Labor = 456.64;
            elecCost.Type  = CostType.Electrical;
            outCatalogs.AssociatedCosts.Add(elecCost);

            TECAssociatedCost tecCost = new TECAssociatedCost(CostType.TEC);

            tecCost.Name  = "TEC Cost";
            tecCost.Cost  = 46.43;
            tecCost.Labor = 61.45;
            tecCost.Type  = CostType.TEC;
            outCatalogs.AssociatedCosts.Add(tecCost);

            //Tags
            var tag1 = new TECTag();

            tag1.Label = "Tag 1";
            var tag2 = new TECTag();

            tag2.Label = "Test Tag";

            outCatalogs.Tags.Add(tag1);
            outCatalogs.Tags.Add(tag2);

            //Conduit Types
            var conduitType1 = new TECElectricalMaterial();

            conduitType1.Name  = "Test Conduit 1";
            conduitType1.Cost  = 64.49;
            conduitType1.Labor = 463.87;
            AssignSecondaryProperties(conduitType1, outCatalogs);
            conduitType1.RatedCosts.Add(tecCost);
            conduitType1.RatedCosts.Add(elecCost);

            outCatalogs.ConduitTypes.Add(conduitType1);

            var conduitType2 = new TECElectricalMaterial();

            conduitType2.Name  = "Test Conduit 2";
            conduitType2.Cost  = 13.45;
            conduitType2.Labor = 9873.40;
            AssignSecondaryProperties(conduitType2, outCatalogs);
            conduitType2.RatedCosts.Add(tecCost);
            conduitType2.RatedCosts.Add(elecCost);

            outCatalogs.ConduitTypes.Add(conduitType2);

            //ConnectionTypes
            var connectionType1 = new TECConnectionType();

            connectionType1.Name  = "FourC18";
            connectionType1.Cost  = 64.63;
            connectionType1.Labor = 98.16;
            AssignSecondaryProperties(connectionType1, outCatalogs);
            connectionType1.RatedCosts.Add(tecCost);
            connectionType1.RatedCosts.Add(elecCost);

            var connectionType2 = new TECConnectionType();

            connectionType2.Name  = "ThreeC18";
            connectionType2.Cost  = 73.16;
            connectionType2.Labor = 35.49;
            AssignSecondaryProperties(connectionType1, outCatalogs);
            connectionType1.RatedCosts.Add(tecCost);
            connectionType1.RatedCosts.Add(elecCost);

            outCatalogs.ConnectionTypes.Add(connectionType1);
            outCatalogs.ConnectionTypes.Add(connectionType2);

            //Manufacturers
            var manufacturer1 = new TECManufacturer();

            manufacturer1.Label      = "Test";
            manufacturer1.Multiplier = .51;

            outCatalogs.Manufacturers.Add(manufacturer1);

            //Devices
            ObservableCollection <TECConnectionType> contypes4 = new ObservableCollection <TECConnectionType>();

            contypes4.Add(connectionType1);
            TECDevice device1 = new TECDevice(Guid.NewGuid(), contypes4, new List <TECProtocol>(), manufacturer1);

            device1.Name        = "Device 1";
            device1.Description = "Description 1";
            device1.Price       = 64.96;
            device1.Tags.Add(tag1);
            AssignSecondaryProperties(device1, outCatalogs);

            outCatalogs.Devices.Add(device1);

            //IO Modules
            TECIOModule testIOModule = new TECIOModule(manufacturer1);

            testIOModule.Name         = "Test IO Module";
            testIOModule.Price        = 13.46;
            testIOModule.Manufacturer = manufacturer1;
            outCatalogs.IOModules.Add(testIOModule);

            //Controller Types
            TECControllerType controllerType = new TECControllerType(manufacturer1);

            controllerType.Name  = "Test Controller Type";
            controllerType.Price = 196.73;
            controllerType.Labor = 61.34;
            AssignSecondaryProperties(controllerType, outCatalogs);

            TECIO io = new TECIO(IOType.AI);

            io.Quantity = 100;
            controllerType.IO.Add(io);

            io          = new TECIO(IOType.UI);
            io.Quantity = 100;
            controllerType.IO.Add(io);

            io          = new TECIO(IOType.UO);
            io.Quantity = 100;
            controllerType.IO.Add(io);

            outCatalogs.ControllerTypes.Add(controllerType);

            //Panel Types
            TECPanelType panelType = new TECPanelType(manufacturer1);

            panelType.Price = 16.64;
            panelType.Labor = 91.46;
            panelType.Name  = "Test Panel Type";
            AssignSecondaryProperties(panelType, outCatalogs);

            outCatalogs.PanelTypes.Add(panelType);

            TECPanelType otherPanelType = new TECPanelType(manufacturer1);

            otherPanelType.Price = 46.61;
            otherPanelType.Labor = 64.19;
            otherPanelType.Name  = "Other Test Panel Type";
            AssignSecondaryProperties(otherPanelType, outCatalogs);

            outCatalogs.PanelTypes.Add(otherPanelType);

            //Valves
            TECDevice actuator = new TECDevice(new ObservableCollection <TECConnectionType>()
            {
                connectionType1
            },
                                               new List <TECProtocol>(),
                                               manufacturer1);

            actuator.Name = "actuator";
            outCatalogs.Devices.Add(actuator);
            TECValve valve = new TECValve(manufacturer1, actuator);

            outCatalogs.Valves.Add(valve);

            //Protocols
            TECProtocol protocol = new TECProtocol(new List <TECConnectionType> {
                connectionType1
            });

            protocol.Label = "BACnet IP";
            outCatalogs.Protocols.Add(protocol);

            controllerType.IO.Add(new TECIO(protocol));

            TECDevice netDevice = new TECDevice(Guid.NewGuid(), new List <TECConnectionType>(), new List <TECProtocol> {
                protocol
            }, manufacturer1);

            outCatalogs.Devices.Add(netDevice);

            return(outCatalogs);
        }
        public static TECTemplates CreateTestTemplates()
        {
            TECTemplates templates = new TECTemplates();

            //Labor
            //templates.Labor = CreateTestLabor();
            templates.Parameters.Add(CreateTestParameters(Guid.NewGuid()));
            templates.Catalogs = CreateTestCatalogs();

            //Tags
            TECTag testTag = new TECTag();

            testTag.Label = "Test Tag";
            TECTag sysTag = new TECTag();

            sysTag.Label = "System Tag";
            TECTag equipTag = new TECTag();

            equipTag.Label = "Equipment Tag";
            TECTag ssTag = new TECTag();

            ssTag.Label = "SubScope Tag";
            TECTag devTag = new TECTag();

            devTag.Label = "Device Tag";

            templates.Catalogs.Tags.Add(testTag);
            templates.Catalogs.Tags.Add(sysTag);
            templates.Catalogs.Tags.Add(equipTag);
            templates.Catalogs.Tags.Add(ssTag);
            templates.Catalogs.Tags.Add(devTag);

            //Manufacturers
            TECManufacturer testMan = new TECManufacturer();

            testMan.Label      = "Test Manufacturer";
            testMan.Multiplier = 0.654;
            TECManufacturer testDevMan = new TECManufacturer();

            testDevMan.Label      = "Child Manufacturer (Test Device)";
            testDevMan.Multiplier = 0.446;
            TECManufacturer childDevMan = new TECManufacturer();

            childDevMan.Label      = "Child Manufacturer (Child Device)";
            childDevMan.Multiplier = 0.916;

            templates.Catalogs.Manufacturers.Add(testMan);
            templates.Catalogs.Manufacturers.Add(testDevMan);
            templates.Catalogs.Manufacturers.Add(childDevMan);

            //Connection Types
            TECConnectionType testDevConnType = new TECConnectionType();

            testDevConnType.Name = "FourC18";

            TECConnectionType childDevConnType = new TECConnectionType();

            childDevConnType.Name = "ThreeC18";

            templates.Catalogs.ConnectionTypes.Add(testDevConnType);
            templates.Catalogs.ConnectionTypes.Add(childDevConnType);

            //Conduit Types
            TECElectricalMaterial testConduitType = new TECElectricalMaterial();

            testConduitType.Name  = "EMT";
            testConduitType.Cost  = 12;
            testConduitType.Labor = 2;

            templates.Catalogs.ConduitTypes.Add(testConduitType);

            TECElectricalMaterial otherConduitType = new TECElectricalMaterial();

            otherConduitType.Name  = "RGS";
            otherConduitType.Cost  = 18;
            otherConduitType.Labor = 4;

            templates.Catalogs.ConduitTypes.Add(otherConduitType);

            //Associated Costs
            TECAssociatedCost testAssociatedCost = new TECAssociatedCost(CostType.Electrical);

            testAssociatedCost.Name = "Flex";
            testAssociatedCost.Cost = 42;

            templates.Catalogs.AssociatedCosts.Add(testAssociatedCost);

            var testCost2 = new TECAssociatedCost(CostType.TEC);

            testCost2.Name = "Other Cost";
            templates.Catalogs.AssociatedCosts.Add(testCost2);

            //IO Modules
            TECIOModule testIOModule = new TECIOModule(testMan);

            testIOModule.Name         = "Test IO Module";
            testIOModule.Price        = 42;
            testIOModule.Manufacturer = testMan;
            templates.Catalogs.IOModules.Add(testIOModule);

            //Devices
            ObservableCollection <TECConnectionType> contypes2 = new ObservableCollection <TECConnectionType>();

            contypes2.Add(testDevConnType);
            TECDevice testDev = new TECDevice(Guid.NewGuid(), contypes2, new List <TECProtocol>(), testDevMan);

            testDev.Name        = "Test Device";
            testDev.Description = "Device Description";
            testDev.Price       = 20.3;

            ObservableCollection <TECConnectionType> contypes3 = new ObservableCollection <TECConnectionType>();

            contypes3.Add(childDevConnType);
            TECDevice childDev = new TECDevice(Guid.NewGuid(), contypes3, new List <TECProtocol>(), childDevMan);

            childDev.Name        = "Child Device";
            childDev.Description = "Child Device Description";
            childDev.Price       = 54.1;

            testDev.Tags.Add(devTag);
            childDev.Tags.Add(devTag);

            templates.Catalogs.Devices.Add(testDev);
            templates.Catalogs.Devices.Add(childDev);

            //System
            TECSystem system = new TECSystem(false);

            system.Name        = "Test System";
            system.Description = "System Description";

            TECEquipment sysEquip = new TECEquipment(false);

            sysEquip.Name        = "System Equipment";
            sysEquip.Description = "Child Equipment";
            TECSubScope sysSS = new TECSubScope(false);

            sysSS.Name        = "System SubScope";
            sysSS.Description = "Child SubScope";
            sysSS.AssociatedCosts.Add(testAssociatedCost);
            TECPoint sysPoint = new TECPoint(false);

            sysPoint.Type  = IOType.AI;
            sysPoint.Label = "System Point";

            sysSS.Points.Add(sysPoint);
            sysSS.Devices.Add(childDev);
            sysSS.Tags.Add(ssTag);

            sysEquip.SubScope.Add(sysSS);
            sysEquip.Tags.Add(equipTag);

            system.Equipment.Add(sysEquip);
            system.Tags.Add(sysTag);

            templates.SystemTemplates.Add(system);

            //Equipment
            TECEquipment equipment = new TECEquipment(false);

            equipment.Name        = "Test Equipment";
            equipment.Description = "Equipment Description";
            TECSubScope equipSS = new TECSubScope(false);

            equipSS.Name        = "Equipment SubScope";
            equipSS.Description = "Child SubScope";
            TECPoint equipPoint = new TECPoint(false);

            equipPoint.Type  = IOType.AI;
            equipPoint.Label = "Equipment Point";

            equipSS.Points.Add(equipPoint);
            equipSS.Devices.Add(childDev);
            equipSS.Tags.Add(ssTag);

            equipment.SubScope.Add(equipSS);
            equipment.Tags.Add(equipTag);

            templates.EquipmentTemplates.Add(equipment);

            //SubScope
            TECSubScope subScope = new TECSubScope(false);

            subScope.Name        = "Test SubScope";
            subScope.Description = "SubScope Description";
            TECPoint ssPoint = new TECPoint(false);

            ssPoint.Type  = IOType.DO;
            ssPoint.Label = "SubScope Point";

            subScope.Points.Add(ssPoint);
            subScope.Devices.Add(childDev);
            subScope.Tags.Add(ssTag);
            subScope.AssociatedCosts.Add(testAssociatedCost);

            templates.SubScopeTemplates.Add(subScope);

            //Controller
            var expectedControllerType = new TECControllerType(testMan);

            expectedControllerType.Price = 42.6;
            TECIO ioToAdd = new TECIO(IOType.AI);

            ioToAdd.Quantity = 5;
            TECIO otherIO = new TECIO(IOType.UI);

            otherIO.Quantity = 3;
            expectedControllerType.IO.Add(ioToAdd);
            expectedControllerType.IO.Add(otherIO);
            templates.Catalogs.ControllerTypes.Add(expectedControllerType);

            TECController expectedController = new TECProvidedController(expectedControllerType, false);

            expectedController.Name        = "Test Controller";
            expectedController.Description = "Test description";

            TECController controlledController = new TECProvidedController(expectedControllerType, false);

            controlledController.Name = "Controlled Controller";

            templates.ControllerTemplates.Add(expectedController);

            //Misc Cost
            TECMisc cost = new TECMisc(CostType.TEC, false);

            cost.Name     = "Test Cost";
            cost.Cost     = 79.79;
            cost.Quantity = 67;

            templates.MiscCostTemplates.Add(cost);

            //Misc wiring
            TECMisc wiring = new TECMisc(CostType.Electrical, false);

            wiring.Name     = "Test Wiring";
            wiring.Cost     = 69.69;
            wiring.Quantity = 69;

            templates.MiscCostTemplates.Add(wiring);

            //Panel Types
            TECPanelType panelType = new TECPanelType(testMan);

            panelType.Price = 123.4;
            panelType.Name  = "Test Panel Type";

            templates.Catalogs.PanelTypes.Add(panelType);

            //Panels
            TECPanel panel = new TECPanel(panelType, false);

            panel.Name = "Test Panel";
            panel.AssociatedCosts.Add(testAssociatedCost);
            panel.AssociatedCosts.Add(testAssociatedCost);

            TECPanel controlledPanel = new TECPanel(panelType, false);

            controlledPanel.Name = "Controlled Panel";

            templates.PanelTemplates.Add(panel);

            //Synchronizer
            TemplateSynchronizer <TECEquipment> equipSynchronizer = templates.EquipmentSynchronizer;
            TemplateSynchronizer <TECSubScope>  ssSynchronizer    = templates.SubScopeSynchronizer;

            TECSystem syncSys = new TECSystem(false);

            syncSys.Name = "Sync System";
            templates.SystemTemplates.Add(syncSys);

            TECEquipment syncEquip = new TECEquipment(false);

            syncEquip.Name = "Sync Equip";
            templates.EquipmentTemplates.Add(syncEquip);
            syncSys.Equipment.Add(equipSynchronizer.NewItem(syncEquip));

            TECSubScope syncSubScope = new TECSubScope(false);

            syncSubScope.Name = "Sync SS";
            templates.SubScopeTemplates.Add(syncSubScope);
            syncEquip.SubScope.Add(ssSynchronizer.NewItem(syncSubScope));

            return(templates);
        }