public void Compare_WhenSameObject_ShouldReturnEquals() { //Arrange var base64 = BuildSmallBase64(); var id = 1; //mocking left side var mockDiffLeftRepository = MockDiffLeft(base64, id); //mocking right side var mockDiffRightRepository = MockDiffRight(base64, id); var differenceService = new DifferenceService(mockDiffLeftRepository.Object, mockDiffRightRepository.Object); //Act var result = differenceService.Compare(id); //Assert Assert.Equal("EQUAL", result.Status); }
public void Compare_WhenDifferentSize_ShouldReturnDifferentSize() { //Arrange var smallBase64 = BuildSmallBase64(); var biggerBase64 = BuildBiggerBase64(); var id = 1; //mocking left side var mockDiffLeftRepository = MockDiffLeft(smallBase64, id); //mocking right side var mockDiffRightRepository = MockDiffRight(biggerBase64, id); var differenceService = new DifferenceService(mockDiffLeftRepository.Object, mockDiffRightRepository.Object); //Act var result = differenceService.Compare(id); //Assert Assert.Equal("DIFFERENT_SIZES", result.Status); }
public void Compare_WhenSameSizeButOneDifference_ShouldReturnInsights() { //Arrange var smallBase64 = BuildSmallBase64(); var differentBase64 = BuildSmallWithOneDifferenceBase64(); //var smallBase64 = "asdfghjkl"; //var differentBase64 = "asderhjkl"; var id = 1; //mocking left side var mockDiffLeftRepository = MockDiffLeft(smallBase64, id); //mocking right side var mockDiffRightRepository = MockDiffRight(differentBase64, id); var differenceService = new DifferenceService(mockDiffLeftRepository.Object, mockDiffRightRepository.Object); //Act var result = differenceService.Compare(id); //Assert Assert.Equal("SAME_SIZE_BUT_DIFFERENT_DATA", result.Status); Assert.Equal(1, result.Insights.Count); Assert.Equal(298, result.Insights.FirstOrDefault().Offset); Assert.Equal(1, result.Insights.FirstOrDefault().Lenght); }