예제 #1
0
        public void IoCContainer_Contains_Expected_Registrations()
        {
            var connector = new TestableConnector(false); //do not override container registrations.

            Assert.AreEqual(14, connector.TestableContainer.Count);
            //verify expected concrete implementatino for telemetry support
            Assert.IsTrue(connector.TestableContainer.IsRegisteredAs <IXrmTelemetryPropertyManager, DefaultPluginPropertyManager>(true));
            Assert.IsTrue(connector.TestableContainer.IsRegisteredAs <IEventLogger, InertEventLogger>(true));
            Assert.IsTrue(connector.TestableContainer.IsRegisteredAs <ITelemetryFactory, TelemetryFactory>(true));
            Assert.IsTrue(connector.TestableContainer.IsRegisteredAs <ITelemetryClientFactory, TelemetryClientFactory>(true));
            Assert.IsTrue(connector.TestableContainer.IsRegisteredAs <ITelemetryContext, TelemetryContext>());
            Assert.IsTrue(connector.TestableContainer.IsRegisteredAs <ITelemetryInitializerChain, TelemetryInitializerChain>());
            Assert.IsTrue(connector.TestableContainer.IsRegisteredAs <ITelemetrySink, TelemetrySink>());
            Assert.IsTrue(connector.TestableContainer.IsRegisteredAs <ITelemetryProcessChain, TelemetryProcessChain>());
            Assert.IsTrue(connector.TestableContainer.IsRegisteredAs <ITelemetryChannel, SyncMemoryChannel>());
            Assert.IsTrue(connector.TestableContainer.IsRegisteredAs <ITelemetryBuffer, TelemetryBuffer>());
            Assert.IsTrue(connector.TestableContainer.IsRegisteredAs <ITelemetryTransmitter, AITelemetryTransmitter>());
            Assert.IsTrue(connector.TestableContainer.IsRegisteredAs <IContextTagKeys, AIContextTagKeys>());
            Assert.IsTrue(connector.TestableContainer.IsRegisteredAs <ITelemetrySerializer, AITelemetrySerializer>());
            Assert.IsTrue(connector.TestableContainer.IsRegisteredAs <IJsonWriterFactory, JsonWriterFactory>());
        }
예제 #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));
        }