ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [28/50] ignite git commit: LockInfoTest added
Date Thu, 08 Sep 2016 14:46:10 GMT
LockInfoTest added


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

Branch: refs/heads/ignite-3199-1
Commit: 51bbcda0aa9ca7c6d03a9e4fa9ee7ce7ce8f6a91
Parents: bf27a90
Author: Pavel Tupitsyn <ptupitsyn@apache.org>
Authored: Tue Sep 6 11:08:55 2016 +0300
Committer: Pavel Tupitsyn <ptupitsyn@apache.org>
Committed: Tue Sep 6 11:08:55 2016 +0300

----------------------------------------------------------------------
 .../Apache.Ignite.Core.Tests.csproj             |  1 +
 .../AspNet/LockInfoTest.cs                      | 64 ++++++++++++++++++++
 2 files changed, 65 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/51bbcda0/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 d74fdf4..3cb3ff2 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
@@ -64,6 +64,7 @@
     <Compile Include="AspNet\IgniteSessionStateItemCollectionTest.cs" />
     <Compile Include="AspNet\IgniteSessionStateStoreDataTest.cs" />
     <Compile Include="AspNet\IgniteSessionStateStoreProviderTest.cs" />
+    <Compile Include="AspNet\LockInfoTest.cs" />
     <Compile Include="Binary\BinaryReaderWriterTest.cs" />
     <Compile Include="Binary\IO\BinaryStreamsTest.cs" />
     <Compile Include="Binary\JavaTypeMappingTest.cs" />

http://git-wip-us.apache.org/repos/asf/ignite/blob/51bbcda0/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/LockInfoTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/LockInfoTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/LockInfoTest.cs
new file mode 100644
index 0000000..dada98d
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/LockInfoTest.cs
@@ -0,0 +1,64 @@
+/*
+ * 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.AspNet
+{
+    using System;
+    using Apache.Ignite.Core.Impl.AspNet;
+    using NUnit.Framework;
+
+    /// <summary>
+    /// Tests for <see cref="LockInfo"/>.
+    /// </summary>
+    public class LockInfoTest
+    {
+        /// <summary>
+        /// Tests the equality.
+        /// </summary>
+        [Test]
+        public void TestEquality()
+        {
+            var lock1 = new LockInfo(1, Guid.NewGuid(), DateTime.UtcNow);
+            var lock2 = new LockInfo(2, Guid.NewGuid(), DateTime.UtcNow.AddDays(1));
+            var lock3 = new LockInfo(lock1.LockId, lock1.LockNodeId, lock1.LockTime);
+
+            Assert.AreEqual(lock1, lock3);
+            Assert.AreEqual(lock1.GetHashCode(), lock3.GetHashCode());
+
+            Assert.IsTrue(lock1 == lock3);
+            Assert.IsFalse(lock1 != lock3);
+
+            Assert.AreNotEqual(lock1, lock2);
+            Assert.AreNotEqual(lock1.GetHashCode(), lock2.GetHashCode());
+
+            Assert.IsFalse(lock1 == lock2);
+            Assert.IsTrue(lock1 != lock2);
+        }
+
+        /// <summary>
+        /// Tests the serialization.
+        /// </summary>
+        [Test]
+        public void TestSerialization()
+        {
+            var lock1 = new LockInfo(2, Guid.NewGuid(), DateTime.UtcNow.AddDays(1));
+            var lock2 = TestUtils.SerializeDeserialize(lock1);
+
+            Assert.AreEqual(lock1, lock2);
+        }
+    }
+}


Mime
View raw message