public void FixtureSetup() { _userLexiconSettingsFileHandler = (from handler in ChorusFileTypeHandlerCollection.CreateWithInstalledHandlers().Handlers where handler.GetType().Name == "UserLexiconSettingsFileHandler" select handler).First(); }
private static void DoMerge(IChorusFileTypeHandler fileHandler, int ours) { TempFile ourFile; TempFile commonFile; TempFile theirFile; FieldWorksTestServices.SetupTempFilesWithExtension(".ModelVersion", out ourFile, out commonFile, out theirFile); try { var baseModelVersion = ours - 1; File.WriteAllText(commonFile.Path, FormatModelVersionData(baseModelVersion)); File.WriteAllText(ourFile.Path, FormatModelVersionData(ours)); File.WriteAllText(theirFile.Path, FormatModelVersionData(baseModelVersion)); var listener = new ListenerForUnitTests(); var mergeOrder = new MergeOrder(ourFile.Path, commonFile.Path, theirFile.Path, new NullMergeSituation()) { EventListener = listener }; fileHandler.Do3WayMerge(mergeOrder); } finally { FieldWorksTestServices.RemoveTempFiles(ref ourFile, ref commonFile, ref theirFile); } }
public void TestSetup() { // Each starts with a fresh FileHandler, because DictionaryConfigurationHandlerStrategy caches the path to the schema, // but some tests require the schema's presence and others require its absence. _fileHandler = FieldWorksTestServices.CreateChorusFileHandlers(); _configFile = TempFile.WithExtension("." + SharedConstants.fwdictconfig); }
public void TestTearDown() { RemoveOptionalStuff(); _configFile.Dispose(); _configFile = null; _fileHandler = null; }
private static void CheckSinglePropertyAddedUpgrade(MetadataCache mdc, IChorusFileTypeHandler fileHandler, int ours, string className, string newPropName, DataType dataType) { CheckPropertyDoesNotExistBeforeUpGrade(mdc, className, newPropName); DoMerge(fileHandler, ours); CheckNewPropertyAfterUpgrade(mdc.GetClassInfo(className), newPropName, dataType); }
private static void CheckNoModelChangesUpgrade(MetadataCache mdc, IChorusFileTypeHandler fileHandler, int ours) { var startingClassCount = mdc.AllClasses.Count(); var startingPropertyCount = mdc.AllClasses.Sum(classInfo => classInfo.AllProperties.Count()); DoMerge(fileHandler, ours); Assert.AreEqual(startingClassCount, mdc.AllClasses.Count(), "Different number of classes."); Assert.AreEqual(startingPropertyCount, mdc.AllClasses.Sum(classInfo => classInfo.AllProperties.Count()), "Different number of properties."); }
internal static string DoMerge( IChorusFileTypeHandler chorusFileHandler, TempFile ourFile, string ourContent, TempFile commonFile, string commonAncestor, TempFile theirFile, string theirContent, IEnumerable <string> matchesExactlyOne, IEnumerable <string> isNull, int expectedConflictCount, List <Type> conflictTypes, int expectedChangesCount, List <Type> changeTypes, out List <IConflict> resultingConflicts) { File.WriteAllText(ourFile.Path, ourContent); if (commonFile != null) { File.WriteAllText(commonFile.Path, commonAncestor); } File.WriteAllText(theirFile.Path, theirContent); var situation = new NullMergeSituation(); var mergeOrder = new MergeOrder(ourFile.Path, (commonFile == null ? null : commonFile.Path), theirFile.Path, situation); var eventListener = new ListenerForUnitTests(); mergeOrder.EventListener = eventListener; chorusFileHandler.Do3WayMerge(mergeOrder); var result = File.ReadAllText(ourFile.Path); if (matchesExactlyOne != null) { foreach (var query in matchesExactlyOne) { XmlTestHelper.AssertXPathMatchesExactlyOne(result, query); } } if (isNull != null) { foreach (var query in isNull) { XmlTestHelper.AssertXPathIsNull(result, query); } } eventListener.AssertExpectedConflictCount(expectedConflictCount); Assert.AreEqual(conflictTypes.Count, eventListener.Conflicts.Count); for (var idx = 0; idx < conflictTypes.Count; ++idx) { Assert.AreSame(conflictTypes[idx], eventListener.Conflicts[idx].GetType()); } eventListener.AssertExpectedChangesCount(expectedChangesCount); Assert.AreEqual(changeTypes.Count, eventListener.Changes.Count); for (var idx = 0; idx < changeTypes.Count; ++idx) { Assert.AreSame(changeTypes[idx], eventListener.Changes[idx].GetType()); } resultingConflicts = eventListener.Conflicts; return(result); }
public void FixtureTearDown() { _handler = null; _goodXmlTempFile.Dispose(); _goodXmlTempFile = null; _illformedXmlTempFile.Dispose(); _illformedXmlTempFile = null; _goodXmlButNotProjectLexiconSettingsTempFile.Dispose(); _goodXmlButNotProjectLexiconSettingsTempFile = null; _nonXmlTempFile.Dispose(); _nonXmlTempFile = null; }
public void FixtureTearDown() { _handler = null; _goodXmlTempFile.Dispose(); _goodXmlTempFile = null; _illformedXmlTempFile.Dispose(); _illformedXmlTempFile = null; _goodXmlButNotLdmlTempFile.Dispose(); _goodXmlButNotLdmlTempFile = null; _nonXmlTempFile.Dispose(); _nonXmlTempFile = null; }
public void FixtureTearDown() { _handler = null; _goodXmlTempFile.Dispose(); _goodXmlTempFile = null; _illformedXmlTempFile.Dispose(); _illformedXmlTempFile = null; _goodXmlButNotUserLexiconSettingsTempFile.Dispose(); _goodXmlButNotUserLexiconSettingsTempFile = null; _nonXmlTempFile.Dispose(); _nonXmlTempFile = null; }
internal static string DoMerge( IChorusFileTypeHandler chorusFileHandler, TempFile ourFile, string ourContent, TempFile commonFile, string commonAncestor, TempFile theirFile, string theirContent, IEnumerable<string> matchesExactlyOne, IEnumerable<string> isNull, int expectedConflictCount, List<Type> conflictTypes, int expectedChangesCount, List<Type> changeTypes) { List<IConflict> resultingConflicts; return DoMerge(chorusFileHandler, ourFile, ourContent, commonFile, commonAncestor, theirFile, theirContent, matchesExactlyOne, isNull, expectedConflictCount, conflictTypes, expectedChangesCount, changeTypes, out resultingConflicts); }
internal static string DoMerge( IChorusFileTypeHandler chorusFileHandler, TempFile ourFile, string ourContent, TempFile commonFile, string commonAncestor, TempFile theirFile, string theirContent, IEnumerable <string> matchesExactlyOne, IEnumerable <string> isNull, int expectedConflictCount, List <Type> conflictTypes, int expectedChangesCount, List <Type> changeTypes) { List <IConflict> resultingConflicts; return(DoMerge(chorusFileHandler, ourFile, ourContent, commonFile, commonAncestor, theirFile, theirContent, matchesExactlyOne, isNull, expectedConflictCount, conflictTypes, expectedChangesCount, changeTypes, out resultingConflicts)); }
internal static string DoMerge( IChorusFileTypeHandler chorusFileHandler, TempFile ourFile, string ourContent, TempFile commonFile, string commonAncestor, TempFile theirFile, string theirContent, IEnumerable<string> matchesExactlyOne, IEnumerable<string> isNull, int expectedConflictCount, List<Type> conflictTypes, int expectedChangesCount, List<Type> changeTypes, out List<IConflict> resultingConflicts) { File.WriteAllText(ourFile.Path, ourContent); if (commonFile != null) File.WriteAllText(commonFile.Path, commonAncestor); File.WriteAllText(theirFile.Path, theirContent); var situation = new NullMergeSituation(); var mergeOrder = new MergeOrder(ourFile.Path, (commonFile == null ? null : commonFile.Path), theirFile.Path, situation); var eventListener = new ListenerForUnitTests(); mergeOrder.EventListener = eventListener; chorusFileHandler.Do3WayMerge(mergeOrder); var result = File.ReadAllText(ourFile.Path); if (matchesExactlyOne != null) { foreach (var query in matchesExactlyOne) XmlTestHelper.AssertXPathMatchesExactlyOne(result, query); } if (isNull != null) { foreach (var query in isNull) XmlTestHelper.AssertXPathIsNull(result, query); } eventListener.AssertExpectedConflictCount(expectedConflictCount); Assert.AreEqual(conflictTypes.Count, eventListener.Conflicts.Count); for (var idx = 0; idx < conflictTypes.Count; ++idx) Assert.AreSame(conflictTypes[idx], eventListener.Conflicts[idx].GetType()); eventListener.AssertExpectedChangesCount(expectedChangesCount); Assert.AreEqual(changeTypes.Count, eventListener.Changes.Count); for (var idx = 0; idx < changeTypes.Count; ++idx) Assert.AreSame(changeTypes[idx], eventListener.Changes[idx].GetType()); resultingConflicts = eventListener.Conflicts; return result; }
public void FixtureSetup() { _handler = (ChorusFileTypeHandlerCollection.CreateWithInstalledHandlers().Handlers.Where( handler => handler.GetType().Name == "ProjectLexiconSettingsFileHandler")).First(); _goodXmlTempFile = TempFile.WithExtension(".plsx"); #if MONO File.WriteAllText(_goodXmlTempFile.Path, "<?xml version='1.0' encoding='utf-8'?>" + Environment.NewLine + "<ProjectLexiconSettings>" + Environment.NewLine + "</ProjectLexiconSettings>"); #else File.WriteAllText(_goodXmlTempFile.Path, "<?xml version='1.0' encoding='utf-8'?>" + Environment.NewLine + "<ProjectLexiconSettings />"); #endif _illformedXmlTempFile = TempFile.WithExtension(".plsx"); File.WriteAllText(_illformedXmlTempFile.Path, "<?xml version='1.0' encoding='utf-8'?>" + Environment.NewLine + "<ProjectLexiconSettings>"); _goodXmlButNotProjectLexiconSettingsTempFile = TempFile.WithExtension(".plsx"); File.WriteAllText(_goodXmlButNotProjectLexiconSettingsTempFile.Path, "<?xml version='1.0' encoding='utf-8'?>" + Environment.NewLine + "<nonProjectLexiconSettingsstuff />"); _nonXmlTempFile = TempFile.WithExtension(".txt"); File.WriteAllText(_nonXmlTempFile.Path, "This is not a project lexicon settings file." + Environment.NewLine); }
public void FixtureSetup() { _handler = (ChorusFileTypeHandlerCollection.CreateWithInstalledHandlers().Handlers.Where( handler => handler.GetType().Name == "LdmlFileHandler")).First(); _goodXmlTempFile = TempFile.WithExtension(".ldml"); #if MONO File.WriteAllText(_goodXmlTempFile.Path, "<?xml version='1.0' encoding='utf-8'?>" + Environment.NewLine + "<ldml>" + Environment.NewLine + "</ldml>"); #else File.WriteAllText(_goodXmlTempFile.Path, "<?xml version='1.0' encoding='utf-8'?>" + Environment.NewLine + "<ldml />"); #endif _illformedXmlTempFile = TempFile.WithExtension(".ldml"); File.WriteAllText(_illformedXmlTempFile.Path, "<?xml version='1.0' encoding='utf-8'?>" + Environment.NewLine + "<ldml>"); _goodXmlButNotLdmlTempFile = TempFile.WithExtension(".ldml"); File.WriteAllText(_goodXmlButNotLdmlTempFile.Path, "<?xml version='1.0' encoding='utf-8'?>" + Environment.NewLine + "<nonldmlstuff />"); _nonXmlTempFile = TempFile.WithExtension(".txt"); File.WriteAllText(_nonXmlTempFile.Path, "This is not an ldml file." + Environment.NewLine); }
public void FixtureSetup() { _handler = (ChorusFileTypeHandlerCollection.CreateWithInstalledHandlers().Handlers.Where( handler => handler.GetType().Name == "UserLexiconSettingsFileHandler")).First(); _goodXmlTempFile = TempFile.WithExtension(".ulsx"); var nl = Environment.NewLine; File.WriteAllText(_goodXmlTempFile.Path, Platform.IsMono ? $"<?xml version='1.0' encoding='utf-8'?>{nl}<UserLexiconSettings>{nl}</UserLexiconSettings>" : $"<?xml version='1.0' encoding='utf-8'?>{nl}<UserLexiconSettings />"); _illformedXmlTempFile = TempFile.WithExtension(".ulsx"); File.WriteAllText(_illformedXmlTempFile.Path, $"<?xml version='1.0' encoding='utf-8'?>{nl}<UserLexiconSettings>"); _goodXmlButNotUserLexiconSettingsTempFile = TempFile.WithExtension(".ulsx"); File.WriteAllText(_goodXmlButNotUserLexiconSettingsTempFile.Path, $"<?xml version='1.0' encoding='utf-8'?>{nl}<nonUserLexiconSettingsstuff />"); _nonXmlTempFile = TempFile.WithExtension(".txt"); File.WriteAllText(_nonXmlTempFile.Path, $"This is not a user lexicon settings file.{nl}"); }
public void FixtureSetup() { _handler = (ChorusFileTypeHandlerCollection.CreateWithInstalledHandlers().Handlers.Where( handler => handler.GetType().Name == "LdmlFileHandler")).First(); _goodXmlTempFile = TempFile.WithExtension(".ldml"); var nl = Environment.NewLine; File.WriteAllText(_goodXmlTempFile.Path, Platform.IsMono ? $"<?xml version='1.0' encoding='utf-8'?>{nl}<ldml>{nl}</ldml>" : $"<?xml version='1.0' encoding='utf-8'?>{nl}<ldml />"); _illformedXmlTempFile = TempFile.WithExtension(".ldml"); File.WriteAllText(_illformedXmlTempFile.Path, $"<?xml version='1.0' encoding='utf-8'?>{nl}<ldml>"); _goodXmlButNotLdmlTempFile = TempFile.WithExtension(".ldml"); File.WriteAllText(_goodXmlButNotLdmlTempFile.Path, $"<?xml version='1.0' encoding='utf-8'?>{nl}<nonldmlstuff />"); _nonXmlTempFile = TempFile.WithExtension(".txt"); File.WriteAllText(_nonXmlTempFile.Path, $"This is not an ldml file.{nl}"); }
internal static string DoMerge( IChorusFileTypeHandler chorusFileHandler, string extension, string commonAncestor, string ourContent, string theirContent, IEnumerable <string> matchesExactlyOne, IEnumerable <string> isNull, int expectedConflictCount, List <Type> conflictTypes, int expectedChangesCount, List <Type> changeTypes) { string result; using (var ours = TempFile.WithFilename("ours." + extension)) using (var theirs = new TempFile("theirs." + extension)) using (var ancestor = new TempFile("common." + extension)) { result = DoMerge(chorusFileHandler, ours, ourContent, ancestor, commonAncestor, theirs, theirContent, matchesExactlyOne, isNull, expectedConflictCount, conflictTypes, expectedChangesCount, changeTypes); } return(result); }
public void FixtureTearDown() { _ldmlFileHandler = null; _eventListener = null; }
public void FixtureTearDown() { _liftRangesFileHandler = null; _eventListener = null; }
public void FixtureTearDown() { _chorusNotesFileHandler = null; }
public void FixtureTearDown() { _projectLexiconSettingsFileHandler = null; }
public void FixtureSetup() { _ldmlFileHandler = (ChorusFileTypeHandlerCollection.CreateWithInstalledHandlers().Handlers.Where( handler => handler.GetType().Name == "LdmlFileHandler")).First(); }
public void FixtureTearDown() { _defaultFileHandler = null; }
public void FixtureSetup() { _projectLexiconSettingsFileHandler = (from handler in ChorusFileTypeHandlerCollection.CreateWithInstalledHandlers().Handlers where handler.GetType().Name == "ProjectLexiconSettingsFileHandler" select handler).First(); }
public void FixtureTearDown() { _audioFileHandler = null; }
public void FixtureSetup() { _audioFileHandler = (ChorusFileTypeHandlerCollection.CreateWithInstalledHandlers().Handlers.Where( handler => handler.GetType().Name == "AudioFileTypeHandler")).First(); }
public void FixtureTearDown() { _imageFileHandler = null; }
public void FixtureSetup() { _defaultFileHandler = new DefaultFileTypeHandler(); }
public virtual void FixtureSetup() { FileHandler = (from handler in ChorusFileTypeHandlerCollection.CreateWithInstalledHandlers().Handlers where handler.GetType().Name == "FieldWorksCommonFileHandler" select handler).First(); }
public void FixtureTearDown() { _ldmlFileHandler = null; }
public void FixtureSetup() { _liftRangesFileHandler = (from handler in ChorusFileTypeHandlerCollection.CreateWithInstalledHandlers().Handlers where handler.GetType().Name == "LiftRangesFileTypeHandler" select handler).First(); }
public void FixtureSetup() { _projectLexiconSettingsFileHandler = (ChorusFileTypeHandlerCollection.CreateWithInstalledHandlers().Handlers.Where( handler => handler.GetType().Name == "ProjectLexiconSettingsFileHandler")).First(); }
public virtual void FixtureSetup() { FileHandler = FieldWorksTestServices.CreateChorusFileHandlers(); }
public void FixtureSetup() { _chorusNotesFileHandler = (from handler in ChorusFileTypeHandlerCollection.CreateWithInstalledHandlers().Handlers where handler.GetType().Name == "ChorusNotesFileHandler" select handler).First(); }
public void FixtureSetup() { _userLexiconSettingsFileHandler = (ChorusFileTypeHandlerCollection.CreateWithInstalledHandlers().Handlers.Where( handler => handler.GetType().Name == "UserLexiconSettingsFileHandler")).First(); }
public void FixtureTearDown() { _userLexiconSettingsFileHandler = null; _eventListener = null; }
public virtual void FixtureTearDown() { FileHandler = null; }
internal static string DoMerge( IChorusFileTypeHandler chorusFileHandler, string extension, string commonAncestor, string ourContent, string theirContent, IEnumerable<string> matchesExactlyOne, IEnumerable<string> isNull, int expectedConflictCount, List<Type> conflictTypes, int expectedChangesCount, List<Type> changeTypes) { string result; using (var ours = TempFile.WithFilename("ours." + extension)) using (var theirs = new TempFile("theirs." + extension)) using (var ancestor = new TempFile("common." + extension)) { result = DoMerge(chorusFileHandler, ours, ourContent, ancestor, commonAncestor, theirs, theirContent, matchesExactlyOne, isNull, expectedConflictCount, conflictTypes, expectedChangesCount, changeTypes); } return result; }
public void FixtureTearDown() { _commonHandler = null; }
public void FixtureTearDown() { _userLexiconSettingsFileHandler = null; }