/// <summary> /// Unit test projects should not reference each other. In order for unit tests to be run / F5 they must be /// modeled as deployment projects. Having Unit Tests reference each other hurts that because it ends up /// putting two copies of the unit test DLL into the UnitTest folder: /// /// 1. UnitTests\Current\TheUnitTest\TheUnitTest.dll /// 2. UnitTests\Current\TheOtherTests\ /// TheUnitTests.dll /// TheOtherTests.dll /// /// This is problematic as all of our tools do directory based searches for unit test DLLs. Hence they end up /// getting counted twice. /// /// Consideration was given to fixing up all of the tools but it felt like fighting against the grain. Pretty /// much every repo has this practice. /// </summary> private bool CheckUnitTestReferenceRestriction(TextWriter textWriter, IEnumerable <ProjectKey> declaredReferences) { var data = _projectUtil.TryGetRoslynProjectData(); if (!data.HasValue || !data.Value.IsAnyUnitTest) { return(true); } var allGood = true; foreach (var key in declaredReferences) { ProjectData projectData; if (!_solutionMap.TryGetValue(key, out projectData)) { continue; } var refData = projectData.ProjectUtil.TryGetRoslynProjectData(); if (refData.HasValue && refData.Value.IsAnyUnitTest) { textWriter.WriteLine($"Cannot reference {key.FileName} as it is another unit test project"); allGood = false; } } return(allGood); }
private bool CheckDeploymentSettings(TextWriter textWriter) { var data = _projectUtil.TryGetRoslynProjectData(); if (data?.EffectiveKind == RoslynProjectKind.Custom) { return(true); } var allGood = CheckForProperty(textWriter, "CopyNuGetImplementations"); allGood &= CheckForProperty(textWriter, "UseCommonOutputDirectory"); return(allGood); }
private bool CheckDeploymentSettings(TextWriter textWriter) { var data = _projectUtil.TryGetRoslynProjectData(); if (data?.EffectiveKind == RoslynProjectKind.Custom) { return(true); } return(true); /* Disabled while staging the closed / open change. * var allGood = CheckForProperty(textWriter, "CopyNuGetImplementations"); * allGood &= CheckForProperty(textWriter, "UseCommonOutputDirectory"); * return allGood; */ }