public void InitializeSetsSdkVersionPropertyOfGivenTelemetry() { var initializer = new SdkVersionPropertyContextInitializer(); var telemetryContext = new TelemetryContext(); initializer.Initialize(telemetryContext); Assert.NotNull(telemetryContext.Internal.SdkVersion); }
public void InitializeSetsSdkVersionValueAsAssemblyVersion() { var initializer = new SdkVersionPropertyContextInitializer(); var telemetryContext = new TelemetryContext(); initializer.Initialize(telemetryContext); string expectedSdkVersion; #if !WINRT expectedSdkVersion = typeof(SdkVersionPropertyContextInitializer).Assembly.GetCustomAttributes(false) .OfType<AssemblyFileVersionAttribute>() .First() .Version; #else expectedSdkVersion = typeof(SdkVersionPropertyContextInitializer).GetTypeInfo().Assembly.GetCustomAttributes<AssemblyFileVersionAttribute>() .First() .Version; #endif Assert.Equal(telemetryContext.Internal.SdkVersion, expectedSdkVersion); }
public void InitializeSetsSdkVersionValueAsAssemblyVersion() { var initializer = new SdkVersionPropertyContextInitializer(); var telemetryContext = new TelemetryContext(); initializer.Initialize(telemetryContext); string expectedSdkVersion; #if !WINRT expectedSdkVersion = typeof(SdkVersionPropertyContextInitializer).Assembly.GetCustomAttributes(false) .OfType <AssemblyFileVersionAttribute>() .First() .Version; #else expectedSdkVersion = typeof(SdkVersionPropertyContextInitializer).GetTypeInfo().Assembly.GetCustomAttributes <AssemblyFileVersionAttribute>() .First() .Version; #endif Assert.Equal(telemetryContext.Internal.SdkVersion, expectedSdkVersion); }