public async Task SameFileTest() { var service = MockContainer.GetExportedValue <ICompareService>(); MockCompareConfigDocumentType.Setup(x => x.Read(It.IsAny <string>())).Returns(new CompareConfigDocument()); MockReadFileService.Setup(x => x.GetJsonDocument(It.IsAny <string>(), It.IsAny <CompareConfigDocument>())) .Callback((string path, CompareConfigDocument config) => { Assert.IsTrue(path.StartsWith(Path.Combine(COMPAREPATH_SAME, PATH1)) || path.StartsWith(Path.Combine(COMPAREPATH_SAME, PATH2))); Assert.IsNotNull(config); }) .ReturnsAsync((string path, CompareConfigDocument config) => new JsonDocument(path, new List <KeyValuePair <string, FieldType> >())); MockAnalyzeService.Setup(x => x.Compare(It.IsAny <JsonDocument>(), It.IsAny <JsonDocument>())) .Callback((JsonDocument document1, JsonDocument document2) => { Assert.IsNotNull(document1); Assert.IsNotNull(document2); }) .ReturnsAsync((JsonDocument document1, JsonDocument document2) => new CompareFile("article", new List <CompareItem>())); var calledCount_SplitObjectInObject = 0; var progress = new Progress <IProgressReport>(report => { Assert.AreEqual(1, report.Total); Assert.AreEqual(calledCount_SplitObjectInObject++, report.Current); }); var result = await service.Compare(Path.Combine(COMPAREPATH_SAME, PATH1), Path.Combine(COMPAREPATH_SAME, PATH2), "configFile"); Assert.IsNotNull(result); Assert.AreEqual(1, result.Count); Assert.AreEqual("article", result[0].FileName); }
public void TestCleanup() { MockCompareConfigDocumentType.Reset(); MockReadFileService.Reset(); MockAnalyzeService.Reset(); }