public static void TokenizeFile <TToken, TTokenType, TTokenizer>(DeployFilesFixture fixture, string name, string language) where TTokenizer : ITokenizer <TToken>, new() where TToken : IToken <TTokenType> { Action a = () => TokenizeFileImplementation <TToken, TTokenType, TTokenizer>(fixture, name, language); a.ShouldNotThrow(); }
public static void CompareVisualTrees(DeployFilesFixture fixture, VisualTreeObject actual, string fileName) { var testFileName = fileName + ".tree"; var serializedActual = SerializeVisualTree(actual); var baselineFilePath = fixture.GetSourcePath(testFileName); if (_regenerateBaselineFiles) { TestFiles.UpdateBaseline(baselineFilePath, serializedActual); } else { TestFiles.CompareToBaseLine(baselineFilePath, serializedActual); } }
private static void CompareVisualTreesImplementation(DeployFilesFixture fixture, VisualTreeObject actual, string fileName) { string testFileName = fileName + ".tree"; string testFilePath = fixture.GetDestinationPath(testFileName); if (_regenerateBaselineFiles) { var serializedActual = SerializeVisualTree(actual); string baselineFilePath = fixture.GetSourcePath(testFileName); TestFiles.UpdateBaseline(baselineFilePath, serializedActual); } else { var deserializedExpected = DeserializeVisualTree(testFilePath); CompareVisualTree(actual, deserializedExpected); } }
public static void CompareVisualTrees(DeployFilesFixture fixture, VisualTreeObject actual, string fileName) { Action a = () => CompareVisualTreesImplementation(fixture, actual, fileName); a.ShouldNotThrow(); }
private static void TokenizeFileImplementation <TToken, TTokenType, TTokenizer>(DeployFilesFixture fixture, string name, string language) where TTokenizer : ITokenizer <TToken>, new() where TToken : IToken <TTokenType> { string testFile = fixture.GetDestinationPath(name); string baselineFile = testFile + ".tokens"; string text = fixture.LoadDestinationFile(name); ITextProvider textProvider = new TextStream(text); var tokenizer = new TTokenizer(); var tokens = tokenizer.Tokenize(textProvider, 0, textProvider.Length); string actual = DebugWriter.WriteTokens <TToken, TTokenType>(tokens); if (_regenerateBaselineFiles) { // Update this to your actual enlistment if you need to update baseline string enlistmentPath = @"F:\RTVS\src\R\Support\Test\" + language + @"\Files\Tokenization"; baselineFile = Path.Combine(enlistmentPath, Path.GetFileName(testFile)) + ".tokens"; TestFiles.UpdateBaseline(baselineFile, actual); } else { TestFiles.CompareToBaseLine(baselineFile, actual); } }
/// <summary> /// Open a disk file in an editor window /// </summary> /// <param name="fixture"></param> /// <param name="fileName">File name</param> /// <returns>Editor instance</returns> public void OpenFile(DeployFilesFixture fixture, string fileName) { string content = fixture.LoadDestinationFile(fileName); EditorWindow.Create(content, fileName); }
/// <summary> /// Create script that opens a disk file in an editor window /// </summary> /// <param name="fileName">File name</param> public TestScript(DeployFilesFixture fixture, string fileName, bool unused) { OpenFile(fixture, fileName); }
public static void CompareVisualTrees(DeployFilesFixture fixture, VisualTreeObject actual, string fileName) { CompareVisualTreesImplementation(fixture, actual, fileName); }