Ejemplo n.º 1
0
        public void When_GettingDiff_Should_ReturnResultFromDataComparisonService()
        {
            var expectedResult = new ComparisonResult(ComparisonState.Equal);
            var serviceMock = new Mock<IDataComparisonService>(MockBehavior.Strict);
            serviceMock.Setup(x => x.Compare()).Returns(expectedResult).Verifiable();
            var controller = new DiffController(serviceMock.Object);

            var result = controller.GetDiff();

            Assert.Equal(expectedResult, result);
            serviceMock.VerifyAll();
        }
        public void When_Comparing_Should_ReturnGetDataComparisonItem()
        {
            var expectedResult = new ComparisonResult(ComparisonState.Equal);
            var comparisonItemMock = new Mock<DataComparisonItem>(MockBehavior.Strict);
            comparisonItemMock.Setup(x => x.Compare()).Returns(expectedResult).Verifiable();

            var repositoryMock = new Mock<IDataComparisonRepository>(MockBehavior.Strict);
            repositoryMock.Setup(x => x.Get()).Returns(comparisonItemMock.Object).Verifiable();
            var dataComparisonService = new DataComparisonService(repositoryMock.Object);

            var result = dataComparisonService.Compare();

            Assert.Equal(expectedResult, result);
            comparisonItemMock.Verify();
            repositoryMock.Verify();
        }