public void getSmallestRecord_ListContainsOnlyNullRecords_ComparerShouldThrowException()
        {
            var comparer = new MinRecordValueComparer();

            comparer.AddRecordToComparison(Record.NullRecord, false);
            comparer.AddRecordToComparison(Record.NullRecord, false);
            comparer.AddRecordToComparison(Record.NullRecord, false);

            Assert.Throws <Exception>(() => comparer.GetIndexOfSmallest());
        }
        public void getSmallestRecord_ListOnlyContainsRecordsFromEndedSeries_ShouldThrowException()
        {
            var comparer = new MinRecordValueComparer();

            comparer.AddRecordToComparison(new Record(new double[] { 5 }), true);
            comparer.AddRecordToComparison(new Record(new double[] { 4 }), true);
            comparer.AddRecordToComparison(new Record(new double[] { 3 }), true);
            comparer.AddRecordToComparison(new Record(new double[] { 2 }), true);

            Assert.Throws <Exception>(() => comparer.GetIndexOfSmallest());
        }
        public void getSmallestRecord_ListContainsValuesFromEndedSeries_ComparerShouldIgnoreValuesFromEndedSeries()
        {
            var comparer = new MinRecordValueComparer();

            comparer.AddRecordToComparison(new Record(new double[] { 5 }), false);
            comparer.AddRecordToComparison(new Record(new double[] { 4 }), false);
            comparer.AddRecordToComparison(new Record(new double[] { 3 }), false);
            comparer.AddRecordToComparison(new Record(new double[] { 2 }), true);
            var expectedIndex          = 2;
            var expectedSmallestRecord = new Record(new double[] { 3 });

            Assert.AreEqual(expectedIndex, comparer.GetIndexOfSmallest());
            Assert.AreEqual(expectedSmallestRecord, comparer.SmallestRecord);
        }
        public void getSmallestRecordAndIndex_ListContainsOnlyNullAndDummyRecords_FirstDummyRecordShouldBeSmallest()
        {
            var expectedSmallestRecord = Record.Dummy;
            var expectedIndex          = 2;
            var comparer = new MinRecordValueComparer();

            comparer.AddRecordToComparison(Record.NullRecord, false);
            comparer.AddRecordToComparison(Record.NullRecord, false);
            comparer.AddRecordToComparison(expectedSmallestRecord, false);
            comparer.AddRecordToComparison(Record.Dummy, false);
            comparer.AddRecordToComparison(Record.NullRecord, false);
            comparer.AddRecordToComparison(Record.Dummy, false);
            comparer.AddRecordToComparison(Record.NullRecord, false);

            var actualIndex          = comparer.GetIndexOfSmallest();
            var actualSmallestRecord = comparer.SmallestRecord;

            Assert.AreEqual(expectedIndex, actualIndex);
            Assert.AreEqual(expectedSmallestRecord, actualSmallestRecord);
        }
        public void getSmallestRecordAndIndex_ListContainsNullRecords_NullRecordsShouldBeIgnored()
        {
            IRecord expectedSmallestRecord = new Record(new double[] { 10000 });
            var     expectedIndex          = 4;
            var     comparer = new MinRecordValueComparer();

            comparer.AddRecordToComparison(Record.NullRecord, false);
            comparer.AddRecordToComparison(Record.NullRecord, false);
            comparer.AddRecordToComparison(Record.NullRecord, false);
            comparer.AddRecordToComparison(Record.NullRecord, false);
            comparer.AddRecordToComparison(expectedSmallestRecord, false);
            comparer.AddRecordToComparison(Record.NullRecord, false);

            var actualIndex          = comparer.GetIndexOfSmallest();
            var actualSmallestRecord = comparer.SmallestRecord;

            Assert.AreEqual(expectedIndex, actualIndex);
            Assert.AreEqual(expectedSmallestRecord, actualSmallestRecord);
        }
        public void getSmallestRecordAndIndex_UsingComparisonListMethod()
        {
            IRecord expectedSmallestRecord = Record.Min;
            var     expectedIndex          = 4;
            var     comparer = new MinRecordValueComparer();

            comparer.AddRecordToComparison(new Record(new double[] { 5 }), false);
            comparer.AddRecordToComparison(new Record(new double[] { 4 }), false);
            comparer.AddRecordToComparison(new Record(new double[] { 3 }), false);
            comparer.AddRecordToComparison(new Record(new double[] { 2 }), false);
            comparer.AddRecordToComparison(expectedSmallestRecord, false);
            comparer.AddRecordToComparison(new Record(new double[] { 1 }), false);

            var actualIndex          = comparer.GetIndexOfSmallest();
            var actualSmallestRecord = comparer.SmallestRecord;

            Assert.AreEqual(expectedIndex, actualIndex);
            Assert.AreEqual(expectedSmallestRecord, actualSmallestRecord);
        }