public RunInfo[] PreProcess(RunInfo[] details) { var switcher = new MSTestSwitcharoo(Environment.OSVersion.Platform, Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); details .Where(x => x.Project != null).ToList() .ForEach(x => { if (File.Exists(x.TemporaryBuildProject)) { var project = File.ReadAllText(x.TemporaryBuildProject); if (switcher.IsGuyInCloset(project)) File.WriteAllText(x.TemporaryBuildProject, switcher.PerformSwitch(project)); } else { var project = File.ReadAllText(x.Project.Key); if (switcher.IsGuyInCloset(project)) { var tmpProject = getTempProject(x.Project.Key); // We can do this because we know they are ordered in the right order _tmpProjects.ForEach(y => project = project .Replace("\\" + Path.GetFileName(getOriginalProject(y)), "\\" + Path.GetFileName(y)) .Replace("\"" + Path.GetFileName(getOriginalProject(y)), "\"" + Path.GetFileName(y))); File.WriteAllText(tmpProject, switcher.PerformSwitch(project)); _tmpProjects.Add(tmpProject); x.BuildTemporaryProject(tmpProject); } } }); return details; }
public RunInfo[] PreProcess(RunInfo[] details) { var switcher = new MSTestSwitcharoo(Environment.OSVersion.Platform, Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); details .Where(x => x.Project != null).ToList() .ForEach(x => { if (File.Exists(x.TemporaryBuildProject)) { var project = File.ReadAllText(x.TemporaryBuildProject); if (switcher.IsGuyInCloset(project)) { File.WriteAllText(x.TemporaryBuildProject, switcher.PerformSwitch(project)); Debug.WriteDebug("Switched to our mstest impl. for {0}", x.TemporaryBuildProject); } } else { if (File.Exists(x.Project.Key)) { var project = File.ReadAllText(x.Project.Key); if (switcher.IsGuyInCloset(project)) { var tmpProject = getTempProject(x.Project.Key); // We can do this because we know they are ordered in the right order _tmpProjects.ForEach(y => project = project .Replace( "\\" + Path.GetFileName( getOriginalProject(y)), "\\" + Path.GetFileName(y)) .Replace( "\"" + Path.GetFileName( getOriginalProject(y)), "\"" + Path.GetFileName(y))); File.WriteAllText(tmpProject, switcher.PerformSwitch(project)); _tmpProjects.Add(tmpProject); x.BuildTemporaryProject(tmpProject); Debug.WriteDebug("Switched to our mstest impl. for {0}", x.Project.Key); } } } }); return(details); }
public void When_replacing_mstest_the_ms_test_reference_is_gone_while_our_impl_is_added() { var project = new MSTestSwitcharoo(PlatformID.Unix, "/path/to").PerformSwitch(this.project()); Assert.That(project, Is.Not.StringContaining(singleLineReference())); Assert.That(project, Is.StringContaining(ourImplReference())); }