public void TestWithDeleteNoM2M() { List <string> entToDel = new List <string>() { "test", "test1" }; Guid id = Guid.NewGuid(); Guid exId = Guid.NewGuid(); Mock <IEntityRepository> entRepoMock = new Mock <IEntityRepository>(); entRepoMock.Setup(p => p.GetEntitiesByName("test", It.IsAny <string[]>(), It.IsAny <int>())).Returns(new List <Entity> { new Entity("test", id), new Entity("test", exId), new Entity("test", Guid.NewGuid()) }); IEntityRepository entRepo = entRepoMock.Object; SyncEntitiesProcessor entProc = new SyncEntitiesProcessor(entToDel, entRepo, new ConsoleLogger()); entProc.ImportStarted(); Entity ent = new Entity("test", id); EntityWrapper entWrap = new EntityWrapper(ent); entProc.ProcessEntity(entWrap, 3, 3); entProc.ImportCompleted(); entRepoMock.Verify(p => p.GetEntitiesByName("test", It.IsAny <string[]>(), It.IsAny <int>()), Times.Exactly(1)); entRepoMock.Verify(p => p.DeleteEntity("test", exId), Times.Exactly(1)); Assert.AreEqual(entWrap.OperationType, OperationType.Ignore); }
public void ImportStarted() { systemUnderTest = new SyncEntitiesProcessor(entitiesToSync, MockEntityRepo.Object, MockLogger.Object); FluentActions.Invoking(() => systemUnderTest.ImportStarted()) .Should() .NotThrow(); }