Guest User

Untitled

a guest
May 21st, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 8.07 KB | None | 0 0
  1. using Microsoft.VisualStudio.TestTools.UnitTesting;
  2. using System;
  3.  
  4. namespace TestNow1
  5. {
  6.    
  7.    
  8.     /// <summary>
  9.     ///This is a test class for TriangleTest and is intended
  10.     ///to contain all TriangleTest Unit Tests
  11.     ///</summary>
  12.     [TestClass()]
  13.     public class TriangleTest
  14.     {
  15.  
  16.  
  17.         private TestContext testContextInstance;
  18.  
  19.         /// <summary>
  20.         ///Gets or sets the test context which provides
  21.         ///information about and functionality for the current test run.
  22.         ///</summary>
  23.         public TestContext TestContext
  24.         {
  25.             get
  26.             {
  27.                 return testContextInstance;
  28.             }
  29.             set
  30.             {
  31.                 testContextInstance = value;
  32.             }
  33.         }
  34.  
  35.         #region Additional test attributes
  36.         //
  37.         //You can use the following additional attributes as you write your tests:
  38.         //
  39.         //Use ClassInitialize to run code before running the first test in the class
  40.         //[ClassInitialize()]
  41.         //public static void MyClassInitialize(TestContext testContext)
  42.         //{
  43.         //}
  44.         //
  45.         //Use ClassCleanup to run code after all tests in a class have run
  46.         //[ClassCleanup()]
  47.         //public static void MyClassCleanup()
  48.         //{
  49.         //}
  50.         //
  51.         //Use TestInitialize to run code before running each test
  52.         //[TestInitialize()]
  53.         //public void MyTestInitialize()
  54.         //{
  55.         //}
  56.         //
  57.         //Use TestCleanup to run code after each test has run
  58.         //[TestCleanup()]
  59.         //public void MyTestCleanup()
  60.         //{
  61.         //}
  62.         //
  63.         #endregion
  64.  
  65.  
  66.         /// <summary>
  67.         ///A test for Triangle Constructor
  68.         /// <summary>
  69.         ///A test for Triangle Constructor
  70.         ///</summary>
  71.         [TestMethod()]
  72.         public void TriangleConstructorTest1()
  73.         {
  74.             Triangle target = new Triangle(new Point(0, 2), new Point(2, 4), new Point(4, 0));
  75.             Assert.IsTrue(target.isIsosceles());
  76.            
  77.         }
  78.  
  79.         /// <summary>
  80.         ///A test for Triangle Constructor
  81.         ///</summary>
  82.         [TestMethod()]
  83.         //.Tre lika sidor
  84.         public void TriangleConstructorTest2()
  85.         {
  86.             double a = 3.0;
  87.             double b = 3.0;
  88.             double c = 3.0;
  89.             Triangle target = new Triangle(a, b, c);
  90.            
  91.         }
  92.  
  93.         /// <summary>
  94.         ///A test for Triangle Constructor
  95.         ///</summary>
  96.         [TestMethod()]
  97.         //.Tre olika sidor
  98.         public void TriangleConstructorTest3()
  99.         {
  100.             double a = 3.0;
  101.             double b = 4.0;
  102.             double c = 5.0;
  103.             Triangle target = new Triangle(a, b, c);
  104.  
  105.         }
  106.  
  107.         /// <summary>
  108.         ///A test for Triangle Constructor
  109.         ///</summary>
  110.        
  111.         [TestMethod()]
  112.         //.Tre olika sidor
  113.         public void TriangleConstructorTest4()
  114.         {
  115.             double a = 1.0;
  116.             double b = 2.0;
  117.             double c = 5.0;
  118.             Triangle target = new Triangle(a, b, c);
  119.  
  120.         }
  121.  
  122.         /// <summary>
  123.         ///A test for Triangle Constructor
  124.         ///</summary>
  125.        
  126.         [TestMethod()]
  127.         //.Två lika sidor
  128.         public void TriangleConstructorTest5()
  129.         {
  130.             double a = 2.0;
  131.             double b = 2.0;
  132.             double c = 7.0;
  133.             Triangle target = new Triangle(a, b, c);
  134.  
  135.         }
  136.  
  137.         /// <summary>
  138.         ///A test for Triangle Constructor
  139.         ///</summary>
  140.        
  141.         [TestMethod()]
  142.         //.Endast nollor
  143.         public void TriangleConstructorTest6()
  144.         {
  145.             try
  146.             {
  147.                 double a = 0.0;
  148.                 double b = 0.0;
  149.                 double c = 0.0;
  150.                 Triangle target = new Triangle(a, b, c);
  151.             }
  152.             catch (ArgumentOutOfRangeException)
  153.             {
  154.  
  155.                 Assert.IsTrue(true);
  156.             }
  157.  
  158.  
  159.         }
  160.  
  161.         /// <summary>
  162.         ///A test for Triangle Constructor
  163.         ///</summary>
  164.        
  165.         [TestMethod()]
  166.         //.Olika sidor en nolla
  167.         public void TriangleConstructorTest7()
  168.         {
  169.             double a = 0.0;
  170.             double b = 2.0;
  171.             double c = 1.0;
  172.             Triangle target = new Triangle(a, b, c);
  173.  
  174.         }
  175.  
  176.         /// <summary>
  177.         ///A test for Triangle Constructor
  178.         ///</summary>
  179.        
  180.         [TestMethod()]
  181.         //. Tre olika negativa sidor
  182.         public void TriangleConstructorTest8()
  183.         {
  184.             try
  185.             {
  186.                 double[] s = new double[3] { -1.0, -2.0, -4.0 };
  187.                 Triangle target = new Triangle(s);
  188.             }
  189.             catch (ArgumentOutOfRangeException)
  190.             {
  191.                 Assert.IsTrue(true);
  192.             }
  193.         }
  194.  
  195.         /// <summary>
  196.         ///A test for isEquilateral
  197.         ///</summary>
  198.         [TestMethod()]
  199.         //.Två lika sidor, en negativ
  200.         public void TriangleConstructorTest9()
  201.         {
  202.             try
  203.             {
  204.                 double a = 1.0;
  205.                 double b = 1.0;
  206.                 double c = -6.0;
  207.                 Triangle target = new Triangle(a, b, c);
  208.             }
  209.             catch (ArgumentOutOfRangeException)
  210.             {
  211.                
  212.                 Assert.IsTrue(true);
  213.             }
  214.  
  215.  
  216.         }
  217.  
  218.         /// <summary>
  219.         ///A test for Triangle Constructor
  220.         ///</summary>
  221.        
  222.         [TestMethod()]
  223.         //.Två lika negativa sidor
  224.         public void TriangleConstructorTest10()
  225.         {
  226.             try
  227.             {
  228.                 double a = -1.0;
  229.                 double b = -1.0;
  230.                 double c = 6.0;
  231.                 Triangle target = new Triangle(a, b, c);
  232.             }
  233.             catch (ArgumentOutOfRangeException)
  234.             {
  235.                
  236.                 Assert.IsTrue(true);
  237.             }
  238.  
  239.  
  240.         }
  241.  
  242.         /// <summary>
  243.         ///A test for Triangle Constructor
  244.         ///</summary>
  245.         [TestMethod()]
  246.         //.Olika sidor, decimaltal
  247.         public void TriangleConstructorTest11()
  248.         {
  249.             double a = 1.2;
  250.             double b = 1.4;
  251.             double c = 1.6;
  252.             Triangle target = new Triangle(a, b, c);
  253.  
  254.         }
  255.  
  256.         /// <summary>
  257.         ///A test for Triangle Constructor
  258.         ///</summary>
  259.  
  260.         [TestMethod()]
  261.         public void isEquilateralTest()
  262.         {
  263.             double[] s = { 1.0, 1.0, 1.0 }; // TODO: Initialize to an appropriate value
  264.             Triangle target = new Triangle(s); // TODO: Initialize to an appropriate value
  265.             bool expected = true; // TODO: Initialize to an appropriate value
  266.             bool actual;
  267.             actual = target.isEquilateral();    
  268.             Assert.AreEqual(expected, actual);
  269.            
  270.         }
  271.  
  272.         /// <summary>
  273.         ///A test for isIsosceles
  274.         ///</summary>
  275.         [TestMethod()]
  276.         public void isIsoscelesTest()
  277.         {
  278.             double[] s = new double[3] { 2.0, 2.0, 3 }; // TODO: Initialize to an appropriate value
  279.             Triangle target = new Triangle(s); // TODO: Initialize to an appropriate value
  280.             bool expected = true; // TODO: Initialize to an appropriate value
  281.             bool actual;
  282.             actual = target.isIsosceles();
  283.             Assert.AreEqual(expected, actual);
  284.            
  285.         }
  286.  
  287.         /// <summary>
  288.         ///A test for isScalene
  289.         ///</summary>
  290.         [TestMethod()]
  291.         public void isScaleneTest()
  292.         {
  293.             double[] s = { 2.0, 3.0, 4.0} ; // TODO: Initialize to an appropriate value
  294.             Triangle target = new Triangle(s); // TODO: Initialize to an appropriate value
  295.             bool expected = true; // TODO: Initialize to an appropriate value
  296.             bool actual;
  297.             actual = target.isScalene();
  298.             Assert.AreEqual(expected, actual);
  299.           }
  300.     }
  301. }
Add Comment
Please, Sign In to add comment