示例#1
0
        public void Account_Exists(IChallengeSolution solution)
        {
            // prepare the input
            var fakedContext = new FakeXrmEasy.XrmFakedContext();

            // Prepare the data
            // no data to prepare in this case

            solution.Run(fakedContext.GetOrganizationService());

            // check the output
            // There has to be an account created
            if (!fakedContext.Data.ContainsKey("account") || fakedContext.Data["account"].Count == 0)
            {
                throw new Exception("No accounts were created");
            }
        }
示例#2
0
        private IXrmAppInsightsClient getClient()
        {
            connector = new TestableConnector();
            var xrmFake = new FakeXrmEasy.XrmFakedContext();

            pluginContext = xrmFake.GetDefaultPluginContext();
            pluginContext.CorrelationId     = Guid.NewGuid();
            pluginContext.Depth             = 2;
            pluginContext.InitiatingUserId  = Guid.NewGuid();
            pluginContext.IsInTransaction   = true;
            pluginContext.IsolationMode     = 1;
            pluginContext.MessageName       = "Update";
            pluginContext.OperationId       = Guid.NewGuid();
            pluginContext.OrganizationId    = Guid.NewGuid();
            pluginContext.OrganizationName  = "MyOrgName";
            pluginContext.PrimaryEntityId   = Guid.NewGuid();
            pluginContext.PrimaryEntityName = "contact";
            pluginContext.Stage             = 20;
            pluginContext.RequestId         = Guid.NewGuid();
            pluginContext.UserId            = Guid.NewGuid();

            return(connector.BuildClient(this.GetType().ToString(), pluginContext, testKey));
        }