TemperatureCompensationCaculator_Test.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using Application.ATG_Classic_App;
  2. using Microsoft.VisualStudio.TestTools.UnitTesting;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace Application.ATG_Classic_App_Test
  8. {
  9. [TestClass]
  10. public class TemperatureCompensationCaculator_Test
  11. {
  12. [TestMethod]
  13. public async Task TestMethod1()
  14. {
  15. /*data are from real VR Console*/
  16. var caculator = new TemperatureCompensationCaculator(0.0007);
  17. double expect = 638.9;
  18. var actual = caculator.CaculateCompensatedVolume(15.556, 643.4, 25.5);
  19. Assert.AreEqual(expect, Math.Round(actual, 1, MidpointRounding.AwayFromZero));
  20. }
  21. [TestMethod]
  22. public async Task TestMethod2()
  23. {
  24. /*data are from real VR Console*/
  25. var caculator = new TemperatureCompensationCaculator(0.0007);
  26. double expect = 1582.3;
  27. var actual = caculator.CaculateCompensatedVolume(15.556, 1593.1, 25.2);
  28. Assert.AreEqual(expect, Math.Round(actual, 1, MidpointRounding.AwayFromZero));
  29. }
  30. [TestMethod]
  31. public async Task TestMethod3()
  32. {
  33. /*data are from real VR Console,
  34. * this test failed. not quite sure how it rounding, but we are close enough...
  35. * so leave it here.
  36. */
  37. var caculator = new TemperatureCompensationCaculator(0.0007);
  38. double expect = 1604.7;
  39. var actual = caculator.CaculateCompensatedVolume(35.556, 1593.2, 25.3);
  40. Assert.AreEqual(expect, Math.Round(actual, 1, MidpointRounding.AwayFromZero));
  41. }
  42. }
  43. }