internal void OnApply(Microsoft_VisualStudio_Shell_DialogPage_PageApplyEventArgsAccessor e)
        {
            object e_val_target = null;

            if ((e != null))
            {
                e_val_target = e.Target;
            }
            object[] args = new object[] {
                e_val_target
            };
            Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType target = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType("Microsoft.VisualStudio.Shell", "Microsoft.VisualStudio.Shell.DialogPage+PageApplyEventArgs");
            m_privateObject.Invoke("OnApply", new System.Type[] {
                target.ReferencedType
            }, args);
        }
Exemplo n.º 2
0
        internal static void Usage(global::JSUnitTest.Microsoft_Ajax_Utilities_MainClass_UsageExceptionAccessor e)
        {
            object e_val_target = null;

            if ((e != null))
            {
                e_val_target = e.Target;
            }
            object[] args = new object[] {
                e_val_target
            };
            Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType target = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType("AjaxMin", "Microsoft.Ajax.Utilities.MainClass+UsageException");
            m_privateType.InvokeStatic("Usage", new System.Type[] {
                target.ReferencedType
            }, args);
        }
        internal static object CreatePrivate(global::Memba.Tests.Memba_FileUpload_RequestFilterAccessor requestFilter)
        {
            object requestFilter_val_target = null;

            if ((requestFilter != null))
            {
                requestFilter_val_target = requestFilter.Target;
            }
            object[] args = new object[] {
                requestFilter_val_target
            };
            Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType   target   = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType("Memba.FileUpload.XP", "Memba.FileUpload.RequestFilter");
            Microsoft.VisualStudio.TestTools.UnitTesting.PrivateObject priv_obj = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateObject("Memba.FileUpload.XP", "Memba.FileUpload.MimeParser", new System.Type[] {
                target.ReferencedType
            }, args);
            return(priv_obj.Target);
        }
Exemplo n.º 4
0
        internal void AddVersions(global::System.Xml.XmlReader reader, global::UnitTests.Mediachase_Cms_ImportExport_ImportExportHelper_CMSPageAccessor page)
        {
            object page_val_target = null;

            if ((page != null))
            {
                page_val_target = page.Target;
            }
            object[] args = new object[] {
                reader,
                page_val_target
            };
            Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType target = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType("Mediachase.Cms", "Mediachase.Cms.ImportExport.ImportExportHelper+CMSPage");
            m_privateObject.Invoke("AddVersions", new System.Type[] {
                typeof(global::System.Xml.XmlReader),
                target.ReferencedType
            }, args);
        }
Exemplo n.º 5
0
        internal bool HarmlessConstellation(global::SWA.Ariadne.Model.Tests.SWA_Ariadne_Model_DeadEndChecker_MazeSquareExtensionAccessor sqe)
        {
            object sqe_val_target = null;

            if ((sqe != null))
            {
                sqe_val_target = sqe.Target;
            }
            object[] args = new object[] {
                sqe_val_target
            };
            Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType target = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType("SWA.Ariadne.Model", "SWA.Ariadne.Model.DeadEndChecker+MazeSquareExtension");
            bool ret = ((bool)(m_privateObject.Invoke("HarmlessConstellation", new System.Type[] {
                target.ReferencedType
            }, args)));

            return(ret);
        }
Exemplo n.º 6
0
        internal void AddUncertainSquare(global::SWA.Ariadne.Model.Tests.SWA_Ariadne_Model_DeadEndChecker_MazeSquareExtensionAccessor sqe, int behindPosition)
        {
            object sqe_val_target = null;

            if ((sqe != null))
            {
                sqe_val_target = sqe.Target;
            }
            object[] args = new object[] {
                sqe_val_target,
                behindPosition
            };
            Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType target = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType("SWA.Ariadne.Model", "SWA.Ariadne.Model.DeadEndChecker+MazeSquareExtension");
            m_privateObject.Invoke("AddUncertainSquare", new System.Type[] {
                target.ReferencedType,
                typeof(int)
            }, args);
        }
Exemplo n.º 7
0
        public void CreateBuiltIns_Test()
        {
            // There are currently 9 classses derived from Command
            var cmdTypes = Command.GetDerivedClassesCollection();

            Assert.Equal(9, cmdTypes.Count);

            // Get # of built in commands defined
            var builtIns = new List <Command>();

            foreach (var cmdType in cmdTypes)
            {
                mstest.PrivateType cmdPt      = new mstest.PrivateType(cmdType.GetType());
                List <Command>     listOfType = (List <Command>)cmdPt.GetStaticProperty(nameof(Command.BuiltInCommands));
                foreach (var c in listOfType)
                {
                    builtIns.Add(c);
                }
            }

            // Ensure there are no duplicates
            var query = builtIns.GroupBy(x => x.Cmd)
                        .Where(g => g.Count() > 1)
                        .Select(y => y.Key)
                        .ToList();

            Assert.Empty(query);

            // Invoke the CreateBuiltIns method and compare result to expected
            // https://stackoverflow.com/questions/9122708/unit-testing-private-methods-in-c-sharp
            CommandInvoker target = new CommandInvoker();

            mstest.PrivateType pt = new mstest.PrivateType(typeof(CommandInvoker));
            CommandInvoker     returnedBuiltIns = (CommandInvoker)pt.InvokeStatic("CreateBuiltIns", false);

            Assert.NotEmpty(returnedBuiltIns);
            Assert.Equal(builtIns.Count, returnedBuiltIns.Count);

            // Now test with disableBuiltIns true
            returnedBuiltIns = (CommandInvoker)pt.InvokeStatic("CreateBuiltIns", true);
            Assert.Empty(returnedBuiltIns);
        }
Exemplo n.º 8
0
        internal void AddFolderPageCommon(global::System.Xml.XmlReader reader, global::UnitTests.Mediachase_Cms_ImportExport_ImportExportHelper_CMSCommonAccessor folderPage, global::System.Guid siteId, int outlineLevel, global::System.Guid parentId)
        {
            object folderPage_val_target = null;

            if ((folderPage != null))
            {
                folderPage_val_target = folderPage.Target;
            }
            object[] args = new object[] {
                reader,
                folderPage_val_target,
                siteId,
                outlineLevel,
                parentId
            };
            Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType target = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType("Mediachase.Cms", "Mediachase.Cms.ImportExport.ImportExportHelper+CMSCommon");
            m_privateObject.Invoke("AddFolderPageCommon", new System.Type[] {
                typeof(global::System.Xml.XmlReader),
                target.ReferencedType,
                typeof(global::System.Guid),
                typeof(int),
                typeof(global::System.Guid)
            }, args);
        }
Exemplo n.º 9
0
 protected BaseAccessor(Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType type) :
     this(null, type)
 {
 }
Exemplo n.º 10
0
 protected BaseAccessor(object target, Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType type)
 {
     m_privateObject = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateObject(target, type);
 }
 internal void OnApply(Microsoft_VisualStudio_Shell_DialogPage_PageApplyEventArgsAccessor e)
 {
     object e_val_target = null;
     if ((e != null)) {
     e_val_target = e.Target;
     }
     object[] args = new object[] {
         e_val_target};
     Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType target = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType("Microsoft.VisualStudio.Shell", "Microsoft.VisualStudio.Shell.DialogPage+PageApplyEventArgs");
     m_privateObject.Invoke("OnApply", new System.Type[] {
             target.ReferencedType}, args);
 }
Exemplo n.º 12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PrivateObject"/> class that wraps
 /// the given object.
 /// </summary>
 /// <param name="obj">object to wrap</param>
 /// <param name="type">PrivateType object</param>
 //[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", MessageId = "obj", Justification = "We don't know anything about the object other than that it's an an object, so 'obj' seems reasonable")]
 public PrivateObject(object obj, PrivateType type)
 {
     Helper.CheckParameterNotNull(type, "type", string.Empty);
     this.target       = obj;
     this.originalType = type.ReferencedType;
 }
Exemplo n.º 13
0
 internal static void Usage(global::JSUnitTest.Microsoft_Ajax_Utilities_MainClass_UsageExceptionAccessor e)
 {
     object e_val_target = null;
     if ((e != null)) {
     e_val_target = e.Target;
     }
     object[] args = new object[] {
         e_val_target};
     Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType target = new Microsoft.VisualStudio.TestTools.UnitTesting.PrivateType("AjaxMin", "Microsoft.Ajax.Utilities.MainClass+UsageException");
     m_privateType.InvokeStatic("Usage", new System.Type[] {
             target.ReferencedType}, args);
 }