public void UpdateObject_File_ContentChange() { var fileSystem = new MockFileSystem(); fileSystem.RegisterDirectory(@"C:\left"); fileSystem.RegisterFile(@"C:\left\file"); fileSystem.RegisterDirectory(@"C:\right"); fileSystem.RegisterFile(@"C:\right\file"); var serviceContainer = new ManualServiceContainer(); serviceContainer.Register <IFileSystem>(fileSystem); var executionContext = new ExecutionContext(serviceContainer); var directoryContainer = new DirectoryContainer(@"C:\right"); var directoryContainerInstance = directoryContainer.CreateInstance(executionContext); var leftFile = new FileObject(@"C:\left\file", fileSystem); leftFile.Metadata["BasePath"] = Path.Parse(@"C:\left"); var rightFile = new FileObject(@"C:\right\file", fileSystem); var change = new ContentChange(); var syncContext = new SyncContext(null, executionContext); var result = directoryContainerInstance.UpdateObject(rightFile, leftFile, change, syncContext).ToArray(); var expected = new IOperation[] { new CopyFileOperation(leftFile, rightFile, fileSystem, executionContext) }; CollectionAssert.AreEqual(expected, result); }
public void ChangeContent(object newContent) { ContentChange?.Invoke(this, new ContentChangeEventArgs(newContent)); // FIXME: This is one hell of an ugly hack... CurrentDataContext = ((UserControl)newContent).DataContext; }