Skip to content
This repository has been archived by the owner on Jul 5, 2020. It is now read-only.

Commit

Permalink
fix .Test project references (#801)
Browse files Browse the repository at this point in the history
* consolidate shared test classes. fix references.

* remove empty test project

* fixing references

* resolving compiler warnings

* ignore assembly conflict

* resolving duplicate files. resolving hidden files.

* moving non test class to shared project

* consolidate another duplicate test file. add pragma restore

* fix stylecop: using ordering.
adding more 1591 exclude

* Update Readme describing Shared Projects
  • Loading branch information
TimothyMothra authored Jan 30, 2018
1 parent 47d1869 commit e95d9ca
Show file tree
Hide file tree
Showing 38 changed files with 227 additions and 1,062 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ If you prefer using build scripts, run ```buildDebug.cmd``` or ```buildRelease.c
- [master][master] contains the *latest* published release located on [NuGet][WebNuGet].
- [develop][develop] contains the code for the *next* release.

## Shared Projects

Our projects target multiple frameworks (ex: Net45 & NetCore). We have framework specific projects and a shared project for common files between them. (ex: Perf.Net45, Perf.NetCore, Perf.Shared). If a file is used by both frameworks, we prefer to store that file in a Shared project and use preprocessor directives to separate framework specific code (ex: `#if NETCORE, #if !NETCORE`). We also use a conditional ItemGroup to assign files to a framework (ex: `ItemGroup Condition=" '$(TargetFramework)' != 'netcoreapp1.0' "`).

We've found that this makes our projects easier to maintain because it keeps Framework assignments in a single project. As an added bonus our Framework specific projects can include a single Shared project instead of individual files, which keeps our project files neat and clean.

## Contributing

We strongly welcome and encourage contributions to this project. Please read the [contributor's guide][ContribGuide]. If making a large change we request that you open an [issue][GitHubIssue] first. If we agree that an issue is a bug, we'll add the "bug" label, and issues that we plan to fix are labeled with an iteration number. We follow the [Git Flow][GitFlow] approach to branching.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,39 +72,17 @@
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\TestFramework\Net45\TestFramework.Net45.csproj">
<Project>{1be54ee7-6627-4206-86dd-3d2c709a1500}</Project>
<Name>TestFramework.Net45</Name>
</ProjectReference>
<ProjectReference Include="..\Net45\DependencyCollector.Net45.csproj">
<Project>{ea2d14aa-ae1e-4982-9326-11d4dcbb9529}</Project>
<Name>DependencyCollector.Net45</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\Shared.Tests\Implementation\DependencyCollectorDiagnosticListenerTests.Netstandard16.cs">
<Link>DependencyCollectorDiagnosticListenerTests.Netstandard16.cs</Link>
</Compile>
<Compile Include="..\Shared.Tests\Implementation\DependencyCollectorDiagnosticListenerTests.Netstandard20.cs">
<Link>DependencyCollectorDiagnosticListenerTests.Netstandard20.cs</Link>
</Compile>
<Compile Include="..\Shared.Tests\Implementation\TelemetryDiagnosticSourceListenerTests.cs">
<Link>TelemetryDiagnosticSourceListenerTests.cs</Link>
</Compile>
<Compile Include="..\Shared.Tests\Implementation\EnumerableAssert.cs">
<Link>EnumerableAssert.cs</Link>
</Compile>
<Compile Include="..\Shared.Tests\Implementation\HttpHeadersUtilitiesTests.cs">
<Link>HttpHeadersUtilitiesTests.cs</Link>
</Compile>
<Compile Include="..\Shared.Tests\Implementation\MockCorrelationIdLookupHelper.cs">
<Link>MockCorrelationIdLookupHelper.cs</Link>
</Compile>
<Compile Include="DependencyTrackingTelemetryModuleHttpTest.cs" />
<Compile Include="HttpWebRequestUtils.cs" />
<Compile Include="DependencyTrackingTelemetryModuleTest.cs" />
</ItemGroup>
<Import Project="..\Shared.Tests\DependencyCollector.Shared.Tests.projitems" Label="Shared" />
<Import Project="..\..\TestFramework\Shared\TestFramework.Shared.projitems" Label="Shared" />
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'Common.targets'))\Common.targets" />
Expand Down

This file was deleted.

This file was deleted.

10 changes: 2 additions & 8 deletions Src/DependencyCollector/Net45/DependencyCollector.Net45.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\..\packages\MicroBuild.Core.0.2.0\build\MicroBuild.Core.props" Condition="Exists('..\..\..\..\packages\MicroBuild.Core.0.2.0\build\MicroBuild.Core.props')" />
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), 'Product.props'))\Product.props" />
Expand Down Expand Up @@ -50,12 +50,6 @@
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\TestFramework\Net45\TestFramework.Net45.csproj">
<Project>{1be54ee7-6627-4206-86dd-3d2c709a1500}</Project>
<Name>TestFramework.Net45</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\..\..\..\packages\Desktop.Analyzers.1.1.0\analyzers\dotnet\cs\Desktop.Analyzers.dll" />
<Analyzer Include="..\..\..\..\packages\Desktop.Analyzers.1.1.0\analyzers\dotnet\cs\Desktop.CSharp.Analyzers.dll" />
Expand All @@ -74,4 +68,4 @@
<Import Project="..\..\..\..\packages\MicroBuild.Core.0.2.0\build\MicroBuild.Core.targets" Condition="Exists('..\..\..\..\packages\MicroBuild.Core.0.2.0\build\MicroBuild.Core.targets')" />
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'Common.targets'))\Common.targets" />
<Import Project="..\..\..\..\packages\StyleCop.MSBuild.4.7.54.0\build\StyleCop.MSBuild.Targets" Condition="Exists('..\..\..\..\packages\StyleCop.MSBuild.4.7.54.0\build\StyleCop.MSBuild.Targets')" />
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,20 @@
<PackageTargetFallback>$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<DoNotSign>true</DoNotSign>
</PropertyGroup>

<ItemGroup>
<Compile Include="..\Shared.Tests\Implementation\DependencyCollectorDiagnosticListenerTests.Netstandard16.cs" Link="DependencyCollectorDiagnosticListenerTests.Netstandard16.cs" />
<Compile Include="..\Shared.Tests\Implementation\DependencyCollectorDiagnosticListenerTests.Netstandard20.cs" Link="DependencyCollectorDiagnosticListenerTests.Netstandard20.cs" />
<Compile Include="..\Shared.Tests\Implementation\TelemetryDiagnosticSourceListenerTests.cs" Link="TelemetryDiagnosticSourceListenerTests.cs" />
<Compile Include="..\Shared.Tests\Implementation\SqlClientDiagnosticSourceListenerTests.cs" Link="SqlClientDiagnosticSourceListenerTests.cs" />
<Compile Include="..\Shared.Tests\Implementation\ServiceBusDiagnosticListenerTests.cs" Link="ServiceBusDiagnosticListenerTests.cs" />
<Compile Include="..\Shared.Tests\Implementation\EnumerableAssert.cs" Link="EnumerableAssert.cs" />
<Compile Include="..\Shared.Tests\Implementation\MockCorrelationIdLookupHelper.cs" Link="MockCorrelationIdLookupHelper.cs" />
<Compile Include="..\..\TestFramework\Shared\SdkVersionHelper.cs" Link="SdkVersionHelper.cs" />
</ItemGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<NoWarn>1701;1702;1705;1591</NoWarn>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\NetCore\DependencyCollector.NetCore.csproj" />
</ItemGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<NoWarn>1701;1702;1705;1591</NoWarn>
</PropertyGroup>

<ItemGroup>
<Compile Include="..\Shared.Tests\HttpDependenciesParsingTelemetryInitializerTest.cs" Link="HttpDependenciesParsingTelemetryInitializerTest.cs" />
<ProjectReference Include="..\NetCore\DependencyCollector.NetCore.csproj" />
</ItemGroup>

<ItemGroup>
Expand All @@ -51,4 +45,7 @@
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>

<Import Project="..\Shared.Tests\DependencyCollector.Shared.Tests.projitems" Label="Shared" />
<Import Project="..\..\TestFramework\Shared\TestFramework.Shared.projitems" Label="Shared" />

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using Microsoft.ApplicationInsights.Extensibility;
using Microsoft.ApplicationInsights.Extensibility.Implementation;
using Microsoft.ApplicationInsights.TestFramework;
using Microsoft.ApplicationInsights.Web.TestFramework;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
Expand Down
80 changes: 0 additions & 80 deletions Src/DependencyCollector/NetCore.Tests/StubTelemetryChannel.cs

This file was deleted.

Loading

0 comments on commit e95d9ca

Please sign in to comment.