public static TECExtraLabor CreateTestExtraLabor(Guid bidGuid) { TECExtraLabor labor = new TECExtraLabor(bidGuid); labor.PMExtraHours = 1.1; labor.CommExtraHours = 3.3; labor.ENGExtraHours = 2.2; labor.SoftExtraHours = 4.4; labor.GraphExtraHours = 5.5; return(labor); }
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; }