public static TECParameters CreateTestParameters(Guid bidGuid) { var parameters = new TECParameters(bidGuid); parameters.IsTaxExempt = true; parameters.PMCoef = 0.1; parameters.PMRate = 0.11; parameters.ENGCoef = 0.2; parameters.ENGRate = 0.22; parameters.CommCoef = 0.3; parameters.CommRate = 0.33; parameters.SoftCoef = 0.4; parameters.SoftRate = 0.44; parameters.GraphCoef = 0.5; parameters.GraphRate = 0.55; parameters.ElectricalRate = 0.6; parameters.ElectricalSuperRate = 0.66; parameters.ElectricalSuperRatio = 1.0 / 7.0; parameters.ElectricalNonUnionRate = 0.7; parameters.ElectricalSuperNonUnionRate = 0.77; parameters.ElectricalIsOnOvertime = true; parameters.ElectricalIsUnion = true; return(parameters); }
public void UpdateConstantsTest() { TECParameters parameters = new TECParameters(); TECParameters newLabor = ModelCreation.TestParameters(new Random(0)); parameters.UpdateConstants(newLabor); Assert.AreEqual(newLabor.PMCoef, parameters.PMCoef); Assert.AreEqual(newLabor.PMCoefStdError, parameters.PMCoefStdError); Assert.AreEqual(newLabor.PMExtenedCoef, parameters.PMExtenedCoef); Assert.AreEqual(newLabor.PMRate, parameters.PMRate); Assert.AreEqual(newLabor.ENGCoef, parameters.ENGCoef); Assert.AreEqual(newLabor.ENGCoefStdError, parameters.ENGCoefStdError); Assert.AreEqual(newLabor.ENGExtenedCoef, parameters.ENGExtenedCoef); Assert.AreEqual(newLabor.ENGRate, parameters.ENGRate); Assert.AreEqual(newLabor.SoftCoef, parameters.SoftCoef); Assert.AreEqual(newLabor.SoftCoefStdError, parameters.SoftCoefStdError); Assert.AreEqual(newLabor.SoftExtenedCoef, parameters.SoftExtenedCoef); Assert.AreEqual(newLabor.SoftRate, parameters.SoftRate); Assert.AreEqual(newLabor.GraphCoef, parameters.GraphCoef); Assert.AreEqual(newLabor.GraphCoefStdError, parameters.GraphCoefStdError); Assert.AreEqual(newLabor.GraphExtenedCoef, parameters.GraphExtenedCoef); Assert.AreEqual(newLabor.GraphRate, parameters.GraphRate); Assert.AreEqual(newLabor.ElectricalRate, parameters.ElectricalRate); Assert.AreEqual(newLabor.ElectricalNonUnionRate, parameters.ElectricalNonUnionRate); Assert.AreEqual(newLabor.ElectricalSuperRate, parameters.ElectricalSuperRate); Assert.AreEqual(newLabor.ElectricalSuperNonUnionRate, parameters.ElectricalSuperNonUnionRate); Assert.AreEqual(newLabor.ElectricalSuperRatio, parameters.ElectricalSuperRatio); }
public SystemSummaryItem(TECTypical typical, TECParameters parameters, double duration = 0.0) { this.Typical = typical; Estimate = new TECEstimator(Typical, parameters, new TECExtraLabor(Guid.NewGuid()), duration, new ChangeWatcher(Typical)); UnitPrice = Estimate.TotalPrice / Typical.Instances.Count; Estimate.PropertyChanged += (x, y) => { UnitPrice = Estimate.TotalPrice / Typical.Instances.Count; }; }
public void SaveNew_Templates_SubcontractLaborConstants() { TECParameters expectedLabor = expectedTemplates.Templates.Parameters[0]; TECParameters actualLabor = actualTemplates.Templates.Parameters.First(x => x.Guid == expectedLabor.Guid); //Assert Assert.AreEqual(expectedLabor.ElectricalRate, actualLabor.ElectricalRate, DELTA); Assert.AreEqual(expectedLabor.ElectricalSuperRate, actualLabor.ElectricalSuperRate, DELTA); Assert.AreEqual(expectedLabor.ElectricalNonUnionRate, actualLabor.ElectricalNonUnionRate, DELTA); Assert.AreEqual(expectedLabor.ElectricalSuperNonUnionRate, actualLabor.ElectricalSuperNonUnionRate, DELTA); }
public void SaveNew_Templates_LaborConstants() { TECParameters expectedLabor = expectedTemplates.Templates.Parameters[0]; TECParameters actualLabor = actualTemplates.Templates.Parameters.First(x => x.Guid == expectedLabor.Guid); //Assert Assert.AreEqual(expectedLabor.PMCoef, actualLabor.PMCoef, DELTA); Assert.AreEqual(expectedLabor.PMRate, actualLabor.PMRate, DELTA); Assert.AreEqual(expectedLabor.ENGCoef, actualLabor.ENGCoef, DELTA); Assert.AreEqual(expectedLabor.ENGRate, actualLabor.ENGRate, DELTA); Assert.AreEqual(expectedLabor.CommCoef, actualLabor.CommCoef, DELTA); Assert.AreEqual(expectedLabor.CommRate, actualLabor.CommRate, DELTA); Assert.AreEqual(expectedLabor.SoftCoef, actualLabor.SoftCoef, DELTA); Assert.AreEqual(expectedLabor.SoftRate, actualLabor.SoftRate, DELTA); Assert.AreEqual(expectedLabor.GraphCoef, actualLabor.GraphCoef, DELTA); Assert.AreEqual(expectedLabor.GraphRate, actualLabor.GraphRate, DELTA); }
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; }
private void SetParametersExecute(TECParameters obj) { Bid.Parameters = new TECParameters(obj); }
public ScopeSummaryItem(TECScope scope, TECParameters parameters, double duration = 0.0) { this.Scope = scope; watcher = new ChangeWatcher(scope); Estimate = new TECEstimator(scope, parameters, new TECExtraLabor(Guid.NewGuid()), duration, watcher); }