public void InitRoleInfo_NullResource() { TelemetryPartA.InitRoleInfo(null); Assert.Null(TelemetryPartA.RoleName); Assert.Null(TelemetryPartA.RoleInstance); }
public void InitRoleInfo_ServiceNameAndInstance() { using var activity = new Activity("InitRoleInfo_ServiceNameAndInstance"); activity.SetCustomProperty(ResourcePropertyName, Resources.CreateServiceResource("my-service", "roleInstance_1")); TelemetryPartA.InitRoleInfo(activity); Assert.Equal("my-service", TelemetryPartA.RoleName); Assert.Equal("roleInstance_1", TelemetryPartA.RoleInstance); }
public void InitRoleInfo_ServiceNamespace() { using var activity = new Activity("InitRoleInfo_ServiceNamespace"); activity.SetCustomProperty(ResourcePropertyName, Resources.CreateServiceResource(null, null, "my-namespace")); TelemetryPartA.InitRoleInfo(activity); Assert.Null(TelemetryPartA.RoleName); Assert.Null(TelemetryPartA.RoleInstance); }
public void InitRoleInfo_ServiceName() { using var activity = new Activity("InitRoleInfo_ServiceName"); activity.SetCustomProperty(ResourcePropertyName, Resources.CreateServiceResource("my-service")); TelemetryPartA.InitRoleInfo(activity); Assert.Equal("my-service", TelemetryPartA.RoleName); Assert.True(Guid.TryParse(TelemetryPartA.RoleInstance, out var guid)); }
public void InitRoleInfo_ServiceNameAndInstance() { var resource = CreateTestResource(serviceName: "my-service", serviceInstance: "my-instance"); TelemetryPartA.InitRoleInfo(resource); Assert.Equal("my-service", TelemetryPartA.RoleName); Assert.Equal("my-instance", TelemetryPartA.RoleInstance); }
public void InitRoleInfo_ServiceNamespace() { var resource = CreateTestResource(serviceNamespace: "my-namespace"); TelemetryPartA.InitRoleInfo(resource); Assert.StartsWith("my-namespace.unknown_service", TelemetryPartA.RoleName); Assert.Null(TelemetryPartA.RoleInstance); }
public void InitRoleInfo_Default() { var resource = CreateTestResource(); TelemetryPartA.InitRoleInfo(resource); Assert.StartsWith("unknown_service", TelemetryPartA.RoleName); Assert.Null(TelemetryPartA.RoleInstance); }