protected override void CorrectProjectReferences(Project project)
        {
            var additionalCompileItems = new[]
            {
                UnitTestStrategiesHelper.TestedCodeFileName,
                SetupFixtureFileName
            };

            project.AddCompileItems(additionalCompileItems);

            project.EnsureAssemblyNameIsCorrect();

            // Remove the first Project Reference (this should be the reference to the tested project)
            var projectReference = project.GetItems("ProjectReference").FirstOrDefault();

            if (projectReference != null)
            {
                project.RemoveItem(projectReference);
            }

            project.SetProperty("OutputType", "Library");

            project.RemoveItemByName(NUnitFrameworkPackageName);

            // Add our NUnit Reference
            project.AddReferences(NUnitReference);

            // If we use NUnit we don't really need the VSTT, it will save us copying of the .dll
            project.RemoveItemByName(VsttPackageName);

            project.Save(project.FullPath);
            project.ProjectCollection.UnloadAllProjects();

            project.RemoveNuGetPackageImportsTarget();
        }
Example #2
0
        protected virtual void CorrectProjectReferences(Project project)
        {
            var additionalCompileItems = new List <string>(this.TestNames)
            {
                SetupFixtureFileName
            };

            project.AddCompileItems(additionalCompileItems);

            project.EnsureAssemblyNameIsCorrect();

            project.SetProperty("OutputType", "Library");

            project.AddReferences(
                NUnitReference,
                EntityFrameworkCoreInMemoryReference,
                SystemDataCommonReference);

            // Check for VSTT just in case, we don't want Assert conflicts
            project.RemoveItemByName(VsttPackageName);

            project.Save(project.FullPath);
            project.ProjectCollection.UnloadAllProjects();

            project.RemoveNuGetPackageImportsTarget();
        }