コード例 #1
0
 private double GetConvertedValue(Temperature unit, double returnValue)
 {
     return(unit switch
     {
         Temperature.Fahrenheit => SystemConverter.SystemTempToFahrenheit(returnValue),
         Temperature.Kelvin => SystemConverter.SystemTempToKelvin(returnValue),
         _ => SystemConverter.SystemTempToCelcius(returnValue),
     });
コード例 #2
0
 private double ConvertResultToDesiredUnits(StorageUnit unit, double input)
 {
     return(unit switch
     {
         StorageUnit.Kilobyte => SystemConverter.BytesToKilobytes(input),
         StorageUnit.Megabyte => SystemConverter.BytesToMegabytes(input),
         StorageUnit.Gigabyte => SystemConverter.BytesToGigabytes(input),
         StorageUnit.Terabyte => SystemConverter.BytesToTerabytes(input),
         _ => input,
     });
コード例 #3
0
 private double ConvertToOptionsUnit(double bytes, StorageUnit unit)
 {
     return(unit switch
     {
         StorageUnit.Kilobyte => SystemConverter.BytesToKilobytes(bytes),
         StorageUnit.Megabyte => SystemConverter.BytesToMegabytes(bytes),
         StorageUnit.Gigabyte => SystemConverter.BytesToGigabytes(bytes),
         StorageUnit.Terabyte => SystemConverter.BytesToTerabytes(bytes),
         _ => bytes,
     });
コード例 #4
0
        public void Translate1Test(
            double a1, double a2, double a3,
            double b1, double b2, double b3,
            double c1, double c2, double c3,
            double delta)
        {
            Point3D origin   = new Point3D(a1, a2, a3);
            Point3D source   = new Point3D(b1, b2, b3);
            Point3D expected = new Point3D(c1, c2, c3);

            var conv = SystemConverter.New(origin);
            var res  = conv.Transform(source);

            Assert.AreEqual(expected.X, res.X, delta, "X");
            Assert.AreEqual(expected.Y, res.Y, delta, "Y");
            Assert.AreEqual(expected.Z, res.Z, delta, "Z");
        }
コード例 #5
0
        public void TransAndZRotate2Test(
            double a1, double a2, double a3,
            double b1, double b2, double b3,
            double c1, double c2, double c3,
            double d1, double d2, double d3,
            double delta = 0.001)
        {
            Point3D origin   = new Point3D(a1, a2, a3);
            Point3D xaxis    = new Point3D(b1, b2, b3);
            Point3D source   = new Point3D(c1, c2, c3);
            Point3D expected = new Point3D(d1, d2, d3);

            var conv = SystemConverter.New(origin, xaxis);
            var res  = conv.Transform(source);

            Assert.AreEqual(expected.X, res.X, delta, "X");
            Assert.AreEqual(expected.Y, res.Y, delta, "Y");
            Assert.AreEqual(expected.Z, res.Z, delta, "Z");
        }