예제 #1
0
        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();
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
        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);
            }
        }
예제 #4
0
파일: ViewTreeDump.cs 프로젝트: Fooway/RTVS
        public static void CompareVisualTrees(DeployFilesFixture fixture, VisualTreeObject actual, string fileName)
        {
            Action a = () => CompareVisualTreesImplementation(fixture, actual, fileName);

            a.ShouldNotThrow();
        }
예제 #5
0
        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);
            }
        }
예제 #6
0
        /// <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);
        }
예제 #7
0
 /// <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);
 }
예제 #8
0
 public static void CompareVisualTrees(DeployFilesFixture fixture, VisualTreeObject actual, string fileName)
 {
     CompareVisualTreesImplementation(fixture, actual, fileName);
 }