SHOW:
|
|
- or go back to the newest paste.
| 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; | |
| 2 | using ConsoleApp.ExtMethods; | |
| 3 | ||
| 4 | namespace ConsoleApp | |
| 5 | {
| |
| 6 | ||
| 7 | [TestClass] | |
| 8 | public class TestCases | |
| 9 | {
| |
| 10 | [TestMethod] | |
| 11 | public void TestDoubleExtentions() | |
| 12 | {
| |
| 13 | double v1 = 12.51367; | |
| 14 | double v2 = 15; | |
| 15 | double v3 = 0.5125; | |
| 16 | ||
| 17 | Assert.AreEqual(v1.IntPart(), 12); | |
| 18 | Assert.AreEqual(v1.FractPart(), 51367); | |
| 19 | Assert.AreEqual(v2.IntPart(), 15); | |
| 20 | Assert.AreEqual(v2.FractPart(), 0); | |
| 21 | Assert.AreEqual(v3.IntPart(), 0); | |
| 22 | Assert.AreEqual(v3.FractPart(), 5125); | |
| 23 | Assert.AreEqual((5678.5678).IntPart(), (5678.5678).FractPart()); | |
| 24 | } | |
| 25 | } | |
| 26 | } |