Advertisement
Hristo_B

Methods.Unit Testing

Jul 8th, 2013
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.44 KB | None | 0 0
  1. using System;
  2. using Microsoft.VisualStudio.TestTools.UnitTesting;
  3.  
  4. namespace _04.CountNumberUnitTests
  5. {
  6.     [TestClass]
  7.     public class CountNumberUnitTests
  8.     {
  9.         [TestMethod]
  10.         public void TestMethod1()
  11.         {
  12.             int[] array = {1,5,6,846,324,3,4,6,6,};
  13.             int result = CountNumberInArray.CountNumber(array, 6);
  14.             Assert.AreEqual(3, result);
  15.         }
  16.         [TestMethod]
  17.         public void TestMethod2()
  18.         {
  19.             int[] array = { 1,1,1,1,1, 5, 6, 846,1,1,1,111, 324, 3, 4, 6, 6, };
  20.             int result = CountNumberInArray.CountNumber(array, 1);
  21.             Assert.AreEqual(8, result);
  22.         }
  23.         [TestMethod]
  24.         public void TestMethod3()
  25.         {
  26.             int[] array = { 1, 5, 6, 846, 324, 3, 4, 6, 6,123213,2131231,34535 };
  27.             int result = CountNumberInArray.CountNumber(array, 1323);
  28.             Assert.AreEqual(0, result);
  29.         }
  30.         [TestMethod]
  31.         public void TestMethod4()
  32.         {
  33.             int[] array = {0, 1, 5, 6, 846, 324, 3, 4, 6, 6, 0};
  34.             int result = CountNumberInArray.CountNumber(array, 0);
  35.             Assert.AreEqual(2, result);
  36.         }
  37.         [TestMethod]
  38.         public void TestMethod5()
  39.         {
  40.             int[] array = { 1, 5, 6, 846, 324, 3, 4, 6, 6, };
  41.             int result = CountNumberInArray.CountNumber(array, 324);
  42.             Assert.AreEqual(1, result);
  43.         }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement