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();
        }
        public void ProcessEntity()
        {
            systemUnderTest = new SyncEntitiesProcessor(entitiesToSync, MockEntityRepo.Object, MockLogger.Object);

            var entity        = new EntityWrapper(new Entity("contact", Guid.NewGuid()));
            int passNumber    = 1;
            int maxPassNumber = 1;

            FluentActions.Invoking(() => systemUnderTest.ProcessEntity(entity, passNumber, maxPassNumber))
            .Should()
            .NotThrow();
        }
        public void ImportCompleted()
        {
            systemUnderTest = new SyncEntitiesProcessor(entitiesToSync, MockEntityRepo.Object, MockLogger.Object);

            var entity          = new EntityWrapper(new Entity("contact", Guid.NewGuid()));
            var currentEntities = new List <Entity> {
                new Entity("account", Guid.NewGuid())
            };

            MockEntityRepo.Setup(a => a.GetEntitiesByName(It.IsAny <string>(), It.IsAny <string[]>(), It.IsAny <int>()))
            .Returns(currentEntities);

            systemUnderTest.ProcessEntity(entity, 1, 1);
            systemUnderTest.ProcessEntity(new EntityWrapper(new Entity("contact", Guid.NewGuid())), 1, 1);
            systemUnderTest.ProcessEntity(new EntityWrapper(new Entity("account", Guid.NewGuid())), 1, 1);
            systemUnderTest.ProcessEntity(new EntityWrapper(new Entity("opportunity", Guid.NewGuid())), 1, 1);

            FluentActions.Invoking(() => systemUnderTest.ImportCompleted())
            .Should()
            .NotThrow();
        }