Пример #1
0
        internal static void CallPgDiffTypesAddDefinition(StreamWriter writer, PgType type, List <string> newValues, SearchPathHelper searchPathHelper)
        {
            var pt = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType(typeof(PgDiffTypes));

            try
            {
                pt.InvokeStatic("AddDefinition", new object[] { writer, type, newValues, searchPathHelper });
            }
            catch (System.MissingMethodException missingMethodException)
            {
                throw new System.NotSupportedException("AddDefinition with requested parameters is not found. Rerun code generation.", missingMethodException);
            }
        }
Пример #2
0
        internal static void CallPgDiffViewsDiffDefaultValues(StreamWriter writer, PgView oldView, PgView newView, SearchPathHelper searchPathHelper)
        {
            var pt = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType(typeof(PgDiffViews));

            try
            {
                pt.InvokeStatic("DiffDefaultValues", new object[] { writer, oldView, newView, searchPathHelper });
            }
            catch (System.MissingMethodException missingMethodException)
            {
                throw new System.NotSupportedException("DiffDefaultValues with requested parameters is not found. Rerun code generation.", missingMethodException);
            }
        }
Пример #3
0
        internal static bool CallPgDiffViewsIsViewModified(PgView oldView, PgView newView)
        {
            var pt = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType(typeof(PgDiffViews));

            try
            {
                return((bool)pt.InvokeStatic("IsViewModified", new object[] { oldView, newView }));
            }
            catch (System.MissingMethodException missingMethodException)
            {
                throw new System.NotSupportedException("IsViewModified with requested parameters is not found. Rerun code generation.", missingMethodException);
            }
        }
Пример #4
0
        internal static void CallPgDiffTablesAlterComments(StreamWriter writer, PgTable oldTable, PgTable newTable, SearchPathHelper searchPathHelper)
        {
            var pt = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType(typeof(PgDiffTables));

            try
            {
                pt.InvokeStatic("AlterComments", new object[] { writer, oldTable, newTable, searchPathHelper });
            }
            catch (System.MissingMethodException missingMethodException)
            {
                throw new System.NotSupportedException("AlterComments with requested parameters is not found. Rerun code generation.", missingMethodException);
            }
        }
        internal static void SetDatabaseVersionRegexDumpVersion(Regex value)
        {
            var pt = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType(typeof(DatabaseVersion));

            try
            {
                pt.SetStaticFieldOrProperty("RegexDumpVersion", value);
            }
            catch (System.MissingMethodException missingMethodException)
            {
                throw new System.NotSupportedException("RegexDumpVersion with requested parameters is not found. Rerun code generation.", missingMethodException);
            }
        }
Пример #6
0
        internal static void CallPgDiffTablesAddModifyTableColumns(IList <string> statements, PgTable oldTable, PgTable newTable, IList <PgColumn> dropDefaultsColumns, bool addDefaults)
        {
            var pt = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType(typeof(PgDiffTables));

            try
            {
                pt.InvokeStatic("AddModifyTableColumns", new object[] { statements, oldTable, newTable, dropDefaultsColumns, addDefaults });
            }
            catch (System.MissingMethodException missingMethodException)
            {
                throw new System.NotSupportedException("AddModifyTableColumns with requested parameters is not found. Rerun code generation.", missingMethodException);
            }
        }
Пример #7
0
        internal static List <PgTable> CallPgDiffTablesSortTablesByReferences(Dictionary <string, List <PgTable> > referencedTables, List <PgTable> dropedTables)
        {
            var pt = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType(typeof(PgDiffTables));

            try
            {
                return((List <PgTable>)pt.InvokeStatic("SortTablesByReferences", new object[] { referencedTables, dropedTables }));
            }
            catch (System.MissingMethodException missingMethodException)
            {
                throw new System.NotSupportedException("SortTablesByReferences with requested parameters is not found. Rerun code generation.", missingMethodException);
            }
        }
Пример #8
0
        internal static Dictionary <PgConstraint, string> CallPgDiffConstraintsGetRenameConstraints()
        {
            var pt = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType(typeof(PgDiffConstraints));

            try
            {
                return((Dictionary <PgConstraint, string>)pt.InvokeStatic("GetRenameConstraints", new object[] { }));
            }
            catch (System.MissingMethodException missingMethodException)
            {
                throw new System.NotSupportedException("GetRenameConstraints with requested parameters is not found. Rerun code generation.", missingMethodException);
            }
        }
Пример #9
0
        internal static List <PgConstraint> CallPgDiffConstraintsGetNewConstraints(bool primaryKey, bool foreignKey)
        {
            var pt = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType(typeof(PgDiffConstraints));

            try
            {
                return((List <PgConstraint>)pt.InvokeStatic("GetNewConstraints", new object[] { primaryKey, foreignKey }));
            }
            catch (System.MissingMethodException missingMethodException)
            {
                throw new System.NotSupportedException("GetNewConstraints with requested parameters is not found. Rerun code generation.", missingMethodException);
            }
        }
Пример #10
0
        internal static void SetPrivilegeParserenumEntries(List <PgPrivilegeKind> value)
        {
            var pt = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType(typeof(PrivilegeParser));

            try
            {
                pt.SetStaticFieldOrProperty("enumEntries", value);
            }
            catch (System.MissingMethodException missingMethodException)
            {
                throw new System.NotSupportedException("enumEntries with requested parameters is not found. Rerun code generation.", missingMethodException);
            }
        }
Пример #11
0
        internal static void CallAlterTableParserParseAddForeignKey(Parser parser, PgTable table)
        {
            var pt = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType(typeof(AlterTableParser));

            try
            {
                pt.InvokeStatic("ParseAddForeignKey", new object[] { parser, table });
            }
            catch (System.MissingMethodException missingMethodException)
            {
                throw new System.NotSupportedException("ParseAddForeignKey with requested parameters is not found. Rerun code generation.", missingMethodException);
            }
        }
Пример #12
0
        internal static IList <PgTrigger> CallPgDiffTriggersGetNewTriggers(PgTable newTable)
        {
            var pt = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType(typeof(PgDiffTriggers));

            try
            {
                return((IList <PgTrigger>)pt.InvokeStatic("GetNewTriggers", new object[] { newTable }));
            }
            catch (System.MissingMethodException missingMethodException)
            {
                throw new System.NotSupportedException("GetNewTriggers with requested parameters is not found. Rerun code generation.", missingMethodException);
            }
        }
Пример #13
0
        internal static string[] CallParserUtilsSplit(string self, string regexDelimiter, bool trimTrailingEmptyStrings)
        {
            var pt = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType(typeof(ParserUtils));

            try
            {
                return((string[])pt.InvokeStatic("Split", new object[] { self, regexDelimiter, trimTrailingEmptyStrings }));
            }
            catch (System.MissingMethodException missingMethodException)
            {
                throw new System.NotSupportedException("Split with requested parameters is not found. Rerun code generation.", missingMethodException);
            }
        }
Пример #14
0
        internal static string[] CallParserUtilsSplitNames(string @string)
        {
            var pt = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType(typeof(ParserUtils));

            try
            {
                return((string[])pt.InvokeStatic("SplitNames", new object[] { @string }));
            }
            catch (System.MissingMethodException missingMethodException)
            {
                throw new System.NotSupportedException("SplitNames with requested parameters is not found. Rerun code generation.", missingMethodException);
            }
        }
Пример #15
0
        internal static void CallAlterTableParserParseDisable(Parser parser, bool outputIgnoredStatements, string tableName, PgDatabase database)
        {
            var pt = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType(typeof(AlterTableParser));

            try
            {
                pt.InvokeStatic("ParseDisable", new object[] { parser, outputIgnoredStatements, tableName, database });
            }
            catch (System.MissingMethodException missingMethodException)
            {
                throw new System.NotSupportedException("ParseDisable with requested parameters is not found. Rerun code generation.", missingMethodException);
            }
        }
Пример #16
0
        internal static void SetCreateAggregateParserLog(ILog value)
        {
            var pt = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType(typeof(CreateAggregateParser));

            try
            {
                pt.SetStaticFieldOrProperty("Log", value);
            }
            catch (System.MissingMethodException missingMethodException)
            {
                throw new System.NotSupportedException("Log with requested parameters is not found. Rerun code generation.", missingMethodException);
            }
        }
Пример #17
0
        internal static string CallCommentParserGetComment(Parser parser)
        {
            var pt = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType(typeof(CommentParser));

            try
            {
                return((string)pt.InvokeStatic("GetComment", new object[] { parser }));
            }
            catch (System.MissingMethodException missingMethodException)
            {
                throw new System.NotSupportedException("GetComment with requested parameters is not found. Rerun code generation.", missingMethodException);
            }
        }
Пример #18
0
        internal static void CallCommentParserParseFunction(Parser parser, PgDatabase database)
        {
            var pt = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType(typeof(CommentParser));

            try
            {
                pt.InvokeStatic("ParseFunction", new object[] { parser, database });
            }
            catch (System.MissingMethodException missingMethodException)
            {
                throw new System.NotSupportedException("ParseFunction with requested parameters is not found. Rerun code generation.", missingMethodException);
            }
        }
Пример #19
0
        public void AudioProcessorGetTrueForAllAudioElements_AudioSpansAndDivs_CheckAudioDivsAreProcessedToo()
        {
            // Test Setup //
            // This one is designed to return false is div's are processed and return true if div's are ignored.  This lets us test whether divs are actually processed.
            // Note: This HTML is purely hypothetical for exercising the unit under test and not derived from any real use case.
            var dom = new HtmlDom(
                @"<html>
						<head></head>
						<body>
							<div id='page1'><p><span id='audioRecordingGuid1' class='audio-sentence'>Page 2 Sentence 1</span></p></div>
							<div id='page3'><p><span id='audioRecordingGuid2' class='audio-sentence'>Page 2 Sentence 1</span></p></div>
							<div id='page3'><div id='specialAudioRecordingGuid' class='audio-sentence'><p>Page 3, Paragraph 1, Sentence 1</p><p>Page 3, Paragraph 2, Sentence 1</p></div></div>
						</body>
				</html>"                );


            Func <string, string, bool> failIfSearchTargetFound = ReturnFalseIfTargetFound;
            var  runner = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType(typeof(AudioProcessor));
            bool result = (bool)runner.InvokeStatic("IsTrueForAllAudioSentenceElements", "bookFolderPath", dom.RawDom, failIfSearchTargetFound);

            Assert.IsFalse(result, "The method should've processed specialAudioRecordingGuid but it actually didn't");
        }
Пример #20
0
        public void AudioProcessorGetTrueForAllAudioElements_MixedSpansWithIds_OnlyAudioSpansAreProcessed()
        {
            // Test Setup //
            // Note: This HTML is purely hypothetical for exercising the unit under test and not derived from any real use case.
            // In particular, this tests ensures that the code is not just looking for spans with an ID as the necessary and sufficient condition to be an audio-sentence.
            var dom = new HtmlDom(
                @"<html>
						<head></head>
						<body>
							<div id='page1'><div class='bloom-editable'><p><span id='audioRecordingGuid1' class='audio-sentence'>Page 1 Sentence 1</span></p></div></div>
							<div id='page2'><div class='bloom-editable'><p><span id='videoRecordingGuid1' class='video-sentence'>Page 2 Sentence 1</span></p></div></div>
							<div id='page3'><div class='bloom-editable'><p><span id='audioRecordingGuid3' class='audio-sentence'>Page 3 Sentence 1</span></p></div></div>
							<div id='page4'><div class='bloom-editable video-sentence' id='videoRecordingGuid2'><p>Page 4, Paragraph 1, Sentence 1</p><p>Page 4, Paragraph 2, Sentence 1</p></div></div>
						</body>
				</html>"                );


            Func <string, string, bool> failOnInvalidInputPredicate = ReturnTrueOnlyIfAudioSentence;
            var  runner = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType(typeof(AudioProcessor));
            bool result = (bool)runner.InvokeStatic("IsTrueForAllAudioSentenceElements", "bookFolderPath", dom.RawDom, failOnInvalidInputPredicate);

            Assert.IsTrue(result, "An invalid input was passed to the predicate. Make sure the unit under test removes all invalid inputs.");
        }
Пример #21
0
        internal static ILog GetPrivilegeParserLog()
        {
            var pt = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType(typeof(PrivilegeParser));

            return((ILog)pt.GetStaticFieldOrProperty("Log"));
        }
        internal static Regex GetDatabaseVersionRegexUndoDiffFile()
        {
            var pt = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType(typeof(DatabaseVersion));

            return((Regex)pt.GetStaticFieldOrProperty("RegexUndoDiffFile"));
        }
Пример #23
0
        internal static List <PgPrivilegeKind> GetPrivilegeParserenumEntries()
        {
            var pt = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType(typeof(PrivilegeParser));

            return((List <PgPrivilegeKind>)pt.GetStaticFieldOrProperty("enumEntries"));
        }
        internal static EqualsAndHashCode <DatabaseVersion> GetDatabaseVersionEqualsAndHashCode()
        {
            var pt = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType(typeof(DatabaseVersion));

            return((EqualsAndHashCode <DatabaseVersion>)pt.GetStaticFieldOrProperty("EqualsAndHashCode"));
        }