public void IsTestInScopeTest()
 {
     var att = new ProjectAttributes(@"/usr/lib/System.Core-test.csproj");
     Assert.IsTrue(att.IsTest);
     Assert.AreEqual(att.Target, Targets.All);
     Assert.IsFalse(att.HasScope);
     Assert.AreEqual(att.Name, "System.Core");
 }
 public void NoScopeTest()
 {
     var att = new ProjectAttributes(@"/usr/lib/basic-System.Core.csproj");
     Assert.IsFalse(att.IsTest);
     Assert.AreEqual(att.Target, Targets.Basic);
     Assert.IsFalse(att.HasScope);
     Assert.AreEqual(att.Name, "System.Core");
 }
 public void DotNet4Dot5Test()
 {
     var att = new ProjectAttributes(@"/usr/lib/net_4_5-build-System.Core.csproj");
     Assert.IsFalse(att.IsTest);
     Assert.AreEqual(att.Target, Targets.Net4Dot5);
     Assert.IsTrue(att.HasScope);
     Assert.AreEqual(att.Scope, Scopes.build);
     Assert.AreEqual(att.Name, "System.Core");
 }
Exemple #4
0
 public string FindSourcesFile()
 {
     var files =
         _fileSystem.GetFiles(_directory, "*.sources", SearchOption.TopDirectoryOnly)
             .Select(Path.GetFileName)
             .ToArray();
     if (files.Length == 0)
     {
         throw new InvalidOperationException("No sources found for " + _projectFilePath);
     }
     var attributes = new ProjectAttributes(_projectFilePath);
     var currentStep = 0;
     while (files.Length != 1 && currentStep < _steps.Count)
     {
         var res = _steps[currentStep].Filter(files, attributes);
         if (res.Length > 0) // Discard any filter that removed all values
         {
             files = res;
         }
         ++currentStep;
     }
     if (files.Length != 1)
     {
         throw new InvalidOperationException("Unable to find unique source for " + _projectFilePath);
     }
     return files.First();
 }