Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.32 KB | None | 0 0
  1. namespace NUnitTestProject1
  2. {
  3.     public class RouteTest
  4.     {
  5.         Route route;
  6.  
  7.         [SetUp]
  8.         public void Setup()
  9.         {
  10.             route = new Route();
  11.         }
  12.  
  13.         [Test]
  14.         public void Test_List_Count()
  15.         {
  16.             route.Add_Point(2, 0, 0);
  17.             route.Add_Point(4, 0, 1);
  18.             route.Add_Point(3, 0, 2);
  19.             int pointCount = route.Get_ListCount();
  20.             Assert.AreEqual(3, pointCount);
  21.         }
  22.  
  23.         [Test]
  24.         public void Test_Remove_Point()
  25.         {
  26.             route.Add_Point(2, 0, 0);
  27.             route.Add_Point(4, 0, 1);
  28.             route.Add_Point(3, 0, 2);
  29.             route.Remove_Point(1);
  30.             int pointCount = route.Get_ListCount();
  31.             Assert.AreEqual(2, pointCount);
  32.         }
  33.  
  34.         [Test]
  35.         public void Test_Remove_Point2()
  36.         {
  37.             route.Add_Point(2, 0, 0);
  38.             route.Add_Point(3, 0, 1);
  39.             route.Add_Point(34, 0, 2);
  40.             route.Add_Point(5, 0, 1);
  41.             route.Remove_Point(1);
  42.             int pointCount = route.Get_ListCount();
  43.             Assert.AreEqual(3, pointCount);
  44.         }
  45.  
  46.         [Test]
  47.         public void Test_Get_Length()
  48.         {
  49.             route.Add_Point(2, 0, 0);
  50.             route.Add_Point(3, 0, 1);
  51.             route.Add_Point(7, 0, 2);
  52.             route.Add_Point(10, 0, 3);
  53.             double routeLength = route.Get_Length();
  54.             Assert.AreEqual(8, routeLength);
  55.         }
  56.  
  57.         [Test]
  58.         public void Test_Get_Length_count0()
  59.         {
  60.             route.Add_Point(2, 0, 0);
  61.             double routeLength = route.Get_Length();
  62.             Assert.AreEqual(0, routeLength);
  63.         }
  64.     }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement