Пример #1
0
        public void ComparerByRating_Compare_BarsBothNull()
        {
            // Arrange
            var comparer = new ComparerByRating();

            // Act && Assert
            Assert.Throws <ArgumentNullException>(() => comparer.Compare(null, null));
        }
Пример #2
0
        public void ComparerByRating_Compare_BarsSecondNull()
        {
            // Arrange
            var barData1 = new BarData();
            var comparer = new ComparerByRating();

            // Act && Assert
            Assert.Throws <ArgumentNullException>(() => comparer.Compare(barData1, null));
        }
Пример #3
0
        public void ComparerByRating_Compare_BarsFirstNull()
        {
            // Arrange
            var barData2 = new BarData();
            var comparer = new ComparerByRating();

            // Act && Assert
            Assert.Throws <ArgumentNullException>(() => comparer.Compare(null, barData2));
        }
        public void ComparerByRating_BarsBothNull()
        {
            // arrange
            var comparer = new ComparerByRating();

            // act
            var result = comparer.Compare(null, null);

            // assert
        }
        public void ComparerByRating_BarsSecondNull()
        {
            // arrange
            BarData barData1 = new BarData();
            var     comparer = new ComparerByRating();

            // act
            var result = comparer.Compare(barData1, null);

            // assert
        }
        public void ComparerByRating_BarsFirstNull()
        {
            // arrange
            BarData barData2 = new BarData();
            var     comparer = new ComparerByRating();

            // act
            var result = comparer.Compare(null, barData2);

            // assert
        }
Пример #7
0
        public void ComparerByRating_Compare_RatingsFirstNullSecondNotNull()
        {
            // Arrange
            var barData1 = new BarData {
                Ratings = null
            };
            var barData2 = new BarData {
                Ratings = new List <int>()
            };;
            var expectedResult = -1;
            var comparer       = new ComparerByRating();

            // Act
            var result = comparer.Compare(barData1, barData2);

            // Assert
            Assert.AreEqual(expectedResult, result);
        }
Пример #8
0
        public void ComparerByRating_Compare_RatingsBothNull()
        {
            // Arrange
            var barData1 = new BarData {
                Ratings = null
            };
            var barData2 = new BarData {
                Ratings = null
            };;
            var expectedResult = 0;
            var comparer       = new ComparerByRating();

            // Act
            var result = comparer.Compare(barData1, barData2);

            // Assert
            Assert.AreEqual(expectedResult, result);
        }
Пример #9
0
        public void ComparerByRating_Compare_RatingsEqual()
        {
            // Arrange
            var newRatings = new List <int> {
                10, 20
            };
            var barData1 = new BarData {
                Ratings = newRatings
            };
            var barData2 = new BarData {
                Ratings = newRatings
            };
            var expectedResult = 0;
            var comparer       = new ComparerByRating();

            // Act
            var result = comparer.Compare(barData1, barData2);

            // Assert
            Assert.AreEqual(expectedResult, result);
        }
        public void ComparerByRating_RatingsFirstSmaller()
        {
            // arrange
            var barData1 = new BarData {
                Ratings = new List <int>()
            };

            barData1.Ratings.Add(5);
            barData1.Ratings.Add(10);
            var barData2 = new BarData {
                Ratings = new List <int>()
            };

            barData2.Ratings.Add(10);
            barData2.Ratings.Add(20);
            var expectedResult = -1;
            var comparer       = new ComparerByRating();

            // act
            var result = comparer.Compare(barData1, barData2);

            // assert
            Assert.AreEqual(expectedResult, result);
        }