Пример #1
0
        public void ComparerTest_FirstObservationIsNull_ResultIsMinus1()
        {
            // Arange
            var sut        = new ObservationPointComparer <IEnergyObservation>();
            var energyMock = new Mock <IEnergyObservation>();

            // Act
            var actualResult = sut.Compare(null, energyMock.Object);

            // Assert
            Assert.Equal(-1, actualResult);
        }
Пример #2
0
        public void ComparerTest_SecondObservationIsNull_ResultIs1()
        {
            // Arange
            var sut        = new ObservationPointComparer <IEnergyObservation>();
            var energyMock = new Mock <IEnergyObservation>();

            // Act
            var actualResult = sut.Compare(energyMock.Object, null);

            // Assert
            Assert.Equal(1, actualResult);
        }
Пример #3
0
        public void ComparerTest_ObservationReferencesAreEqual_ResultIs0()
        {
            // Arange
            var sut         = new ObservationPointComparer <IEnergyObservation>();
            var energyMock1 = new Mock <IEnergyObservation>();
            var energyMock2 = energyMock1;

            // Act
            var actualResult = sut.Compare(energyMock1.Object, energyMock2.Object);

            // Assert
            Assert.Equal(0, actualResult);
        }
Пример #4
0
        public void CompareTest_PassTwoEnergyObservation_Return1OrMinus1Or0
            (double xCoordinate1, double yCoordinate1,
            double xCoordinate2, double yCoordinate2, int expectedResult)
        {
            // Arange
            var sut         = new ObservationPointComparer <IEnergyObservation>();
            var energyMock1 = GetEnergyObservationMock(xCoordinate1, yCoordinate1);
            var energyMock2 = GetEnergyObservationMock(xCoordinate2, yCoordinate2);


            // Act
            var actualResult = sut.Compare(energyMock1.Object, energyMock2.Object);

            // Assert
            Assert.Equal(expectedResult, actualResult);
        }
Пример #5
0
        public void CompareTest_FirstAndSecondIEnergyObservations_CorrectComparisonIsMade(IEnergyObservation first, IEnergyObservation second, int expected)
        {
            int actual = _observationPointComparer.Compare(first, second);

            Assert.Equal(expected, actual);
        }