public void Test1() { ArrayProcessor arrayProcessor = new ArrayProcessor(); int[] testArray = { -10000, 10, 0, 1000, 1000, 5544, -5000, 3322, 7777, 2222, 9999, 120000 }; // делаем копию массива что передаем, чтобы убедится что после работы программы исходный - не затрагивали int[] testArrayCopy = new int[testArray.Length]; Array.Copy(testArray, testArrayCopy, testArray.Length); int[] result = arrayProcessor.SortAndFilter(testArray); Assert.Multiple(() => { Assert.AreEqual(testArray, testArrayCopy); Assert.That(result, Is.Ordered); Assert.That(result, Has.All.InRange(1000, 9999)); }); testArray = new int[0]; result = arrayProcessor.SortAndFilter(testArray); Assert.AreEqual(testArray, result); testArray = new int[] { 1000, 1000, 1000 }; result = arrayProcessor.SortAndFilter(testArray); Assert.AreEqual(testArray, result); testArray = null; Assert.Throws <ArgumentNullException>(() => arrayProcessor.SortAndFilter(testArray)); Assert.Pass(); }
public void TestSortAndFilter(int[] @in, int[] @out) { int[] result = _processor.SortAndFilter(@in); Assert.That(result, Is.Not.SameAs(@in)); CollectionAssert.IsOrdered(result); CollectionAssert.AreEqual(result, @out); }
public void Test_elements_Array() { ArrayProcessor array = new ArrayProcessor(); int[] X = { -5, -2, -2, -2, -8, -5, 10, 11, 11, 45 }; int[] B = { -5, -2, -8, 10, 11, 45 }; int a = array.SortAndFilter(X).Length; int[] Y = new int[a]; Y = array.SortAndFilter(X); Array.Sort(B); CollectionAssert.AreEquivalent(B, Y); }
public void NunitTestArraysortanddel() { var res_arr = _setarray.SortAndFilter(new int[] { -4, -4, 0, -3, -5, -3, 2, 1, 4, 7, 5, 6, 8, 9, 9 }); int[] b; b = new int[] { -5, -4, -3, 0, 1, 2, 4, 5, 6, 7, 8, 9, 9 }; CollectionAssert.AreEqual(res_arr, b); }
public void IsOrdered() { ArrayProcessor processor = new ArrayProcessor(); double[] array = new double[] { 7, 5, 123, -50 }; double[] newArray = processor.SortAndFilter(array); CollectionAssert.IsOrdered(newArray); }
public void NoNegatives() { ArrayProcessor processor = new ArrayProcessor(); double[] array = new double[] { 7, 5, 123, -50 }; double[] newArray = processor.SortAndFilter(array); Assert.Throws <InvalidOperationException>(() => newArray.First(item => item < 0)); }
public void SortTest() { double[] a = { 0, 3, 7, 1 }; double[] expected = { 7, 3, 1, 0 }; ArrayProcessor arr = new ArrayProcessor(); double[] actual = arr.SortAndFilter(a); CollectionAssert.AreEqual(expected, actual); }
public void AllConditionsTest() { double[] a = { 1, -1, 2, 3, 2, 73, 6, 2 }; double[] expected = { 73, 6, 3, 2, 1 }; ArrayProcessor arr = new ArrayProcessor(); double[] actual = arr.SortAndFilter(a); CollectionAssert.AreEqual(expected, actual); }
public void Delete_repeating_elements() { int[] X = { -5, -5, -5, -5, -5 }; int[] Y = new int[X.Length]; ArrayProcessor array = new ArrayProcessor(); Y = array.SortAndFilter(X); Assert.AreEqual(-5, Y[0]); }
public void ReplacingNegativeNumbersTest() { double[] a = { -76, -3, -1 }; double[] expected = { 76, 3, 1 }; ArrayProcessor arr = new ArrayProcessor(); double[] actual = arr.SortAndFilter(a); CollectionAssert.AreEqual(expected, actual); }
public void Sort_elements() { int[] X = { -5, -2, -8, 10, 11, 45 }; int[] Y = new int[X.Length]; ArrayProcessor array = new ArrayProcessor(); Y = array.SortAndFilter(X); Array.Sort(X); CollectionAssert.AreEqual(X, Y); }
public void NoDuplicates() { ArrayProcessor processor = new ArrayProcessor(); double[] array = new double[] { 7, 5, 123, -50 }; double[] newArray = processor.SortAndFilter(array); CollectionAssert.AllItemsAreUnique(newArray); }
public void SortAndFilter_originArr_originArrNotChange_() { int[] ororiginArr = new int[] { 0, -2, -5, -7, 9, -7, 12, -5, 4, 44, -2, 8 }; int[] actualArr = new int[] { 0, -2, -5, -7, 9, -7, 12, -5, 4, 44, -2, 8 }; ArrayProcessor arrProc = new ArrayProcessor(); int[] resultArr = arrProc.SortAndFilter(ororiginArr); CollectionAssert.AreEqual(ororiginArr, actualArr); }
public void THeOriginalOneShouldRemainTheSame() { ArrayProcessor processor = new ArrayProcessor(); double[] array = new double[] { 7, 5, 123, -50 }; double[] copy = new double[] { 7, 5, 123, -50 }; double[] newArray = processor.SortAndFilter(array); CollectionAssert.AreEqual(array, copy); }
public void SortAndFilter_originArr_ArrFilteredAndSorted_() { int[] ororiginArr = new int[] { 0, -2, -5, -7, 9, -7, 12, -5, 4, 44, -2, 8 }; int[] expectedArr = new int[] { -7, -5, -2, 0, 4, 8, 9, 12, 44 }; ArrayProcessor arrProc = new ArrayProcessor(); int[] resultArr = arrProc.SortAndFilter(ororiginArr); CollectionAssert.AreEqual(resultArr, expectedArr); }
public void CanSortAndFilterArrayMSUnit() { //Arrange ArrayProcessor ap2 = new ArrayProcessor(); int[] tmp = { -10, 9, 9, 8, -3, -10, 4, 5, 1 }; int[] fin = { -10, -3, 1, 4, 5, 8, 9, 9 }; //Act tmp = ap2.SortAndFilter(tmp); //Assert //Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreEqual(fin, tmp); }
public void CanSortAndFilterArrayAssertCollection() { //Arrange ArrayProcessor ap = new ArrayProcessor(); int[] tmp = { -3, -10, 9, 9, 8, -3, -10, 4, 5, 1 }; int[] fin = { -10, -3, 1, 4, 5, 8, 9, 9 }; //Act tmp = ap.SortAndFilter(tmp); //Assert NUnit.Framework.CollectionAssert.AreEqual(fin, tmp); }
public void testArrayProccessor() { //arange int[] actual = { -8, 5443, -20, 4559, 0, -20, 2, -1323, 10000, -1323 }; int[] excepting = { -1323, -20, -8, 0, 2, 4559, 5443, 10000 }; //act ArrayProcessor arrProc = new ArrayProcessor(); int[] result = arrProc.SortAndFilter(actual); //assert CollectionAssert.AreEqual(excepting, result); }
public void testSameArray() { int[] actual = { -8, 5443, -20, 4559, 0, -20, 2, -1323, 10000, -1323 }; int[] excepting = { -8, 5443, -20, 4559, 0, -20, 2, -1323, 10000, -1323 }; //act ArrayProcessor arrProc = new ArrayProcessor(); int[] result = arrProc.SortAndFilter(actual); //assert //Проверяем, то оригинальный массив не меняется CollectionAssert.AreEqual(excepting, actual); }
public void SortAndFilter_NegativeUnsorted_PositiveSorted() { double[] a = { 10, -5, 3, -8, 0 }; double[] b = { 10, 5, 3, 8, 0 }; CollectionAssert.AreEquivalent(array.SortAndFilter(a), b); }
public void CollSortedTest() { CollectionAssert.IsOrdered(arrayProcessor.SortAndFilter(new int[] { 1, 2, 4444, 333, 5457, -10, -140, -4545, -777, 0, 55 })); }
public void ThrowsWIthNull() { ArrayProcessor processor = new ArrayProcessor(); Assert.Throws <ArgumentNullException>(() => processor.SortAndFilter(null)); }
public void TestPosition(int[] expectedResult, int[] obtainedResult) { ArrayProcessor arrayProcessor = new ArrayProcessor(); CollectionAssert.AreEqual(expectedResult, arrayProcessor.SortAndFilter(obtainedResult)); }