public void CanCreateDataKeyTelemetryContext() { ITelemetryContext context = new DataKeyTelemetryContext(); //should be instance of TelemetryContext Assert.IsInstanceOfType(context, typeof(TelemetryContext)); //implements ITelemetryContext Assert.IsInstanceOfType(context, typeof(ITelemetryContext)); //implements ISupportDataKeyContext Assert.IsInstanceOfType(context, typeof(ISupportDataKeyContext)); }
private DataKeyTelemetryContext generateInitiatedDataKeyTelemetryContext() { var context = new DataKeyTelemetryContext(); context.Cloud.RoleInstance = "cloud.roleinstance"; context.Cloud.RoleName = "cloud.rolename"; context.Component.Name = "component.name"; context.Component.Version = "component.version"; context.Data.RecordId = "data.recordid"; context.Data.RecordType = "data.recordtype"; context.Device.Id = "device.id"; context.Device.Model = "device.model"; context.Device.OemName = "device.oemname"; context.Device.OperatingSystem = "device.operatingsytem"; context.Device.Type = "device.type"; context.InstrumentationKey = "key"; context.Internal.AgentVersion = "internal.agentversion"; context.Internal.NodeName = "internal.nodename"; context.Internal.SdkVersion = "internal.sdkversion"; context.Location.Ip = "location.ip"; context.Operation.CorrelationVector = "operation.vector"; context.Operation.Id = "operation.id"; context.Operation.Name = "operation.name"; context.Operation.ParentId = "operation.parentid"; context.Session.Id = "session.id"; context.Session.IsFirst = true; context.User.AccountId = "user.accountid"; context.User.AuthenticatedUserId = "user.authenticateduserid"; context.User.Id = "user.id"; context.User.UserAgent = "user.agent"; context.Properties.Add("custom-1", "value-1"); context.Properties.Add("custom-2", "value-2"); return(context); }
public void CanCloneUninitializedDataKeyTelemetryContext() { var context = new DataKeyTelemetryContext(); var clone = context.DeepClone(); Assert.IsInstanceOfType(clone, typeof(DataKeyTelemetryContext)); Assert.AreNotSame(context, clone); Assert.AreNotSame(context.Cloud, clone.Cloud); Assert.AreNotSame(context.Component, clone.Component); Assert.AreNotSame(context.Data, (clone as ISupportDataKeyContext).Data); Assert.AreNotSame(context.Device, clone.Device); Assert.AreNotSame(context.Internal, clone.Internal); Assert.AreNotSame(context.Location, clone.Location); Assert.AreNotSame(context.Operation, clone.Operation); Assert.AreNotSame(context.Properties, clone.Properties); Assert.AreNotSame(context.Session, clone.Session); Assert.AreNotSame(context.User, clone.User); }
public void NewDataKeyTelemetryContextIsNotInitialized() { var context = new DataKeyTelemetryContext(); Assert.IsNull(context.Cloud.RoleInstance); Assert.IsNull(context.Cloud.RoleName); Assert.IsNull(context.Component.Name); Assert.IsNull(context.Component.Version); Assert.IsNull(context.Data.RecordId); Assert.IsNull(context.Data.RecordType); Assert.IsNull(context.Device.Id); Assert.IsNull(context.Device.Model); Assert.IsNull(context.Device.OemName); Assert.IsNull(context.Device.OperatingSystem); Assert.IsNull(context.Device.Type); Assert.IsNull(context.InstrumentationKey); Assert.IsNull(context.Internal.AgentVersion); Assert.IsNull(context.Internal.NodeName); Assert.IsNull(context.Internal.SdkVersion); Assert.IsNull(context.Location.Ip); Assert.IsNull(context.Operation.CorrelationVector); Assert.IsNull(context.Operation.Id); Assert.IsNull(context.Operation.Name); Assert.IsNull(context.Operation.ParentId); Assert.AreEqual(0, context.Properties.Count); Assert.IsNull(context.Session.Id); Assert.IsNull(context.Session.IsFirst); Assert.IsNull(context.User.AccountId); Assert.IsNull(context.User.AuthenticatedUserId); Assert.IsNull(context.User.Id); Assert.IsNull(context.User.UserAgent); }