public void SavingsTests() // Teszt a hőmérséklet változtatásához és annak megtartásához szükséges költség számításához. { // Test segédváltozók double actualEnergydt; double changedEnergydt; long timeTilMonthsEnd; double actualPrediction; double changedPrediction; double ExpectedSavings; // Testhez szükséges elemek1 setupParameters1(); actualEnergydt = ((inAverage - outAverage) / 0.3) * 8 * 1.4; changedEnergydt = ((inAverage - outAverage + changeOfInsideTemp) / 0.3) * 8 * 1.4; timeTilMonthsEnd = (DateTime.DaysInMonth(DateTime.Today.Year, DateTime.Today.Month) - (DateTime.Today.Day - 1)) * 24 * 3600; actualPrediction = timeTilMonthsEnd * actualEnergydt * 700 / (3.6e+9); changedPrediction = timeTilMonthsEnd * changedEnergydt * 700 / (3.6e+9); // Elvárt érték1 ExpectedSavings = actualPrediction - changedPrediction; // Assert1 Assert.AreEqual((float)ExpectedSavings, (float)TestService.savingPrediction(TestSettings, changeOfInsideTemp, InTempList, OutTempList)); // Testhez szükséges elemek2 setupParameters2(); actualEnergydt = ((inAverage - outAverage) / 0.25) * 12 * 0.9; changedEnergydt = ((inAverage - outAverage + changeOfInsideTemp) / 0.25) * 12 * 0.9; timeTilMonthsEnd = (DateTime.DaysInMonth(DateTime.Today.Year, DateTime.Today.Month) - (DateTime.Today.Day - 1)) * 24 * 3600; actualPrediction = timeTilMonthsEnd * actualEnergydt * 825 / (3.6e+9); changedPrediction = timeTilMonthsEnd * changedEnergydt * 825 / (3.6e+9); // Elvárt érték2 ExpectedSavings = actualPrediction - changedPrediction; // Assert2 Assert.AreEqual((float)ExpectedSavings, (float)TestService.savingPrediction(TestSettings, changeOfInsideTemp, InTempList, OutTempList)); }
private void nuTempChange_ValueChanged(object sender, EventArgs e) { var insideTemp = new List <double>(); foreach (var item in InsideDataList) { insideTemp.Add(item.Temperature); } lbAvgInsideTemp.Text = Math.Round(tempService.countAverage(insideTemp)).ToString(); var outsideTemp = new List <double>(); foreach (var item in OutsideDataList) { outsideTemp.Add(item.Temperature); } lbSavingPrediction.Text = Math.Round(tempService.savingPrediction(Settings, (double)nuTempChange.Value, insideTemp, outsideTemp)).ToString(); }