public void ImperialDistanceTest() { var one_inch = new ImperialDistance(1f); // 1 inch var one_foot = new ImperialDistance(12f); // 12 inches Assert.That(ImperialDistance.Inch, Is.Not.EqualTo(new MetricDistance(1f))); Assert.That(ImperialDistance.Inch, Is.EqualTo(new ImperialDistance(1f))); Assert.That(ImperialDistance.Foot, Is.EqualTo(new ImperialDistance(12f))); Assert.That(one_inch, Is.EqualTo(ImperialDistance.Inch)); Assert.That(one_inch.ToInches(), Is.EqualTo(ImperialDistance.Inch.ToInches())); Assert.That(one_inch.ToMetric().ToMeters(), Is.EqualTo(0.0254f)); Assert.That(one_inch.ToMeters(), Is.EqualTo(0.0254f)); Assert.That(one_inch.ToInches(), Is.EqualTo(1f)); Assert.That(one_inch.GetHashCode(), Is.GreaterThan(0)); Assert.That(one_inch == ImperialDistance.Inch, Is.True); Assert.That(one_inch == ImperialDistance.Inch, Is.True); Assert.That(one_foot, Is.EqualTo(ImperialDistance.Foot)); Assert.That(one_foot != one_inch, Is.True); Assert.That(one_inch + one_inch, Is.EqualTo(new ImperialDistance(2f))); Assert.That(one_inch - one_inch, Is.EqualTo(new ImperialDistance(0f))); Assert.That(new ImperialDistance(2f) * new ImperialDistance(6f), Is.EqualTo(ImperialDistance.Foot)); Assert.That(ImperialDistance.Foot / ImperialDistance.Inch, Is.EqualTo(ImperialDistance.Foot)); }
public static ImperialDistance Divide(ImperialDistance a, ImperialDistance b) { return(a / b); }
public static ImperialDistance Subtract(ImperialDistance a, ImperialDistance b) { return(a - b); }
public static ImperialDistance Multiply(ImperialDistance a, ImperialDistance b) { return(a * b); }
public static ImperialDistance Add(ImperialDistance a, ImperialDistance b) { return(a + b); }