Ejemplo n.º 1
0
    public XrmMockupFixture()
    {
        var settings = new XrmMockupSettings
        {
            BasePluginTypes           = new Type[] { typeof(Plugin), typeof(PluginNonDaxif) },
            CodeActivityInstanceTypes = new Type[] { typeof(AccountWorkflowActivity) },
            EnableProxyTypes          = true,
            IncludeAllWorkflows       = false,
            ExceptionFreeRequests     = new string[] { "TestWrongRequest" },
            MetadataDirectoryPath     = "../../../Metadata",
            IPluginMetadata           = metaPlugins
        };

#if XRM_MOCKUP_TEST_2011
        crm = XrmMockup2011.GetInstance(settings);
#elif XRM_MOCKUP_TEST_2013
        crm = XrmMockup2013.GetInstance(settings);
#elif XRM_MOCKUP_TEST_2015
        crm = XrmMockup2015.GetInstance(settings);
#elif XRM_MOCKUP_TEST_2016
        crm = XrmMockup2016.GetInstance(settings);
#elif XRM_MOCKUP_TEST_365
        crm = XrmMockup365.GetInstance(settings);
#endif
        try
        {
            var realDataSettings = new XrmMockupSettings
            {
                BasePluginTypes           = settings.BasePluginTypes,
                CodeActivityInstanceTypes = settings.CodeActivityInstanceTypes,
                EnableProxyTypes          = settings.EnableProxyTypes,
                IncludeAllWorkflows       = settings.IncludeAllWorkflows,
                ExceptionFreeRequests     = settings.ExceptionFreeRequests,
                OnlineEnvironment         = new Env
                {
                    providerType = AuthenticationProviderType.OnlineFederation,
                    uri          = "https://exampleURL/XRMServices/2011/Organization.svc",
                    username     = "******",
                    password     = "******"
                }
            };
#if XRM_MOCKUP_TEST_2011
            crmRealData = XrmMockup2011.GetInstance(realDataSettings);
#elif XRM_MOCKUP_TEST_2013
            crmRealData = XrmMockup2013.GetInstance(realDataSettings);
#elif XRM_MOCKUP_TEST_2015
            crmRealData = XrmMockup2015.GetInstance(realDataSettings);
#elif XRM_MOCKUP_TEST_2016
            crmRealData = XrmMockup2016.GetInstance(realDataSettings);
#elif XRM_MOCKUP_TEST_365
            crmRealData = XrmMockup365.GetInstance(realDataSettings);
#endif
        }
        catch
        {
            // ignore
        }
    }
Ejemplo n.º 2
0
        public static void InitializeMockup(TestContext context)
        {
            var settings = new XrmMockupSettings {
                BasePluginTypes           = new Type[] { typeof(DG.Some.Namespace.Plugin), typeof(PluginNonDaxif) },
                CodeActivityInstanceTypes = new Type[] { typeof(AccountWorkflowActivity) },
                EnableProxyTypes          = true,
                IncludeAllWorkflows       = false,
                ExceptionFreeRequests     = new string[] { "TestWrongRequest" },
            };

            var realDataSettings = new XrmMockupSettings {
                BasePluginTypes           = settings.BasePluginTypes,
                CodeActivityInstanceTypes = settings.CodeActivityInstanceTypes,
                EnableProxyTypes          = settings.EnableProxyTypes,
                IncludeAllWorkflows       = settings.IncludeAllWorkflows,
                ExceptionFreeRequests     = settings.ExceptionFreeRequests,
                OnlineEnvironment         = new Env {
                    providerType = AuthenticationProviderType.OnlineFederation,
                    uri          = "https://delegatelab4.crm4.dynamics.com/XRMServices/2011/Organization.svc",
                    username     = "******",
                    password     = "******"
                }
            };

#if XRM_MOCKUP_TEST_2011
            crm         = XrmMockup2011.GetInstance(settings);
            crmRealData = XrmMockup2011.GetInstance(realDataSettings);
#elif XRM_MOCKUP_TEST_2013
            crm         = XrmMockup2013.GetInstance(settings);
            crmRealData = XrmMockup2013.GetInstance(realDataSettings);
#elif XRM_MOCKUP_TEST_2015
            crm         = XrmMockup2015.GetInstance(settings);
            crmRealData = XrmMockup2015.GetInstance(realDataSettings);
#elif XRM_MOCKUP_TEST_2016
            crm         = XrmMockup2016.GetInstance(settings);
            crmRealData = XrmMockup2016.GetInstance(realDataSettings);
#elif XRM_MOCKUP_TEST_365
            crm         = XrmMockup365.GetInstance(settings);
            crmRealData = XrmMockup365.GetInstance(realDataSettings);
#endif
        }
Ejemplo n.º 3
0
        public static void InitializeMockup(TestContext context)
        {
            var settings = new XrmMockupSettings {
                BasePluginTypes           = new Type[] { typeof(Plugin), typeof(PluginNonDaxif) },
                CodeActivityInstanceTypes = new Type[] { typeof(AccountWorkflowActivity) },
                EnableProxyTypes          = true,
                IncludeAllWorkflows       = false,
                ExceptionFreeRequests     = new string[] { "TestWrongRequest" }
            };

#if XRM_MOCKUP_TEST_2011
            crm = XrmMockup2011.GetInstance(settings);
#elif XRM_MOCKUP_TEST_2013
            crm = XrmMockup2013.GetInstance(settings);
#elif XRM_MOCKUP_TEST_2015
            crm = XrmMockup2015.GetInstance(settings);
#elif XRM_MOCKUP_TEST_2016
            crm = XrmMockup2016.GetInstance(settings);
#elif XRM_MOCKUP_TEST_365
            crm = XrmMockup365.GetInstance(settings);
#endif
        }
Ejemplo n.º 4
0
        public static void InitializeMockup(TestContext context)
        {
            var additionalPluginMetadata = new MetaPlugin();

            additionalPluginMetadata.AssemblyName  = "DG.Some.Namespace.ContactIPluginDirectPreOp";
            additionalPluginMetadata.MessageName   = "Create";
            additionalPluginMetadata.PrimaryEntity = "contact";
            additionalPluginMetadata.Rank          = 10;
            additionalPluginMetadata.Stage         = 20; //pre op as it only updates a field name

            var additionalPluginMetadata2 = new MetaPlugin();

            additionalPluginMetadata2.AssemblyName  = "DG.Some.Namespace.ContactIPluginDirectPostOp";
            additionalPluginMetadata2.MessageName   = "Create";
            additionalPluginMetadata2.PrimaryEntity = "contact";
            additionalPluginMetadata2.Rank          = 10;
            additionalPluginMetadata2.Stage         = 40; //postOp

            var settings = new XrmMockupSettings
            {
                BasePluginTypes           = new Type[] { typeof(Plugin), typeof(PluginNonDaxif), typeof(ContactIPluginDirectPreOp) },
                CodeActivityInstanceTypes = new Type[] { typeof(AccountWorkflowActivity) },
                EnableProxyTypes          = true,
                IncludeAllWorkflows       = false,
                ExceptionFreeRequests     = new string[] { "TestWrongRequest" },
                MetadataDirectoryPath     = "../../../Metadata",
                IPluginMetadata           = new MetaPlugin[] { additionalPluginMetadata, additionalPluginMetadata2 }
                //MetadataDirectoryPath = @"C:\dev\MOD\CAMS\Plugins\XrmMockupTests\Metadata"
                , DatabaseConnectionString = "Server=.;Database=XrmMockup;Trusted_Connection=True;"
                , RecreateDatabase         = false
                                             //,RetainTables = new string[] { "fax" ,"goal","lead"}
                                             //  ,AppendAndAppendToPrivilegeCheck = false
            };

#if XRM_MOCKUP_TEST_2011
            crm = XrmMockup2011.GetInstance(settings);
#elif XRM_MOCKUP_TEST_2013
            crm = XrmMockup2013.GetInstance(settings);
#elif XRM_MOCKUP_TEST_2015
            crm = XrmMockup2015.GetInstance(settings);
#elif XRM_MOCKUP_TEST_2016
            crm = XrmMockup2016.GetInstance(settings);
#elif XRM_MOCKUP_TEST_365
            crm = XrmMockup365.GetInstance(settings);
#endif

            try
            {
                var realDataSettings = new XrmMockupSettings
                {
                    BasePluginTypes           = settings.BasePluginTypes,
                    CodeActivityInstanceTypes = settings.CodeActivityInstanceTypes,
                    EnableProxyTypes          = settings.EnableProxyTypes,
                    IncludeAllWorkflows       = settings.IncludeAllWorkflows,
                    ExceptionFreeRequests     = settings.ExceptionFreeRequests,
                    OnlineEnvironment         = new Env
                    {
                        providerType = AuthenticationProviderType.OnlineFederation,
                        uri          = "https://exampleURL/XRMServices/2011/Organization.svc",
                        username     = "******",
                        password     = "******"
                    }
                };
#if XRM_MOCKUP_TEST_2011
                crmRealData = XrmMockup2011.GetInstance(realDataSettings);
#elif XRM_MOCKUP_TEST_2013
                crmRealData = XrmMockup2013.GetInstance(realDataSettings);
#elif XRM_MOCKUP_TEST_2015
                crmRealData = XrmMockup2015.GetInstance(realDataSettings);
#elif XRM_MOCKUP_TEST_2016
                crmRealData = XrmMockup2016.GetInstance(realDataSettings);
#elif XRM_MOCKUP_TEST_365
                crmRealData = XrmMockup365.GetInstance(realDataSettings);
#endif
            }
            catch
            {
                // ignore
            }
        }
Ejemplo n.º 5
0
        public static void InitializeMockup(TestContext context)
        {
            var settings = new XrmMockupSettings
            {
                BasePluginTypes           = new Type[] { typeof(DG.Some.Namespace.Plugin), typeof(PluginNonDaxif) },
                CodeActivityInstanceTypes = new Type[] { typeof(AccountWorkflowActivity) },
                EnableProxyTypes          = true,
                IncludeAllWorkflows       = false,
                ExceptionFreeRequests     = new string[] { "TestWrongRequest" },
            };

            string workFlowAssembliesPath = WebConfigurationManager.AppSettings["CompiledWorkflowAssembliesPath"];
            var    librariesToIgnore      = new List <string>()
            {
                "Microsoft."
            };


#if XRM_MOCKUP_TEST_2011
            crm = XrmMockup2011.GetInstance(settings);
#elif XRM_MOCKUP_TEST_2013
            crm = XrmMockup2013.GetInstance(settings);
            var customWorkflowTypes = new List <Type>()
            {
                typeof(CodeActivity)
            };
            crm.RegisterWorkflowCodeActivitiesFromExternalAssemblies(workFlowAssembliesPath, customWorkflowTypes, librariesToIgnore);
#elif XRM_MOCKUP_TEST_2015
            crm = XrmMockup2015.GetInstance(settings);
            var customWorkflowTypes = new List <Type>()
            {
                typeof(CodeActivity)
            };
            crm.RegisterWorkflowCodeActivitiesFromExternalAssemblies(workFlowAssembliesPath, customWorkflowTypes, librariesToIgnore);
#elif XRM_MOCKUP_TEST_2016
            crm = XrmMockup2016.GetInstance(settings);
            var customWorkflowTypes = new List <Type>()
            {
                typeof(CodeActivity)
            };
            crm.RegisterWorkflowCodeActivitiesFromExternalAssemblies(workFlowAssembliesPath, customWorkflowTypes, librariesToIgnore);
#elif XRM_MOCKUP_TEST_365
            crm = XrmMockup365.GetInstance(settings);
            var customWorkflowTypes = new List <Type>()
            {
                typeof(CodeActivity)
            };
            crm.RegisterWorkflowCodeActivitiesFromExternalAssemblies(workFlowAssembliesPath, customWorkflowTypes, librariesToIgnore);
#endif

            string pluginAssembliesPath = WebConfigurationManager.AppSettings["CompiledPluginAssembliesPath"];
            crm.RegisterPluginsFromExternalAssemblies(pluginAssembliesPath, settings.BasePluginTypes.ToList(), librariesToIgnore);



            try
            {
                var realDataSettings = new XrmMockupSettings
                {
                    BasePluginTypes           = settings.BasePluginTypes,
                    CodeActivityInstanceTypes = settings.CodeActivityInstanceTypes,
                    EnableProxyTypes          = settings.EnableProxyTypes,
                    IncludeAllWorkflows       = settings.IncludeAllWorkflows,
                    ExceptionFreeRequests     = settings.ExceptionFreeRequests,
                    OnlineEnvironment         = new Env
                    {
                        providerType = AuthenticationProviderType.OnlineFederation,
                        uri          = "https://exampleURL/XRMServices/2011/Organization.svc",
                        username     = "******",
                        password     = "******"
                    }
                };
#if XRM_MOCKUP_TEST_2011
                crmRealData = XrmMockup2011.GetInstance(realDataSettings);
#elif XRM_MOCKUP_TEST_2013
                crmRealData = XrmMockup2013.GetInstance(realDataSettings);
#elif XRM_MOCKUP_TEST_2015
                crmRealData = XrmMockup2015.GetInstance(realDataSettings);
#elif XRM_MOCKUP_TEST_2016
                crmRealData = XrmMockup2016.GetInstance(realDataSettings);
#elif XRM_MOCKUP_TEST_365
                crmRealData = XrmMockup365.GetInstance(realDataSettings);
#endif
            }
            catch
            {
                // ignore
            }
        }