コード例 #1
0
ファイル: Correctness.cs プロジェクト: DeadlyEmbrace/effort
        public bool Check()
        {
            IEqualityComparer<IResultSet> comparer = null;

            if (this.ordered)
            {
                comparer = new OrderedResultSetComparer();
            }
            else
            {
                comparer = new ResultSetComparer();
            }

            return comparer.Equals(this.Expected, this.Actual);
        }
コード例 #2
0
        public void ToTableTest()
        {
            DataTable _personInfoView = TestTable.Clone();
            DataTable _expected       = TestTable.Clone();

            for (Int16 i = 18; i < 28; i++)
            {
                DataRow _person = _expected.NewRow();
                _person["Name"] = "YanZhiwei" + i;
                _person["Age"]  = i;
                _expected.Rows.Add(_person);
            }

            DataTable _actual = CSVHelper.ToTable(@"D:\person.csv", Encoding.Default, 1);

            Assert.IsTrue(ResultSetComparer.AreIdenticalResultSets(_expected, _actual));
        }
コード例 #3
0
        public void Compare_DifferentLargeArrays_ReturnQuicklyDifferent(int count, int timeout)
        {
            //Buiding object used during test
            var comparer  = new ResultSetComparer(BuildSettingsKeyValue());
            var reference = BuildDataTable(RandomLargeArrayString(count, 0), RandomLargeArrayDouble(count));
            var actual    = BuildDataTable(RandomLargeArrayString(count, Convert.ToInt32(count * 0.8)), RandomLargeArrayDouble(count));

            Console.WriteLine("Starting comparaison for {0} rows", count);
            var stopWatch = new Stopwatch();

            stopWatch.Start();
            //Call the method to test
            var res = comparer.Compare(reference, actual);

            stopWatch.Stop();
            Console.WriteLine("Compaired in {0} milliseconds", stopWatch.Elapsed.TotalMilliseconds);
            //Assertion
            Assert.That(res, Is.EqualTo(ResultSetCompareResult.NotMatching));
            Assert.That(stopWatch.Elapsed, Is.LessThan(new TimeSpan(0, 0, timeout)));
        }