You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2016/03/02 07:16:16 UTC

ignite git commit: IGNITE-2705: .NET: Added test for tools version. This closes #529.

Repository: ignite
Updated Branches:
  refs/heads/master 3b44cc4fe -> a4391d793


IGNITE-2705: .NET: Added test for tools version. This closes #529.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a4391d79
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a4391d79
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a4391d79

Branch: refs/heads/master
Commit: a4391d7935199a658d6dd4ac3fc8fa601e36c3f5
Parents: 3b44cc4
Author: Pavel Tupitsyn <pt...@gridgain.com>
Authored: Wed Mar 2 09:11:06 2016 +0300
Committer: thatcoach <pp...@list.ru>
Committed: Wed Mar 2 09:11:06 2016 +0300

----------------------------------------------------------------------
 .../Apache.Ignite.Core.Tests.csproj             |  1 +
 .../ProjectFilesTest.cs                         | 94 ++++++++++++++++++++
 2 files changed, 95 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/a4391d79/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
index 6f0e630..4ba05e1 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
@@ -130,6 +130,7 @@
     <Compile Include="BinaryConfigurationTest.cs" />
     <Compile Include="Binary\BinaryStructureTest.cs" />
     <Compile Include="ProcessExtensions.cs" />
+    <Compile Include="ProjectFilesTest.cs" />
     <Compile Include="ReconnectTest.cs" />
     <Compile Include="SerializationTest.cs" />
     <Compile Include="IgniteStartStopTest.cs" />

http://git-wip-us.apache.org/repos/asf/ignite/blob/a4391d79/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ProjectFilesTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ProjectFilesTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ProjectFilesTest.cs
new file mode 100644
index 0000000..081dd89
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ProjectFilesTest.cs
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Apache.Ignite.Core.Tests
+{
+    using System;
+    using System.IO;
+    using System.Linq;
+    using System.Reflection;
+    using NUnit.Framework;
+
+    /// <summary>
+    /// Verifies source files.
+    /// </summary>
+    public class ProjectFilesTest
+    {
+        /// <summary>
+        /// Tests that tools version is compatible with VS2010.
+        /// </summary>
+        [Test]
+        public void TestCsprojToolsVersion()
+        {
+            var projFiles = GetDotNetSourceDir().GetFiles("*.csproj", SearchOption.AllDirectories);
+            Assert.GreaterOrEqual(projFiles.Length, 7);
+
+            var invalidFiles =
+                projFiles.Where(x =>
+                {
+                    var text = File.ReadAllText(x.FullName);
+
+                    return !text.Contains("ToolsVersion=\"4.0\"") ||
+                           text.IndexOf("AnyCPU", StringComparison.OrdinalIgnoreCase) >= 0;
+                }).ToArray();
+
+            Assert.AreEqual(0, invalidFiles.Length,
+                "Invalid csproj files: " + string.Join(", ", invalidFiles.Select(x => x.FullName)));
+        }
+
+        /// <summary>
+        /// Tests that tools version is compatible with VS2010.
+        /// </summary>
+        [Test]
+        public void TestSlnToolsVersion()
+        {
+            var slnFiles = GetDotNetSourceDir().GetFiles("*.sln", SearchOption.AllDirectories);
+            Assert.GreaterOrEqual(slnFiles.Length, 2);
+
+            var invalidFiles =
+                slnFiles.Where(x =>
+                {
+                    var text = File.ReadAllText(x.FullName);
+
+                    return !text.Contains("# Visual Studio 2010") ||
+                           !text.Contains("Microsoft Visual Studio Solution File, Format Version 11.00");
+                }).ToArray();
+
+            Assert.AreEqual(0, invalidFiles.Length,
+                "Invalid sln files: " + string.Join(", ", invalidFiles.Select(x => x.FullName)));
+        }
+
+        /// <summary>
+        /// Gets the dot net source dir.
+        /// </summary>
+        private static DirectoryInfo GetDotNetSourceDir()
+        {
+            // ReSharper disable once AssignNullToNotNullAttribute
+            var dir = new DirectoryInfo(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
+
+            while (dir != null)
+            {
+                if (dir.GetFiles().Any(x => x.Name == "Apache.Ignite.sln"))
+                    return dir;
+
+                dir = dir.Parent;
+            }
+
+            throw new InvalidOperationException("Could not resolve Ignite.NET source directory.");
+        }
+    }
+}