public void Sync_Test() { using (var context = new AcManContext(OptionsRandom)) { //MsSql2016Options var userId = TestDemoData.CreateTestData(context); var bpm = DemoTS_ODBase; //MsSqlMKODBase var userRepository = new UserRepository(context); var activityRepository = new ActivityRepository(context); var synchronizationRepository = new SynchronizationRepository(context); var bpmOdataConverter = new BpmOdataConverter(); var activityBpmOdataRepository = new ActivityBpmOdataRepository(bpm, bpmOdataConverter); var bpmonlineSyncStrategy = new BpmonlineSyncStrategy( userRepository, activityRepository, synchronizationRepository, activityBpmOdataRepository ); var startCount = activityRepository.GetAll().Count; var remoteActivity = new Activity { UserId = userId, Caption = "[Acman] Test remote activity " + AcmanHelper.GetCurrentDateTime().ToString() }; remoteActivity.EndSystemRecordId = activityBpmOdataRepository.Add(remoteActivity); bpmonlineSyncStrategy.Sync(); var endCount = activityRepository.GetAll().Count; Assert.IsTrue(endCount > startCount); activityBpmOdataRepository.Remove(remoteActivity); } }
public void SyncAcmanActivity(Activity activity) { if (activity.EndSystemRecordId == null) { Guid endSystemRecordId = _activityBpmOdataRepository.Add(activity); activity.EndSystemRecordId = endSystemRecordId; } else { _activityBpmOdataRepository.Edit(activity); } _activityRepository.Edit(activity); }