public Session(SessionParameters sessionParameter, TransmissionWord transmissionWord, int currentRoundIndex) { bool validCurrentRoundIndex = currentRoundIndex >= 0 && currentRoundIndex < sessionParameter.RoundCount; Debug.Assert(validCurrentRoundIndex, string.Format("Tried to construct a session with invalid currentRoundIndex {0}", currentRoundIndex)); if (!validCurrentRoundIndex) { return; } m_sessionParameter = sessionParameter; m_TransmissionWord = transmissionWord; m_SyllableChoiceArray = new ICryptoSyllable[sessionParameter.SyllableChoiceAmount]; m_SyllableSearchArray = new ICryptoSyllable[sessionParameter.SyllableSearchedAmount]; // Create transmission flow from parameter SessionParameters sp = m_sessionParameter; m_TransmissionSetup = TransmissionManager.BuildTransmissionSetup(sp.Seed, sp.RoundCount, sp.SyllableSearchedAmount, sp.SyllableChoiceAmount); // Set the active round index to the first entry ActiveRoundIndex = currentRoundIndex; // Start the first round SetRound(ActiveRoundIndex); }
public void ConstructorTakesTransmissionManager() { var manager = new TransmissionManager(); var agg = new ActivityListenerAggregator(Mock.Of <IActivityListener>(), manager); Assert.That(agg.TransmissionManager, Is.EqualTo(manager)); }
private void SetUpMocks() { this.newParentPath = Path.Combine(Path.GetTempPath(), this.newParentName); this.newPath = Path.Combine(this.newParentPath, this.newName); this.manager = new TransmissionManager(); this.session = new Mock <ISession>(); this.session.SetupTypeSystem(); this.storage = new Mock <IMetaDataStorage>(); var newParentObj = new MappedObject( this.newParentName, this.newParentId, MappedObjectType.Folder, null, this.changeToken) { Guid = this.newParentUuid }; this.storage.AddMappedFolder(newParentObj); this.fsFactory = new Mock <IFileSystemInfoFactory>(); this.changeSolver = new Mock <LocalObjectChangedRemoteObjectChanged>( this.session.Object, this.storage.Object, null, this.manager, this.fsFactory.Object); this.renameSolver = new Mock <LocalObjectRenamedRemoteObjectRenamed>( this.session.Object, this.storage.Object, this.changeSolver.Object); this.session.AddRemoteObjects(Mock.Of <IFolder>(o => o.Id == this.oldParentId), Mock.Of <IFolder>(o => o.Id == this.newParentId)); this.underTest = new LocalObjectMovedRemoteObjectRenamed(this.session.Object, this.storage.Object, this.changeSolver.Object, this.renameSolver.Object); }
public void ParentFolderDoesNotExistsOnServerDueToPastErrorThrowsException() { this.SetUpMocks(true); string path = Path.Combine(Path.GetTempPath(), this.localObjectName); this.session.Setup(s => s.CreateDocument( It.Is <IDictionary <string, object> >(p => (string)p["cmis:name"] == this.localObjectName), It.Is <IObjectId>(o => o.Id == this.parentId), It.IsAny <IContentStream>(), null, null, null, null)).Throws(new CmisPermissionDeniedException()); Mock <IFileInfo> fileInfo = new Mock <IFileInfo>(); fileInfo.Setup(f => f.Length).Returns(0); var parentDirInfo = new Mock <IDirectoryInfo>(); fileInfo.Setup(d => d.FullName).Returns(path); fileInfo.Setup(d => d.Name).Returns(this.localObjectName); fileInfo.Setup(d => d.Exists).Returns(true); fileInfo.Setup(d => d.IsExtendedAttributeAvailable()).Returns(this.withExtendedAttributes); fileInfo.Setup(d => d.Directory).Returns(parentDirInfo.Object); var transmissionManager = new TransmissionManager(); var solver = new LocalObjectAdded(this.session.Object, this.storage.Object, this.transmissionStorage.Object, transmissionManager); Assert.Throws <ArgumentException>(() => solver.Solve(fileInfo.Object, null)); this.storage.VerifyThatNoObjectIsManipulated(); }
public bool Initialize() { try { TransmissionManager.StartUpWSA(); _securityProvider = new SecurityProvider(); _securityProvider.NewItem(); _ashley = Ashley.CreateEntityProtocol(); _server = new AppServer(); BiuIoManager.Instance.NewHandler(NetDebugLogTransmissionManager.Handler_DebugN1, NetDebugLogTransmissionManager.ID_N1, 0, 0); //BiuIoManager.Instance.NewHandler(NetDebugLogTransmissionManager.Handler_DebugN1_Data, NetDebugLogTransmissionManager.ID_N1, 0, 0); _actionTable.Add(NetDebugLogTransmissionManager.Handler_DebugN1) .AddRow((ulong)BiuAction.Accept, IOOperation.Read) .AddRow((ulong)BiuAction.PublicKey, DebugN1_PublicKey); return(true); } catch { throw; } }
public void ListedTransmissionIsEqualToAdded() { var underTest = new TransmissionManager(); var trans = underTest.CreateTransmission(TransmissionType.DOWNLOAD_NEW_FILE, "path"); Assert.That(underTest.ActiveTransmissions[0], Is.EqualTo(trans)); Assert.That(underTest.ActiveTransmissionsAsList()[0], Is.EqualTo(trans)); }
public void CreatingASingleTransmissionIncreasesListCountByOne() { var underTest = new TransmissionManager(); underTest.CreateTransmission(TransmissionType.DOWNLOAD_NEW_FILE, "path"); Assert.That(underTest.ActiveTransmissions.Count, Is.EqualTo(1)); }
private void InitMocks(bool dateSyncEnabled = true) { this.session = new Mock <ISession>(); this.session.SetupTypeSystem(); this.storage = new Mock <IMetaDataStorage>(); this.manager = new TransmissionManager(); this.underTest = new LocalObjectChangedRemoteObjectChanged(this.session.Object, this.storage.Object, null, this.manager); }
private void InitializeInput() { playerController = GetComponent <SatellitePlayerController>(); inputManager = GetComponent <SatelliteInputManager>(); transmissionManager = GameObject.FindGameObjectWithTag(("TransmissionManager")).GetComponent <TransmissionManager>(); }
public void CreatingTwoTransmissionProducesTwoEntriesInList() { var underTest = new TransmissionManager(); underTest.CreateTransmission(TransmissionType.DOWNLOAD_NEW_FILE, "path"); underTest.CreateTransmission(TransmissionType.DOWNLOAD_NEW_FILE, "path2"); Assert.That(underTest.ActiveTransmissions.Count, Is.EqualTo(2)); }
public void AnAbortedTransmissionIsRemovedFromList() { var underTest = new TransmissionManager(); var trans = underTest.CreateTransmission(TransmissionType.DOWNLOAD_NEW_FILE, "path"); trans.Status = TransmissionStatus.ABORTED; Assert.That(underTest.ActiveTransmissions, Is.Empty); }
public LocalObjectRenamedOrMovedRemoteObjectDeleted( ISession session, IMetaDataStorage storage, IFileTransmissionStorage transmissionStorage, TransmissionManager manager, ISolver secondSolver = null) : base(session, storage) { this.secondSolver = secondSolver ?? new LocalObjectAdded(session, storage, transmissionStorage, manager); }
/// <summary> /// The entry point of the program, where the program control starts and ends. /// </summary> /// <param name="args">The command-line arguments.</param> static void Main(string[] args) { // Only allow one instance of DataSpace Sync (on Windows) if (!programMutex.WaitOne(0, false)) { System.Console.WriteLine("DataSpaceSync is already running."); Environment.Exit(-1); } if (File.Exists(ConfigManager.CurrentConfigFile)) { ConfigMigration.Migrate(); } log4net.Config.XmlConfigurator.Configure(ConfigManager.CurrentConfig.GetLog4NetConfig()); CmisSync.Lib.Utils.EnsureNeededDependenciesAreAvailable(); if (args.Length != 0) { foreach (string arg in args) { // Check, if the user would like to read console logs if (arg.Equals("-v") || arg.Equals("--verbose")) { verbose = true; } } } // Add Console Logging if user wants to if (verbose) { BasicConfigurator.Configure(); } Logger.Info("Starting."); List <Repository> repositories = new List <Repository>(); var transmissionManager = new TransmissionManager(); foreach (RepoInfo repoInfo in ConfigManager.CurrentConfig.Folders) { string path = repoInfo.LocalPath; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } Repository repo = new Repository(repoInfo, new ActivityListenerAggregator(new ActivityListener(), transmissionManager)); repositories.Add(repo); repo.Initialize(); } while (true) { System.Threading.Thread.Sleep(100); } }
public void SetUp() { this.session = new Mock <ISession>(); this.session.SetupTypeSystem(); this.storage = new Mock <IMetaDataStorage>(); this.transmissionManager = new TransmissionManager(); this.changeSolver = new Mock <LocalObjectChangedRemoteObjectChanged>(this.session.Object, this.storage.Object, null, this.transmissionManager, Mock.Of <IFileSystemInfoFactory>()); this.renameSolver = new Mock <LocalObjectRenamedRemoteObjectRenamed>(this.session.Object, this.storage.Object, this.changeSolver.Object); }
public void SetUp() { this.manager = new TransmissionManager(); this.session = new Mock <ISession>(); this.session.SetupTypeSystem(); this.storage = new Mock <IMetaDataStorage>(); this.fsFactory = new Mock <IFileSystemInfoFactory>(); this.underTest = new RemoteObjectChanged(this.session.Object, this.storage.Object, null, this.manager, this.fsFactory.Object); }
/// <summary> /// Constructor for the general controller. /// </summary> public ControllerBase() { this.FoldersPath = ConfigManager.CurrentConfig.GetFoldersPath(); this.transmissionManager = new TransmissionManager(); this.activityListenerAggregator = new ActivityListenerAggregator(this, this.transmissionManager); this.transmissionManager.ActiveTransmissions.CollectionChanged += delegate(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { this.OnTransmissionListChanged(); }; this.FolderListChanged += delegate { new Thread(() => { lock (brandLock) { if (CheckBrand(firstCheckBrand)) { firstCheckBrand = false; return; } SetupBrand(); } }).Start(); }; this.statusAggregator.PropertyChanged += (object sender, System.ComponentModel.PropertyChangedEventArgs e) => { switch (this.statusAggregator.Status) { case SyncStatus.Idle: this.OnIdle(); break; case SyncStatus.Synchronizing: this.OnSyncing(); break; case SyncStatus.Warning: this.OnError(); break; case SyncStatus.Disconnected: this.OnDisconnected(); break; case SyncStatus.Suspend: this.OnPaused(); break; case SyncStatus.Deactivated: this.OnDeactivated(); break; default: this.OnIdle(); break; } }; }
public void SetUp() { this.path = Path.Combine(Path.GetTempPath(), this.objectName); this.manager = new TransmissionManager(); this.session = new Mock <ISession>(); this.session.SetupTypeSystem(); this.storage = new Mock <IMetaDataStorage>(); this.transmissionStorage = new Mock <IFileTransmissionStorage>(); this.fsFactory = new Mock <IFileSystemInfoFactory>(MockBehavior.Strict); this.underTest = new RemoteObjectAdded(this.session.Object, this.storage.Object, this.transmissionStorage.Object, this.manager, this.fsFactory.Object); }
private void RunSolveFileChanged(Mock <IFileInfo> fileInfo, Mock <IDocument> document, TransmissionManager transmissionManager = null) { if (transmissionManager == null) { transmissionManager = new TransmissionManager(); } var solver = new LocalObjectChanged(this.session.Object, this.storage.Object, this.transmissionStorage.Object, transmissionManager); solver.Solve(fileInfo.Object, document.Object); Assert.That(transmissionManager.ActiveTransmissions, Is.Empty); }
private Mock <IDirectoryInfo> RunSolveFolder( string folderName, string id, string parentId, string lastChangeToken, bool extendedAttributes, out Mock <IFolder> folderMock, Guid?existingGuid = null, TransmissionManager transmissionManager = null) { string path = Path.Combine(Path.GetTempPath(), folderName); var futureRemoteFolder = Mock.Of <IFolder>( f => f.Name == folderName && f.Id == id && f.ParentId == parentId && f.ChangeToken == lastChangeToken); var futureRemoteFolderId = Mock.Of <IObjectId>( o => o.Id == id); this.session.Setup(s => s.CreateFolder(It.Is <IDictionary <string, object> >(p => (string)p["cmis:name"] == folderName), It.Is <IObjectId>(o => o.Id == parentId))).Returns(futureRemoteFolderId); this.session.Setup(s => s.GetObject(It.Is <IObjectId>(o => o == futureRemoteFolderId), It.IsAny <IOperationContext>())).Returns(futureRemoteFolder); var dirInfo = new Mock <IDirectoryInfo>(); dirInfo.Setup(d => d.FullName).Returns(path); dirInfo.Setup(d => d.Name).Returns(folderName); dirInfo.Setup(d => d.Exists).Returns(true); dirInfo.Setup(d => d.IsExtendedAttributeAvailable()).Returns(extendedAttributes); if (existingGuid != null) { dirInfo.SetupGuid((Guid)existingGuid); } var parentDirInfo = this.SetupParentFolder(parentId); dirInfo.Setup(d => d.Parent).Returns(parentDirInfo); if (transmissionManager == null) { transmissionManager = new TransmissionManager(); } var solver = new LocalObjectAdded(this.session.Object, this.storage.Object, this.transmissionStorage.Object, transmissionManager); solver.Solve(dirInfo.Object, null); folderMock = Mock.Get(futureRemoteFolder); return(dirInfo); }
public void SetUp() { this.newLocalName = string.Empty; this.newRemoteName = string.Empty; this.session = new Mock <ISession>(); this.session.SetupTypeSystem(); this.storage = new Mock <IMetaDataStorage>(); this.InitializeMappedFolderOnStorage(); this.InitializeMappedFileOnStorage(); var transmissionManager = new TransmissionManager(); var fsFactory = Mock.Of <IFileSystemInfoFactory>(); this.changeSolver = new Mock <LocalObjectChangedRemoteObjectChanged>(this.session.Object, this.storage.Object, null, transmissionManager, fsFactory); this.underTest = new LocalObjectRenamedRemoteObjectRenamed(this.session.Object, this.storage.Object, this.changeSolver.Object); }
/// <summary> /// Initializes a new instance of the <see cref="CmisSync.Lib.Consumer.SituationSolver.RemoteObjectChanged"/> class. /// </summary> /// <param name="session">Cmis session.</param> /// <param name="storage">Meta data storage.</param> /// <param name="transmissonManager">Transmisson manager.</param> /// <param name="fsFactory">File System Factory.</param> public RemoteObjectChanged( ISession session, IMetaDataStorage storage, IFileTransmissionStorage transmissionStorage, TransmissionManager transmissonManager, IFileSystemInfoFactory fsFactory = null) : base(session, storage, transmissionStorage) { if (transmissonManager == null) { throw new ArgumentNullException("transmissonManager"); } this.transmissonManager = transmissonManager; this.fsFactory = fsFactory ?? new FileSystemInfoFactory(); }
private void SetUpMocks() { this.manager = new TransmissionManager(); this.session = new Mock <ISession>(); this.session.SetupTypeSystem(); this.storage = new Mock <IMetaDataStorage>(); this.fsFactory = new Mock <IFileSystemInfoFactory>(); this.changeSolver = new Mock <LocalObjectChangedRemoteObjectChanged>( this.session.Object, this.storage.Object, null, this.manager, this.fsFactory.Object); this.underTest = new LocalObjectChangedRemoteObjectMoved(this.session.Object, this.storage.Object, this.changeSolver.Object); }
/// <summary> /// Initializes a new instance of the <see cref="CmisSync.Lib.ActivityListenerAggregator"/> class. /// </summary> /// <param name="overallListener">The activity listener to which aggregated activity will be sent.</param> /// <param name="transmissionManager">Transmission manager.</param> public ActivityListenerAggregator(IActivityListener overallListener, TransmissionManager transmissionManager) { if (overallListener == null) { throw new ArgumentNullException("overallListener"); } if (transmissionManager == null) { throw new ArgumentNullException("transmissionManager"); } this.overall = overallListener; this.TransmissionManager = transmissionManager; }
public void AFinishedTransmissionFiresEvent() { var underTest = new TransmissionManager(); var trans = underTest.CreateTransmission(TransmissionType.DOWNLOAD_NEW_FILE, "path"); int eventCounter = 0; underTest.ActiveTransmissions.CollectionChanged += delegate(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { eventCounter++; Assert.That(e.NewItems, Is.Null); Assert.That(e.OldItems.Count, Is.EqualTo(1)); Assert.That(e.OldItems[0], Is.EqualTo(trans)); }; trans.Status = TransmissionStatus.FINISHED; Assert.That(eventCounter, Is.EqualTo(1)); }
private void Setup(int chunk) { this.chunkCount = chunk; this.session = new Mock <ISession>(); this.session.SetupTypeSystem(); this.fsFactory = new Mock <IFileSystemInfoFactory>(MockBehavior.Strict); this.storage = new Mock <IMetaDataStorage>(); this.transmissionStorage = new Mock <IFileTransmissionStorage>(); this.transmissionManager = new TransmissionManager(); this.transmissionStorage.Setup(f => f.SaveObject(It.IsAny <IFileTransmissionObject>())).Callback <IFileTransmissionObject>((o) => { this.transmissionStorage.Setup(f => f.GetObjectByRemoteObjectId(It.IsAny <string>())).Returns(o); }); this.transmissionStorage.Setup(f => f.RemoveObjectByRemoteObjectId(It.IsAny <string>())).Callback(() => { this.transmissionStorage.Setup(f => f.GetObjectByRemoteObjectId(It.IsAny <string>())).Returns((IFileTransmissionObject)null); }); this.parentPath = Path.GetTempPath(); this.localPath = Path.Combine(this.parentPath, this.objectName); this.fileContentOld = new byte[this.chunkCount * this.chunkSize]; this.fileContentOld[0] = 0; this.fileHashOld = SHA1.Create().ComputeHash(this.fileContentOld); this.fileContent = new byte[this.chunkCount * this.chunkSize]; this.fileContent[0] = 1; this.fileHash = SHA1.Create().ComputeHash(this.fileContent); var parentDir = Mock.Of <IDirectoryInfo>(d => d.FullName == this.parentPath && d.Name == Path.GetFileName(this.parentPath)); this.localFile = Mock.Get(Mock.Of <IFileInfo>( f => f.FullName == this.localPath && f.Name == this.objectName && f.Directory == parentDir)); this.localFileLength = 0; this.cacheFile = this.fsFactory.SetupDownloadCacheFile(); this.cacheFile.SetupAllProperties(); this.cacheFile.Setup(f => f.FullName).Returns(this.localPath + ".sync"); this.cacheFile.Setup(f => f.Name).Returns(this.objectName + ".sync"); this.cacheFile.Setup(f => f.Directory).Returns(parentDir); this.cacheFile.Setup(f => f.IsExtendedAttributeAvailable()).Returns(true); this.fsFactory.AddIFileInfo(this.cacheFile.Object); this.cacheFile.Setup(f => f.Length).Returns(() => { return(this.localFileLength); }); this.backupFile = new Mock <IFileInfo>(); }
public void ParentFolderDoesNotExistsOnServerDueToMissingAllowedActions() { this.SetUpMocks(true); string path = Path.Combine(Path.GetTempPath(), this.localObjectName); this.session.Setup(s => s.CreateDocument( It.Is <IDictionary <string, object> >(p => (string)p["cmis:name"] == this.localObjectName), It.Is <IObjectId>(o => o.Id == this.parentId), It.IsAny <IContentStream>(), null, null, null, null)).Throws(new CmisPermissionDeniedException()); Mock <IFileInfo> fileInfo = new Mock <IFileInfo>(); fileInfo.Setup(f => f.Length).Returns(0); var parentDirInfo = new Mock <IDirectoryInfo>(); var parentsParentDirInfo = new Mock <IDirectoryInfo>(); Guid parentsParentGuid = Guid.NewGuid(); string remoteParentsParentId = Guid.NewGuid().ToString(); parentsParentDirInfo.Setup(d => d.Uuid).Returns(parentsParentGuid); parentDirInfo.Setup(d => d.Parent).Returns(parentsParentDirInfo.Object); parentDirInfo.Setup(d => d.Exists).Returns(true); parentsParentDirInfo.Setup(d => d.Exists).Returns(true); var mappedFolder = Mock.Of <IMappedObject>(o => o.Guid == parentsParentGuid && o.RemoteObjectId == remoteParentsParentId); var remoteParentsParentFolder = Mock.Of <IFolder>(f => f.Id == remoteParentsParentId); Mock.Get(remoteParentsParentFolder).SetupReadOnly(); this.session.AddRemoteObject(remoteParentsParentFolder); this.storage.Setup(s => s.GetObjectByLocalPath(parentsParentDirInfo.Object)).Returns(mappedFolder); fileInfo.Setup(d => d.FullName).Returns(path); fileInfo.Setup(d => d.Name).Returns(this.localObjectName); fileInfo.Setup(d => d.Exists).Returns(true); fileInfo.Setup(d => d.IsExtendedAttributeAvailable()).Returns(this.withExtendedAttributes); fileInfo.Setup(d => d.Directory).Returns(parentDirInfo.Object); var transmissionManager = new TransmissionManager(); var solver = new LocalObjectAdded(this.session.Object, this.storage.Object, this.transmissionStorage.Object, transmissionManager); solver.Solve(fileInfo.Object, null); this.storage.VerifyThatNoObjectIsManipulated(); }
private void SetUpMocks() { this.manager = new TransmissionManager(); this.session = new Mock <ISession>(); this.session.SetupTypeSystem(); this.storage = new Mock <IMetaDataStorage>(); this.fsFactory = new Mock <IFileSystemInfoFactory>(); this.changeSolver = new Mock <LocalObjectChangedRemoteObjectChanged>( this.session.Object, this.storage.Object, null, this.manager, this.fsFactory.Object); var changeSolverForRenameSolver = new Mock <LocalObjectChangedRemoteObjectChanged>( this.session.Object, this.storage.Object, null, this.manager, this.fsFactory.Object); this.renameSolver = new Mock <LocalObjectRenamedRemoteObjectChanged>( this.session.Object, this.storage.Object, changeSolverForRenameSolver.Object) { CallBase = true }; this.underTest = new LocalObjectMovedRemoteObjectChanged(this.session.Object, this.storage.Object, this.renameSolver.Object, this.changeSolver.Object); var srcRemoteParent = Mock.Of <ICmisObject>( o => o.Name == this.oldParentsName && o.Id == this.oldParentsId); var targetRemoteParent = Mock.Of <ICmisObject>( o => o.Name == this.newParentsName && o.Id == this.newParentsId); this.session.AddRemoteObjects(srcRemoteParent, targetRemoteParent); this.parentUuid = Guid.NewGuid(); var mappedParent = new MappedObject(this.newParentsName, this.newParentsId, MappedObjectType.Folder, "grandParentId", this.changeToken) { Guid = this.parentUuid }; this.storage.AddMappedFolder(mappedParent); }
public void CreatingATransmissionFiresEvent() { var underTest = new TransmissionManager(); int eventCounter = 0; string path = "path"; underTest.ActiveTransmissions.CollectionChanged += delegate(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { eventCounter++; Assert.That(e.NewItems.Count, Is.EqualTo(1)); Assert.That((e.NewItems[0] as Transmission).Type, Is.EqualTo(TransmissionType.DOWNLOAD_NEW_FILE)); Assert.That((e.NewItems[0] as Transmission).Path, Is.EqualTo(path)); }; underTest.CreateTransmission(TransmissionType.DOWNLOAD_NEW_FILE, path); Assert.That(eventCounter, Is.EqualTo(1)); }
/// <summary> /// Initializes a new instance of the /// <see cref="CmisSync.Lib.Consumer.SituationSolver.PWC.LocalObjectChangedRemoteObjectChangedWithPWC"/> class. /// </summary> /// <param name="session">Cmis session.</param> /// <param name="storage">Meta data storage.</param> /// <param name="transmissionStorage">Transmission storage.</param> /// <param name="manager">Transmission manager.</param> /// <param name="localObjectChangedRemoteObjectChangedFallbackSolver">Local object changed remote object changed fallback solver.</param> public LocalObjectChangedRemoteObjectChangedWithPWC( ISession session, IMetaDataStorage storage, IFileTransmissionStorage transmissionStorage, TransmissionManager manager, ISolver localObjectChangedRemoteObjectChangedFallbackSolver) : base(session, storage, transmissionStorage) { if (localObjectChangedRemoteObjectChangedFallbackSolver == null) { throw new ArgumentNullException("localObjectChangedRemoteObjectChangedFallbackSolver", "Given fallback solver is null"); } if (!session.ArePrivateWorkingCopySupported()) { throw new ArgumentException("Given session does not support pwc updates", "session"); } this.fallbackSolver = localObjectChangedRemoteObjectChangedFallbackSolver; this.transmissionManager = manager; }
public void LocalFolderAddingFailsBecauseUtf8Character() { this.SetUpMocks(); var transmissionManager = new TransmissionManager(); var solver = new LocalObjectAdded(this.session.Object, this.storage.Object, this.transmissionStorage.Object, transmissionManager); var dirInfo = new Mock <IDirectoryInfo>(); dirInfo.Setup(d => d.Exists).Returns(true); dirInfo.Setup(d => d.Name).Returns(@"ä".Normalize(System.Text.NormalizationForm.FormD)); var parentDirInfo = this.SetupParentFolder(this.parentId); dirInfo.Setup(d => d.Parent).Returns(parentDirInfo); this.session.Setup(s => s.CreateFolder(It.IsAny <IDictionary <string, object> >(), It.IsAny <IObjectId>())).Throws(new CmisConstraintException("Conflict")); Assert.Throws <InteractionNeededException>(() => solver.Solve(dirInfo.Object, null)); this.storage.VerifyThatNoObjectIsManipulated(); this.session.Verify(s => s.CreateFolder(It.Is <IDictionary <string, object> >(p => p.ContainsKey("cmis:name")), It.Is <IObjectId>(o => o.Id == this.parentId)), Times.Once()); dirInfo.VerifyThatLocalFileObjectLastWriteTimeUtcIsNeverModified(); dirInfo.VerifySet(d => d.Uuid = It.IsAny <Guid?>(), Times.Never()); }