예제 #1
0
        public void RemoveValve()
        {
            //Arrange
            bid.Catalogs.Add(ModelCreation.TestValve(bid.Catalogs, rand));
            ChangeWatcher cw = new ChangeWatcher(bid);

            TECTypical typical = new TECTypical();

            bid.Systems.Add(typical);

            TECEquipment typEquip = new TECEquipment();

            typical.Equipment.Add(typEquip);

            TECSubScope typSS = new TECSubScope();

            typEquip.SubScope.Add(typSS);

            TECValve valve = bid.Catalogs.Valves[0];

            valve.AssignRandomScopeProperties(bid.Catalogs, rand);
            typSS.Devices.Add(valve);

            typical.AddInstance();

            MaterialSummaryVM matVM = new MaterialSummaryVM(bid, cw);

            CostBatch initial = MatVMToCostBatch(matVM);

            //Act
            typSS.Devices.Remove(valve);

            //Assert
            AssertMaterialVMMatchesCostBatch(matVM, initial - valve.CostBatch);
        }
예제 #2
0
        public void AddValve()
        {
            //Arrange
            TECValve valve = ModelCreation.TestValve(bid.Catalogs, rand);

            valve.AssignRandomScopeProperties(bid.Catalogs, rand);

            TECTypical typical = new TECTypical();

            bid.Systems.Add(typical);

            TECEquipment typEquip = new TECEquipment();

            typical.Equipment.Add(typEquip);

            TECSubScope typSS = new TECSubScope();

            typEquip.SubScope.Add(typSS);

            typical.AddInstance();

            MaterialSummaryVM matVM = new MaterialSummaryVM(bid, cw);

            //Act
            typSS.Devices.Add(valve);

            //Assert
            AssertMaterialVMMatchesCostBatch(matVM, valve.CostBatch);
        }
예제 #3
0
        public void CatalogCopyTest()
        {
            Random      rand     = new Random(0);
            TECCatalogs catalogs = ModelCreation.TestCatalogs(rand);
            TECValve    valve    = ModelCreation.TestValve(catalogs, rand);
            var         copy     = valve.CatalogCopy();

            Assert.AreNotEqual(valve.Guid, copy.Guid);
            Assert.AreEqual(valve.Name, copy.Name);
            Assert.AreEqual(valve.Description, copy.Description);
            Assert.AreEqual(valve.Price, copy.Price);
            Assert.AreEqual(valve.Manufacturer, copy.Manufacturer);
            Assert.AreEqual(valve.Actuator, copy.Actuator);
        }