Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

converted tests to use Xunit

  • Loading branch information...
commit a80fb8c2d301bc20cdb4f8caf53f3cc5d2939257 1 parent 4ec2dd1
@nberardi nberardi authored
Showing with 992 additions and 970 deletions.
  1. +15 −11 test/FluentCassandra.Tests/Bugs/Issue25JavaBigDecimalBinaryConversion.cs
  2. +30 −17 test/FluentCassandra.Tests/CassandraDatabaseSetup.cs
  3. +23 −0 test/FluentCassandra.Tests/CassandraDatabaseSetupFixture.cs
  4. +35 −36 test/FluentCassandra.Tests/CassandraQueryTest.cs
  5. +6 −6 test/FluentCassandra.Tests/Connections/ConnectionProviderTests.cs
  6. +5 −5 test/FluentCassandra.Tests/Connections/NormalConnectionProviderTests.cs
  7. +3 −9 test/FluentCassandra.Tests/FluentCassandra.Tests.csproj
  8. +58 −58 test/FluentCassandra.Tests/FluentColumnFamilyTest.cs
  9. +6 −6 test/FluentCassandra.Tests/FluentColumnTest.cs
  10. +33 −33 test/FluentCassandra.Tests/FluentSuperColumnFamilyTest.cs
  11. +32 −32 test/FluentCassandra.Tests/FluentSuperColumnTest.cs
  12. +14 −14 test/FluentCassandra.Tests/GuidGeneratorTest.cs
  13. +43 −39 test/FluentCassandra.Tests/Linq/LinqToCqlCassandraTests.cs
  14. +47 −43 test/FluentCassandra.Tests/Linq/LinqToCqlObjectsCassandraTests.cs
  15. +20 −16 test/FluentCassandra.Tests/Linq/LinqToCqlObjectsTests.cs
  16. +23 −19 test/FluentCassandra.Tests/Linq/LinqToCqlTests.cs
  17. +63 −63 test/FluentCassandra.Tests/Operations/CassandraIndexClauseTest.cs
  18. +15 −16 test/FluentCassandra.Tests/Operations/ColumnCountTest.cs
  19. +8 −10 test/FluentCassandra.Tests/Operations/CqlTest.cs
  20. +18 −19 test/FluentCassandra.Tests/Operations/GetColumnTest.cs
  21. +23 −24 test/FluentCassandra.Tests/Operations/GetRangeSliceTest.cs
  22. +22 −23 test/FluentCassandra.Tests/Operations/GetSliceTest.cs
  23. +16 −17 test/FluentCassandra.Tests/Operations/InsertColumnTest.cs
  24. +23 −24 test/FluentCassandra.Tests/Operations/MultiGetSliceTest.cs
  25. +23 −21 test/FluentCassandra.Tests/Operations/RemoveColumnTest.cs
  26. +3 −3 test/FluentCassandra.Tests/ReportedIssuesTests.cs
  27. +0 −17 test/FluentCassandra.Tests/TestSetup.cs
  28. +12 −12 test/FluentCassandra.Tests/Types/AsciiTypeTest.cs
  29. +52 −52 test/FluentCassandra.Tests/Types/BytesTypeTest.cs
  30. +23 −18 test/FluentCassandra.Tests/Types/CassandraTypeTest.cs
  31. +9 −9 test/FluentCassandra.Tests/Types/CompositeTypeTest.cs
  32. +6 −6 test/FluentCassandra.Tests/Types/DynamicCompositeTypeTest.cs
  33. +28 −28 test/FluentCassandra.Tests/Types/IntegerTypeTest.cs
  34. +16 −16 test/FluentCassandra.Tests/Types/LexicalUUIDTypeTest.cs
  35. +26 −26 test/FluentCassandra.Tests/Types/LongTypeTest.cs
  36. +7 −7 test/FluentCassandra.Tests/Types/NullTypeTest.cs
  37. +22 −22 test/FluentCassandra.Tests/Types/TimeUUIDTypeTest.cs
  38. +12 −12 test/FluentCassandra.Tests/Types/UTF8TypeTest.cs
  39. +11 −12 test/FluentCassandra.Tests/TypesToDatabase/AsciiTypeTest.cs
  40. +47 −48 test/FluentCassandra.Tests/TypesToDatabase/BytesTypeTest.cs
  41. +11 −12 test/FluentCassandra.Tests/TypesToDatabase/CompositeTypeTest.cs
  42. +11 −12 test/FluentCassandra.Tests/TypesToDatabase/DynamicCompositeTypeTest.cs
  43. +27 −28 test/FluentCassandra.Tests/TypesToDatabase/IntegerTypeTest.cs
  44. +11 −12 test/FluentCassandra.Tests/TypesToDatabase/LexicalUUIDTypeTest.cs
  45. +25 −26 test/FluentCassandra.Tests/TypesToDatabase/LongTypeTest.cs
  46. +17 −18 test/FluentCassandra.Tests/TypesToDatabase/TimeUUIDTypeTest.cs
  47. +11 −12 test/FluentCassandra.Tests/TypesToDatabase/UTF8TypeTest.cs
  48. +1 −1  test/FluentCassandra.Tests/packages.config
View
26 test/FluentCassandra.Tests/Bugs/Issue25JavaBigDecimalBinaryConversion.cs
@@ -1,22 +1,26 @@
using System;
using System.Linq;
-using NUnit.Framework;
+using Xunit;
namespace FluentCassandra.Bugs
{
- [TestFixture]
- public class Issue25JavaBigDecimalBinaryConversion
+
+ public class Issue25JavaBigDecimalBinaryConversion : IUseFixture<CassandraDatabaseSetupFixture>, IDisposable
{
private CassandraContext _db;
- [TestFixtureSetUp]
- public void TestInit()
+ public void SetFixture(CassandraDatabaseSetupFixture data)
{
- var setup = new CassandraDatabaseSetup();
+ var setup = data.DatabaseSetup();
_db = setup.DB;
}
- [Test]
+ public void Dispose()
+ {
+ _db.Dispose();
+ }
+
+ [Fact(Skip="Need to work on later")]
public void Test()
{
// arrange
@@ -31,10 +35,10 @@ public void Test()
// assert
var results = actual.ToList();
- Assert.AreEqual(1000000000000000000M, (decimal)results.First(x => x.Key == "Key0")["MyColumn"]);
- Assert.AreEqual(.25M, (decimal)results.First(x => x.Key == "Key1")["MyColumn"]);
- Assert.AreEqual(2000000000000.1234M, (decimal)results.First(x => x.Key == "Key2")["MyColumn"]);
- Assert.AreEqual(-.25M, (decimal)results.First(x => x.Key == "Key3")["MyColumn"]);
+ Assert.Equal(1000000000000000000M, (decimal)results.First(x => x.Key == "Key0")["MyColumn"]);
+ Assert.Equal(.25M, (decimal)results.First(x => x.Key == "Key1")["MyColumn"]);
+ Assert.Equal(2000000000000.1234M, (decimal)results.First(x => x.Key == "Key2")["MyColumn"]);
+ Assert.Equal(-.25M, (decimal)results.First(x => x.Key == "Key3")["MyColumn"]);
}
}
}
View
47 test/FluentCassandra.Tests/CassandraDatabaseSetup.cs
@@ -29,7 +29,7 @@ public class User
public const string TestStandardName = "Test1";
public const string TestSuperName = "SubTest1";
- public CassandraDatabaseSetup(bool volitile = false)
+ public CassandraDatabaseSetup(bool reset = false)
{
var keyspaceName = "Testing";
var server = new Server("localhost");
@@ -50,7 +50,7 @@ public CassandraDatabaseSetup(bool volitile = false)
SuperFamily = DB.GetColumnFamily<AsciiType, AsciiType>("Super");
UserFamily = DB.GetColumnFamily("Users");
- if (exists && !volitile)
+ if (exists && !reset)
return;
using (var session = DB.OpenSession())
@@ -84,21 +84,8 @@ public CassandraDatabaseSetup(bool volitile = false)
Family = DB.GetColumnFamily<AsciiType>("Standard");
SuperFamily = DB.GetColumnFamily<AsciiType, AsciiType>("Super");
- Family.InsertColumn(TestKey1, "Test1", Math.PI);
- Family.InsertColumn(TestKey1, "Test2", Math.PI);
- Family.InsertColumn(TestKey1, "Test3", Math.PI);
-
- SuperFamily.InsertColumn(TestKey1, TestSuperName, "Test1", Math.PI);
- SuperFamily.InsertColumn(TestKey1, TestSuperName, "Test2", Math.PI);
- SuperFamily.InsertColumn(TestKey1, TestSuperName, "Test3", Math.PI);
-
- Family.InsertColumn(TestKey2, "Test1", Math.PI);
- Family.InsertColumn(TestKey2, "Test2", Math.PI);
- Family.InsertColumn(TestKey2, "Test3", Math.PI);
-
- SuperFamily.InsertColumn(TestKey2, TestSuperName, "Test1", Math.PI);
- SuperFamily.InsertColumn(TestKey2, TestSuperName, "Test2", Math.PI);
- SuperFamily.InsertColumn(TestKey2, TestSuperName, "Test3", Math.PI);
+ ResetFamily();
+ ResetSuperFamily();
DB.ExecuteNonQuery(@"
CREATE COLUMNFAMILY Users (
@@ -123,5 +110,31 @@ Age int
DB.SaveChanges();
}
}
+
+ public void ResetFamily()
+ {
+ Family.RemoveAllRows();
+
+ Family.InsertColumn(TestKey1, "Test1", Math.PI);
+ Family.InsertColumn(TestKey1, "Test2", Math.PI);
+ Family.InsertColumn(TestKey1, "Test3", Math.PI);
+
+ Family.InsertColumn(TestKey2, "Test1", Math.PI);
+ Family.InsertColumn(TestKey2, "Test2", Math.PI);
+ Family.InsertColumn(TestKey2, "Test3", Math.PI);
+ }
+
+ public void ResetSuperFamily()
+ {
+ SuperFamily.RemoveAllRows();
+
+ SuperFamily.InsertColumn(TestKey1, TestSuperName, "Test1", Math.PI);
+ SuperFamily.InsertColumn(TestKey1, TestSuperName, "Test2", Math.PI);
+ SuperFamily.InsertColumn(TestKey1, TestSuperName, "Test3", Math.PI);
+
+ SuperFamily.InsertColumn(TestKey2, TestSuperName, "Test1", Math.PI);
+ SuperFamily.InsertColumn(TestKey2, TestSuperName, "Test2", Math.PI);
+ SuperFamily.InsertColumn(TestKey2, TestSuperName, "Test3", Math.PI);
+ }
}
}
View
23 test/FluentCassandra.Tests/CassandraDatabaseSetupFixture.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Linq;
+
+namespace FluentCassandra
+{
+ public class CassandraDatabaseSetupFixture
+ {
+ private static bool DatabaseHasBeenCleaned = false;
+
+ public CassandraDatabaseSetup DatabaseSetup(bool? reset = null)
+ {
+ if (reset == null && !DatabaseHasBeenCleaned)
+ {
+ DatabaseHasBeenCleaned = true;
+
+ // refresh the entire database
+ return new CassandraDatabaseSetup(reset: true);
+ }
+
+ return new CassandraDatabaseSetup(reset: reset ?? false);
+ }
+ }
+}
View
71 test/FluentCassandra.Tests/CassandraQueryTest.cs
@@ -1,33 +1,32 @@
using System;
using System.Linq;
-using NUnit.Framework;
+using Xunit;
using FluentCassandra.Types;
namespace FluentCassandra
{
- [TestFixture]
- public class CassandraQueryTest
+
+ public class CassandraQueryTest : IUseFixture<CassandraDatabaseSetupFixture>, IDisposable
{
private CassandraContext _db;
private CassandraColumnFamily<AsciiType> _family;
- private const string _testKey = "Test1";
- private const string _testName = "Test1";
- [TestFixtureSetUp]
- public void TestInit()
+ public void SetFixture(CassandraDatabaseSetupFixture data)
{
- var setup = new CassandraDatabaseSetup();
+ var setup = data.DatabaseSetup();
_db = setup.DB;
_family = setup.Family;
}
- [TestFixtureTearDown]
- public void TestCleanup()
+ public void Dispose()
{
_db.Dispose();
}
- [Test]
+ private const string _testKey = "Test1";
+ private const string _testName = "Test1";
+
+ [Fact]
public void Query_Single_Column()
{
// arrange
@@ -37,10 +36,10 @@ public void Query_Single_Column()
var actual = _family.Get(_testKey).FetchColumns(_testName).FirstOrDefault().AsDynamic().Test1;
// assert
- Assert.AreEqual(expected, (double)actual);
+ Assert.Equal(expected, (double)actual);
}
- [Test]
+ [Fact]
public void Query_Multi_Columns()
{
// arrange
@@ -50,11 +49,11 @@ public void Query_Multi_Columns()
var actual = _family.Get(_testKey).FetchColumns("Test1", "Test2").FirstOrDefault().AsDynamic();
// assert
- Assert.AreEqual(expected, (double)actual.Test1);
- Assert.AreEqual(expected, (double)actual.Test2);
+ Assert.Equal(expected, (double)actual.Test1);
+ Assert.Equal(expected, (double)actual.Test2);
}
- [Test]
+ [Fact]
public void Query_Get_Two_Columns()
{
// arrange
@@ -64,11 +63,11 @@ public void Query_Get_Two_Columns()
var actual = _family.Get(_testKey).StartWithColumn("Test1").TakeColumns(2).FirstOrDefault().AsDynamic();
// assert
- Assert.AreEqual(expected, (double)actual.Test1);
- Assert.AreEqual(expected, (double)actual.Test2);
+ Assert.Equal(expected, (double)actual.Test1);
+ Assert.Equal(expected, (double)actual.Test2);
}
- [Test]
+ [Fact]
public void Query_Get_Until_Test2_Column()
{
// arrange
@@ -78,11 +77,11 @@ public void Query_Get_Until_Test2_Column()
var actual = _family.Get(_testKey).StartWithColumn("Test1").TakeUntilColumn("Test2").FirstOrDefault().AsDynamic();
// assert
- Assert.AreEqual(expected, (double)actual.Test1);
- Assert.AreEqual(expected, (double)actual.Test2);
+ Assert.Equal(expected, (double)actual.Test1);
+ Assert.Equal(expected, (double)actual.Test2);
}
- [Test]
+ [Fact]
public void Query_Get_All_Columns()
{
// arrange
@@ -92,13 +91,13 @@ public void Query_Get_All_Columns()
var actual = _family.Get(_testKey).FirstOrDefault();
// assert
- Assert.AreEqual(expectedCount, actual.Columns.Count);
- Assert.AreEqual("Test1", (string)actual.Columns[0].ColumnName);
- Assert.AreEqual("Test2", (string)actual.Columns[1].ColumnName);
- Assert.AreEqual("Test3", (string)actual.Columns[2].ColumnName);
+ Assert.Equal(expectedCount, actual.Columns.Count);
+ Assert.Equal("Test1", (string)actual.Columns[0].ColumnName);
+ Assert.Equal("Test2", (string)actual.Columns[1].ColumnName);
+ Assert.Equal("Test3", (string)actual.Columns[2].ColumnName);
}
- [Test]
+ [Fact]
public void Query_Get_All_Columns_Reversed()
{
// arrange
@@ -108,13 +107,13 @@ public void Query_Get_All_Columns_Reversed()
var actual = _family.Get(_testKey).ReverseColumns().FirstOrDefault();
// assert
- Assert.AreEqual(expectedCount, actual.Columns.Count);
- Assert.AreEqual("Test3", (string)actual.Columns[0].ColumnName);
- Assert.AreEqual("Test2", (string)actual.Columns[1].ColumnName);
- Assert.AreEqual("Test1", (string)actual.Columns[2].ColumnName);
+ Assert.Equal(expectedCount, actual.Columns.Count);
+ Assert.Equal("Test3", (string)actual.Columns[0].ColumnName);
+ Assert.Equal("Test2", (string)actual.Columns[1].ColumnName);
+ Assert.Equal("Test1", (string)actual.Columns[2].ColumnName);
}
- [Test]
+ [Fact]
public void Query_Get_All_Columns_DelayedLoading()
{
// arrange
@@ -126,10 +125,10 @@ public void Query_Get_All_Columns_DelayedLoading()
// assert
foreach (var actual in actualNotLoaded)
{
- Assert.AreEqual(expectedCount, actual.Columns.Count);
- Assert.AreEqual("Test1", (string)actual.Columns[0].ColumnName);
- Assert.AreEqual("Test2", (string)actual.Columns[1].ColumnName);
- Assert.AreEqual("Test3", (string)actual.Columns[2].ColumnName);
+ Assert.Equal(expectedCount, actual.Columns.Count);
+ Assert.Equal("Test1", (string)actual.Columns[0].ColumnName);
+ Assert.Equal("Test2", (string)actual.Columns[1].ColumnName);
+ Assert.Equal("Test3", (string)actual.Columns[2].ColumnName);
}
}
}
View
12 test/FluentCassandra.Tests/Connections/ConnectionProviderTests.cs
@@ -1,13 +1,13 @@
using System;
using System.Linq;
-using NUnit.Framework;
+using Xunit;
namespace FluentCassandra.Connections
{
- [TestFixture]
+
public class ConnectionProviderTests
{
- [Test]
+ [Fact]
public void NormalConnectionProvider()
{
// arrange
@@ -19,10 +19,10 @@ public void NormalConnectionProvider()
var actual = ConnectionProviderFactory.Get(result).GetType();
// assert
- Assert.AreEqual(expected, actual);
+ Assert.Equal(expected, actual);
}
- [Test]
+ [Fact]
public void PooledConnectionProvider()
{
// arrange
@@ -34,7 +34,7 @@ public void PooledConnectionProvider()
var actual = ConnectionProviderFactory.Get(result).GetType();
// assert
- Assert.AreEqual(expected, actual);
+ Assert.Equal(expected, actual);
}
}
}
View
10 test/FluentCassandra.Tests/Connections/NormalConnectionProviderTests.cs
@@ -1,10 +1,10 @@
using System;
using System.Linq;
-using NUnit.Framework;
+using Xunit;
namespace FluentCassandra.Connections
{
- [TestFixture]
+
public class NormalConnectionProviderTests
{
/// <summary>
@@ -12,7 +12,7 @@ public class NormalConnectionProviderTests
/// </summary>
private readonly string _failoverConnectionString = "Keyspace=Testing;Connection Timeout=1;Server=127.0.0.1:1234,127.0.0.1:4567,127.0.0.1";
- [Test]
+ [Fact]
public void Fails_Over()
{
// arrange
@@ -27,8 +27,8 @@ public void Fails_Over()
var actualPort = conn.Server.Port;
// assert
- Assert.AreEqual(expectedHost, actualHost);
- Assert.AreEqual(expectedPort, actualPort);
+ Assert.Equal(expectedHost, actualHost);
+ Assert.Equal(expectedPort, actualPort);
}
}
}
View
12 test/FluentCassandra.Tests/FluentCassandra.Tests.csproj
@@ -35,12 +35,6 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
- <Reference Include="nunit.mocks">
- <HintPath>..\..\packages\NUnit.2.5.10.11092\lib\nunit.mocks.dll</HintPath>
- </Reference>
- <Reference Include="pnunit.framework">
- <HintPath>..\..\packages\NUnit.2.5.10.11092\lib\pnunit.framework.dll</HintPath>
- </Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
@@ -50,12 +44,13 @@
<Reference Include="System.Numerics" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
- <Reference Include="nunit.framework">
- <HintPath>..\..\packages\NUnit.2.5.10.11092\lib\nunit.framework.dll</HintPath>
+ <Reference Include="xunit">
+ <HintPath>..\..\packages\xunit.1.9.0.1566\lib\xunit.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Bugs\Issue25JavaBigDecimalBinaryConversion.cs" />
+ <Compile Include="CassandraDatabaseSetupFixture.cs" />
<Compile Include="CassandraQueryTest.cs" />
<Compile Include="Connections\ConnectionProviderTests.cs" />
<Compile Include="Connections\NormalConnectionProviderTests.cs" />
@@ -67,7 +62,6 @@
<Compile Include="Operations\CassandraIndexClauseTest.cs" />
<Compile Include="Operations\CqlTest.cs" />
<Compile Include="ReportedIssuesTests.cs" />
- <Compile Include="TestSetup.cs" />
<Compile Include="TypesToDatabase\AsciiTypeTest.cs" />
<Compile Include="TypesToDatabase\BytesTypeTest.cs" />
<Compile Include="TypesToDatabase\CompositeTypeTest.cs" />
View
116 test/FluentCassandra.Tests/FluentColumnFamilyTest.cs
@@ -1,14 +1,14 @@
using System;
using System.Linq;
-using NUnit.Framework;
+using Xunit;
using FluentCassandra.Types;
namespace FluentCassandra
{
- [TestFixture]
+
public class FluentColumnFamilyTest
{
- [Test]
+ [Fact]
public void Self_Set()
{
// arrange
@@ -17,10 +17,10 @@ public void Self_Set()
var actual = new FluentColumnFamily<AsciiType>("Keyspace1", "Standard1");
// assert
- Assert.AreSame(actual, actual.GetSelf().ColumnFamily);
+ Assert.Same(actual, actual.GetSelf().ColumnFamily);
}
- [Test]
+ [Fact]
public void Path_Set()
{
// arrange
@@ -29,10 +29,10 @@ public void Path_Set()
var actual = new FluentColumnFamily<AsciiType>("Keyspace1", "Standard1");
// assert
- Assert.AreSame(actual, actual.GetPath().ColumnFamily);
+ Assert.Same(actual, actual.GetPath().ColumnFamily);
}
- [Test]
+ [Fact]
public void Constructor_Test()
{
// arrange
@@ -45,12 +45,12 @@ public void Constructor_Test()
actual.Columns.Add(col2);
// assert
- Assert.AreEqual(2, actual.Columns.Count);
- Assert.AreSame(col1.Family, actual);
- Assert.AreSame(col2.Family, actual);
+ Assert.Equal(2, actual.Columns.Count);
+ Assert.Same(col1.Family, actual);
+ Assert.Same(col2.Family, actual);
}
- [Test]
+ [Fact]
public void Constructor_Dynamic_Test()
{
// arrange
@@ -65,13 +65,13 @@ public void Constructor_Dynamic_Test()
actual.Test2 = colValue2;
// assert
- Assert.AreEqual(colValue1, (decimal)actual.Test1);
- Assert.AreEqual(colValue1, (decimal)actual[col1]);
- Assert.AreEqual(colValue2, (string)actual.Test2);
- Assert.AreEqual(colValue2, (string)actual[col2]);
+ Assert.Equal(colValue1, (decimal)actual.Test1);
+ Assert.Equal(colValue1, (decimal)actual[col1]);
+ Assert.Equal(colValue2, (string)actual.Test2);
+ Assert.Equal(colValue2, (string)actual[col2]);
}
- [Test]
+ [Fact]
public void Get_NonExistent_Column()
{
// arrange
@@ -86,10 +86,10 @@ public void Get_NonExistent_Column()
var actual = family.Test3;
// assert
- Assert.AreEqual(expected, (string)actual);
+ Assert.Equal(expected, (string)actual);
}
- [Test]
+ [Fact]
public void Mutation()
{
// arrange
@@ -104,20 +104,20 @@ public void Mutation()
// assert
var mutations = actual.MutationTracker.GetMutations();
- Assert.AreEqual(2, mutations.Count());
- Assert.AreEqual(2, mutations.Count(x => x.Type == MutationType.Added));
+ Assert.Equal(2, mutations.Count());
+ Assert.Equal(2, mutations.Count(x => x.Type == MutationType.Added));
var mut1 = mutations.FirstOrDefault(x => x.Column.ColumnName == "Test1");
var mut2 = mutations.FirstOrDefault(x => x.Column.ColumnName == "Test2");
- Assert.AreSame(col1, mut1.Column);
- Assert.AreSame(col2, mut2.Column);
+ Assert.Same(col1, mut1.Column);
+ Assert.Same(col2, mut2.Column);
- Assert.AreSame(actual, mut1.Column.GetParent().ColumnFamily);
- Assert.AreSame(actual, mut2.Column.GetParent().ColumnFamily);
+ Assert.Same(actual, mut1.Column.GetParent().ColumnFamily);
+ Assert.Same(actual, mut2.Column.GetParent().ColumnFamily);
}
- [Test]
+ [Fact]
public void Dynamic_Mutation()
{
// arrange
@@ -134,20 +134,20 @@ public void Dynamic_Mutation()
// assert
var mutations = ((IFluentRecord)actual).MutationTracker.GetMutations();
- Assert.AreEqual(2, mutations.Count());
- Assert.AreEqual(2, mutations.Count(x => x.Type == MutationType.Added));
+ Assert.Equal(2, mutations.Count());
+ Assert.Equal(2, mutations.Count(x => x.Type == MutationType.Added));
var mut1 = mutations.FirstOrDefault(x => x.Column.ColumnName == col1);
var mut2 = mutations.FirstOrDefault(x => x.Column.ColumnName == col2);
- Assert.IsNotNull(mut1);
- Assert.IsNotNull(mut2);
+ Assert.NotNull(mut1);
+ Assert.NotNull(mut2);
- Assert.AreSame(actual, mut1.Column.GetParent().ColumnFamily);
- Assert.AreSame(actual, mut2.Column.GetParent().ColumnFamily);
+ Assert.Same(actual, mut1.Column.GetParent().ColumnFamily);
+ Assert.Same(actual, mut2.Column.GetParent().ColumnFamily);
}
- [Test]
+ [Fact]
public void Mutation_Added()
{
// arrange
@@ -162,11 +162,11 @@ public void Mutation_Added()
// assert
var mutations = actual.MutationTracker.GetMutations();
- Assert.AreEqual(2, mutations.Count());
- Assert.AreEqual(2, mutations.Count(x => x.Type == MutationType.Added));
+ Assert.Equal(2, mutations.Count());
+ Assert.Equal(2, mutations.Count(x => x.Type == MutationType.Added));
}
- [Test]
+ [Fact]
public void Mutation_Changed()
{
// arrange
@@ -181,13 +181,13 @@ public void Mutation_Changed()
// assert
var mutations = actual.MutationTracker.GetMutations().ToList();
- Assert.AreEqual(2, mutations.Count());
- Assert.AreEqual(MutationType.Added, mutations[0].Type);
- Assert.AreEqual(MutationType.Changed, mutations[1].Type);
+ Assert.Equal(2, mutations.Count());
+ Assert.Equal(MutationType.Added, mutations[0].Type);
+ Assert.Equal(MutationType.Changed, mutations[1].Type);
}
- [Test]
+ [Fact]
public void Mutation_Replaced()
{
// arrange
@@ -202,13 +202,13 @@ public void Mutation_Replaced()
// assert
var mutations = actual.MutationTracker.GetMutations().ToList();
- Assert.AreEqual(3, mutations.Count());
- Assert.AreEqual(MutationType.Added, mutations[0].Type);
- Assert.AreEqual(MutationType.Removed, mutations[1].Type);
- Assert.AreEqual(MutationType.Added, mutations[2].Type);
+ Assert.Equal(3, mutations.Count());
+ Assert.Equal(MutationType.Added, mutations[0].Type);
+ Assert.Equal(MutationType.Removed, mutations[1].Type);
+ Assert.Equal(MutationType.Added, mutations[2].Type);
}
- [Test]
+ [Fact]
public void Mutation_Removed()
{
// arrange
@@ -222,12 +222,12 @@ public void Mutation_Removed()
// assert
var mutations = actual.MutationTracker.GetMutations().ToList();
- Assert.AreEqual(2, mutations.Count());
- Assert.AreEqual(MutationType.Added, mutations[0].Type);
- Assert.AreEqual(MutationType.Removed, mutations[1].Type);
+ Assert.Equal(2, mutations.Count());
+ Assert.Equal(MutationType.Added, mutations[0].Type);
+ Assert.Equal(MutationType.Removed, mutations[1].Type);
}
- [Test]
+ [Fact]
public void Dynamic_Mutation_Added()
{
// arrange
@@ -242,11 +242,11 @@ public void Dynamic_Mutation_Added()
// assert
var mutations = ((IFluentRecord)actual).MutationTracker.GetMutations();
- Assert.AreEqual(2, mutations.Count());
- Assert.AreEqual(2, mutations.Count(x => x.Type == MutationType.Added));
+ Assert.Equal(2, mutations.Count());
+ Assert.Equal(2, mutations.Count(x => x.Type == MutationType.Added));
}
- [Test]
+ [Fact]
public void Dynamic_Mutation_Changed()
{
// arrange
@@ -261,12 +261,12 @@ public void Dynamic_Mutation_Changed()
// assert
var mutations = ((IFluentRecord)actual).MutationTracker.GetMutations().ToList();
- Assert.AreEqual(2, mutations.Count());
- Assert.AreEqual(MutationType.Added, mutations[0].Type);
- Assert.AreEqual(MutationType.Changed, mutations[1].Type);
+ Assert.Equal(2, mutations.Count());
+ Assert.Equal(MutationType.Added, mutations[0].Type);
+ Assert.Equal(MutationType.Changed, mutations[1].Type);
}
- [Test]
+ [Fact]
public void Dynamic_Mutation_Removed()
{
// arrange
@@ -280,9 +280,9 @@ public void Dynamic_Mutation_Removed()
// assert
var mutations = ((IFluentRecord)actual).MutationTracker.GetMutations().ToList();
- Assert.AreEqual(2, mutations.Count());
- Assert.AreEqual(MutationType.Added, mutations[0].Type);
- Assert.AreEqual(MutationType.Removed, mutations[1].Type);
+ Assert.Equal(2, mutations.Count());
+ Assert.Equal(MutationType.Added, mutations[0].Type);
+ Assert.Equal(MutationType.Removed, mutations[1].Type);
}
}
}
View
12 test/FluentCassandra.Tests/FluentColumnTest.cs
@@ -1,14 +1,14 @@
using System;
using System.Linq;
-using NUnit.Framework;
+using Xunit;
using FluentCassandra.Types;
namespace FluentCassandra
{
- [TestFixture]
+
public class FluentColumnTest
{
- [Test]
+ [Fact]
public void Constructor_Test()
{
// arrange
@@ -23,9 +23,9 @@ public void Constructor_Test()
};
// assert
- Assert.AreEqual(nameExpected, (string)actual.ColumnName);
- Assert.AreEqual(valueExpected, (double)actual.ColumnValue);
- Assert.AreEqual(timestampExpected, actual.ColumnTimestamp.LocalDateTime.Date);
+ Assert.Equal(nameExpected, (string)actual.ColumnName);
+ Assert.Equal(valueExpected, (double)actual.ColumnValue);
+ Assert.Equal(timestampExpected, actual.ColumnTimestamp.LocalDateTime.Date);
}
}
}
View
66 test/FluentCassandra.Tests/FluentSuperColumnFamilyTest.cs
@@ -1,14 +1,14 @@
using System;
using System.Linq;
-using NUnit.Framework;
+using Xunit;
using FluentCassandra.Types;
namespace FluentCassandra
{
- [TestFixture]
+
public class FluentSuperColumnFamilyTest
{
- [Test]
+ [Fact]
public void Self_Set()
{
// arrange
@@ -17,10 +17,10 @@ public void Self_Set()
var actual = new FluentSuperColumnFamily<AsciiType, AsciiType>("Keyspace1", "Standard1");
// assert
- Assert.AreSame(actual, actual.GetSelf().ColumnFamily);
+ Assert.Same(actual, actual.GetSelf().ColumnFamily);
}
- [Test]
+ [Fact]
public void Path_Set()
{
// arrange
@@ -29,10 +29,10 @@ public void Path_Set()
var actual = new FluentSuperColumnFamily<AsciiType, AsciiType>("Keyspace1", "Standard1");
// assert
- Assert.AreSame(actual, actual.GetPath().ColumnFamily);
+ Assert.Same(actual, actual.GetPath().ColumnFamily);
}
- [Test]
+ [Fact]
public void Constructor_Test()
{
// arrange
@@ -45,12 +45,12 @@ public void Constructor_Test()
actual.Columns.Add(col2);
// assert
- Assert.AreEqual(2, actual.Columns.Count);
- Assert.AreSame(col1.Family, actual);
- Assert.AreSame(col2.Family, actual);
+ Assert.Equal(2, actual.Columns.Count);
+ Assert.Same(col1.Family, actual);
+ Assert.Same(col2.Family, actual);
}
- [Test]
+ [Fact]
public void Constructor_Dynamic_Test()
{
// arrange
@@ -63,15 +63,15 @@ public void Constructor_Dynamic_Test()
actual.Test2 = col2;
// assert
- Assert.AreEqual(col1, actual.Test1);
- Assert.AreEqual(col1, actual["Test1"]);
- Assert.AreEqual(col2, actual.Test2);
- Assert.AreEqual(col2, actual["Test2"]);
- Assert.AreSame(col1.Family, actual);
- Assert.AreSame(col2.Family, actual);
+ Assert.Equal(col1, actual.Test1);
+ Assert.Equal(col1, actual["Test1"]);
+ Assert.Equal(col2, actual.Test2);
+ Assert.Equal(col2, actual["Test2"]);
+ Assert.Same(col1.Family, actual);
+ Assert.Same(col2.Family, actual);
}
- [Test]
+ [Fact]
public void Get_NonExistent_Column()
{
// arrange
@@ -85,10 +85,10 @@ public void Get_NonExistent_Column()
var actual = family.Test3;
// assert
- Assert.IsInstanceOfType(typeof(FluentSuperColumn), actual);
+ Assert.IsType(typeof(FluentSuperColumn), actual);
}
- [Test]
+ [Fact]
public void Mutation()
{
// arrange
@@ -103,20 +103,20 @@ public void Mutation()
// assert
var mutations = actual.MutationTracker.GetMutations();
- Assert.AreEqual(2, mutations.Count());
- Assert.AreEqual(2, mutations.Count(x => x.Type == MutationType.Added));
+ Assert.Equal(2, mutations.Count());
+ Assert.Equal(2, mutations.Count(x => x.Type == MutationType.Added));
var mut1 = mutations.FirstOrDefault(x => x.Column.ColumnName == "Test1");
var mut2 = mutations.FirstOrDefault(x => x.Column.ColumnName == "Test2");
- Assert.AreSame(col1, mut1.Column);
- Assert.AreSame(col2, mut2.Column);
+ Assert.Same(col1, mut1.Column);
+ Assert.Same(col2, mut2.Column);
- Assert.AreSame(actual, mut1.Column.GetParent().ColumnFamily);
- Assert.AreSame(actual, mut2.Column.GetParent().ColumnFamily);
+ Assert.Same(actual, mut1.Column.GetParent().ColumnFamily);
+ Assert.Same(actual, mut2.Column.GetParent().ColumnFamily);
}
- [Test]
+ [Fact]
public void Dynamic_Mutation()
{
// arrange
@@ -131,17 +131,17 @@ public void Dynamic_Mutation()
// assert
var mutations = ((IFluentRecord)actual).MutationTracker.GetMutations();
- Assert.AreEqual(2, mutations.Count());
- Assert.AreEqual(2, mutations.Count(x => x.Type == MutationType.Added));
+ Assert.Equal(2, mutations.Count());
+ Assert.Equal(2, mutations.Count(x => x.Type == MutationType.Added));
var mut1 = mutations.FirstOrDefault(x => x.Column.ColumnName == "Test1");
var mut2 = mutations.FirstOrDefault(x => x.Column.ColumnName == "Test2");
- Assert.IsNotNull(mut1);
- Assert.IsNotNull(mut2);
+ Assert.NotNull(mut1);
+ Assert.NotNull(mut2);
- Assert.AreSame(actual, mut1.Column.GetParent().ColumnFamily);
- Assert.AreSame(actual, mut2.Column.GetParent().ColumnFamily);
+ Assert.Same(actual, mut1.Column.GetParent().ColumnFamily);
+ Assert.Same(actual, mut2.Column.GetParent().ColumnFamily);
}
}
}
View
64 test/FluentCassandra.Tests/FluentSuperColumnTest.cs
@@ -1,14 +1,14 @@
using System;
using System.Linq;
-using NUnit.Framework;
+using Xunit;
using FluentCassandra.Types;
namespace FluentCassandra
{
- [TestFixture]
+
public class FluentSuperColumnTest
{
- [Test]
+ [Fact]
public void Parent_Set()
{
// arrange
@@ -17,10 +17,10 @@ public void Parent_Set()
var actual = new FluentSuperColumn<AsciiType, AsciiType>();
// assert
- Assert.AreSame(actual, actual.GetPath().SuperColumn);
+ Assert.Same(actual, actual.GetPath().SuperColumn);
}
- [Test]
+ [Fact]
public void Path_Set()
{
// arrange
@@ -29,10 +29,10 @@ public void Path_Set()
var actual = new FluentSuperColumn<AsciiType, AsciiType>();
// assert
- Assert.AreSame(actual, actual.GetPath().SuperColumn);
+ Assert.Same(actual, actual.GetPath().SuperColumn);
}
- [Test]
+ [Fact]
public void Constructor_Test()
{
// arrange
@@ -47,11 +47,11 @@ public void Constructor_Test()
actual.Columns.Add(col2);
// assert
- Assert.AreEqual(colName, (string)actual.ColumnName);
- Assert.AreEqual(2, actual.Columns.Count);
+ Assert.Equal(colName, (string)actual.ColumnName);
+ Assert.Equal(2, actual.Columns.Count);
}
- [Test]
+ [Fact]
public void Constructor_Dynamic_Test()
{
// arrange
@@ -68,15 +68,15 @@ public void Constructor_Dynamic_Test()
actual.Test2 = colValue2;
// assert
- Assert.AreEqual(colName, (string)actual.Name);
- //Assert.AreEqual(2, actual.Columns.CountColumns);
- Assert.AreEqual(colValue1, (decimal)actual.Test1);
- Assert.AreEqual(colValue1, (decimal)actual[col1]);
- Assert.AreEqual(colValue2, (string)actual.Test2);
- Assert.AreEqual(colValue2, (string)actual[col2]);
+ Assert.Equal(colName, (string)actual.Name);
+ //Assert.Equal(2, actual.Columns.CountColumns);
+ Assert.Equal(colValue1, (decimal)actual.Test1);
+ Assert.Equal(colValue1, (decimal)actual[col1]);
+ Assert.Equal(colValue2, (string)actual.Test2);
+ Assert.Equal(colValue2, (string)actual[col2]);
}
- [Test]
+ [Fact]
public void Get_NonExistent_Column()
{
// arrange
@@ -93,10 +93,10 @@ public void Get_NonExistent_Column()
var actual = superColumn.Test3;
// assert
- Assert.AreEqual(expected, (string)actual);
+ Assert.Equal(expected, (string)actual);
}
- [Test]
+ [Fact]
public void Mutation()
{
// arrange
@@ -113,20 +113,20 @@ public void Mutation()
// assert
var mutations = actual.MutationTracker.GetMutations();
- Assert.AreEqual(2, mutations.Count());
- Assert.AreEqual(2, mutations.Count(x => x.Type == MutationType.Added));
+ Assert.Equal(2, mutations.Count());
+ Assert.Equal(2, mutations.Count(x => x.Type == MutationType.Added));
var mut1 = mutations.FirstOrDefault(x => x.Column.ColumnName == "Test1");
var mut2 = mutations.FirstOrDefault(x => x.Column.ColumnName == "Test2");
- Assert.AreSame(col1, mut1.Column);
- Assert.AreSame(col2, mut2.Column);
+ Assert.Same(col1, mut1.Column);
+ Assert.Same(col2, mut2.Column);
- Assert.AreSame(actual, mut1.Column.GetParent().SuperColumn);
- Assert.AreSame(actual, mut2.Column.GetParent().SuperColumn);
+ Assert.Same(actual, mut1.Column.GetParent().SuperColumn);
+ Assert.Same(actual, mut2.Column.GetParent().SuperColumn);
}
- [Test]
+ [Fact]
public void Dynamic_Mutation()
{
// arrange
@@ -145,17 +145,17 @@ public void Dynamic_Mutation()
// assert
var mutations = ((IFluentRecord)actual).MutationTracker.GetMutations();
- Assert.AreEqual(2, mutations.Count());
- Assert.AreEqual(2, mutations.Count(x => x.Type == MutationType.Added));
+ Assert.Equal(2, mutations.Count());
+ Assert.Equal(2, mutations.Count(x => x.Type == MutationType.Added));
var mut1 = mutations.FirstOrDefault(x => x.Column.ColumnName == col1);
var mut2 = mutations.FirstOrDefault(x => x.Column.ColumnName == col2);
- Assert.IsNotNull(mut1);
- Assert.IsNotNull(mut2);
+ Assert.NotNull(mut1);
+ Assert.NotNull(mut2);
- Assert.AreSame(actual, mut1.Column.GetParent().SuperColumn);
- Assert.AreSame(actual, mut2.Column.GetParent().SuperColumn);
+ Assert.Same(actual, mut1.Column.GetParent().SuperColumn);
+ Assert.Same(actual, mut2.Column.GetParent().SuperColumn);
}
}
}
View
28 test/FluentCassandra.Tests/GuidGeneratorTest.cs
@@ -1,13 +1,13 @@
using System;
using System.Linq;
-using NUnit.Framework;
+using Xunit;
namespace FluentCassandra
{
- [TestFixture]
+
public class GuidGeneratorTest
{
- [Test]
+ [Fact]
public void Type1Check()
{
// arrange
@@ -18,10 +18,10 @@ public void Type1Check()
var actual = guid.GetVersion();
// assert
- Assert.AreEqual(expected, actual);
+ Assert.Equal(expected, actual);
}
- [Test]
+ [Fact]
public void SanityType1Check()
{
// arrange
@@ -32,10 +32,10 @@ public void SanityType1Check()
var actual = guid.GetVersion();
// assert
- Assert.AreNotEqual(expected, actual);
+ Assert.NotEqual(expected, actual);
}
- [Test]
+ [Fact]
public void GetDateTimeUnspecified()
{
// arrange
@@ -46,10 +46,10 @@ public void GetDateTimeUnspecified()
var actual = GuidGenerator.GetDateTime(guid).ToLocalTime();
// assert
- Assert.AreEqual(expected, actual);
+ Assert.Equal(expected, actual);
}
- [Test]
+ [Fact]
public void GetDateTimeLocal()
{
// arrange
@@ -60,10 +60,10 @@ public void GetDateTimeLocal()
var actual = GuidGenerator.GetLocalDateTime(guid);
// assert
- Assert.AreEqual(expected, actual);
+ Assert.Equal(expected, actual);
}
- [Test]
+ [Fact]
public void GetDateTimeUtc()
{
// arrange
@@ -74,10 +74,10 @@ public void GetDateTimeUtc()
var actual = GuidGenerator.GetUtcDateTime(guid);
// assert
- Assert.AreEqual(expected, actual);
+ Assert.Equal(expected, actual);
}
- [Test]
+ [Fact]
public void GetDateTimeOffset()
{
// arrange
@@ -88,7 +88,7 @@ public void GetDateTimeOffset()
var actual = GuidGenerator.GetDateTimeOffset(guid);
// assert
- Assert.AreEqual(expected, actual);
+ Assert.Equal(expected, actual);
}
}
}
View
82 test/FluentCassandra.Tests/Linq/LinqToCqlCassandraTests.cs
@@ -1,26 +1,30 @@
using System;
using System.Linq;
-using NUnit.Framework;
+using Xunit;
namespace FluentCassandra.Linq
{
- [TestFixture]
- public class LinqToCqlCassandraTests
+
+ public class LinqToCqlCassandraTests : IUseFixture<CassandraDatabaseSetupFixture>, IDisposable
{
private CassandraContext _db;
private CassandraColumnFamily _family;
private CassandraDatabaseSetup.User[] _users;
- [TestFixtureSetUp]
- public void TestInit()
+ public void SetFixture(CassandraDatabaseSetupFixture data)
{
- var setup = new CassandraDatabaseSetup();
+ var setup = data.DatabaseSetup();
_db = setup.DB;
_family = setup.UserFamily;
_users = setup.Users;
}
- [Test]
+ public void Dispose()
+ {
+ _db.Dispose();
+ }
+
+ [Fact]
public void SELECT()
{
var query =
@@ -28,55 +32,55 @@ public void SELECT()
select f;
var actual = query.ToList().OrderBy(x => (int)x.Key).ToList();
- Assert.AreEqual(_users.Length, actual.Count);
+ Assert.Equal(_users.Length, actual.Count);
for (int i = 0; i < _users.Length; i++)
{
var objUser = _users[i];
dynamic dbUser = actual[i];
- Assert.AreEqual(objUser.Id, dbUser.Key);
- Assert.AreEqual(objUser.Name, (string)dbUser.Name);
- Assert.AreEqual(objUser.Email, (string)dbUser.Email);
- Assert.AreEqual(objUser.Age, (int)dbUser.Age);
+ Assert.Equal(objUser.Id, (int)dbUser.Key);
+ Assert.Equal(objUser.Name, (string)dbUser.Name);
+ Assert.Equal(objUser.Email, (string)dbUser.Email);
+ Assert.Equal(objUser.Age, (int)dbUser.Age);
}
}
- [Test]
+ [Fact]
public void SELECT_One_Column()
{
var query = _family.Select("Age");
var actual = query.ToList().OrderBy(x => (int)x.Key).ToList();
- Assert.AreEqual(_users.Length, actual.Count);
+ Assert.Equal(_users.Length, actual.Count);
for (int i = 0; i < _users.Length; i++)
{
var objUser = _users[i];
var dbUser = actual[i];
- Assert.AreEqual(1, dbUser.Columns.Count);
- Assert.AreEqual(objUser.Age, (int)dbUser["Age"]);
+ Assert.Equal(1, dbUser.Columns.Count);
+ Assert.Equal(objUser.Age, (int)dbUser["Age"]);
}
}
- [Test]
+ [Fact]
public void SELECT_Two_Columns()
{
var query = _family.Select("Age", "Name");
var actual = query.ToList().OrderBy(x => (int)x.Key).ToList();
- Assert.AreEqual(_users.Length, actual.Count);
+ Assert.Equal(_users.Length, actual.Count);
for (int i = 0; i < _users.Length; i++)
{
var objUser = _users[i];
var dbUser = actual[i];
- Assert.AreEqual(2, dbUser.Columns.Count);
- Assert.AreEqual(objUser.Age, (int)dbUser["Age"]);
- Assert.AreEqual(objUser.Name, (string)dbUser["Name"]);
+ Assert.Equal(2, dbUser.Columns.Count);
+ Assert.Equal(objUser.Age, (int)dbUser["Age"]);
+ Assert.Equal(objUser.Name, (string)dbUser["Name"]);
}
}
- [Test]
+ [Fact]
public void WHERE_Using_KEY()
{
var expected = _users.Where(x => x.Id == 2).FirstOrDefault();
@@ -88,14 +92,14 @@ public void WHERE_Using_KEY()
var response = query.ToList();
dynamic actual = response.FirstOrDefault();
- Assert.AreEqual(1, response.Count);
- Assert.AreEqual(expected.Id, actual.Key);
- Assert.AreEqual(expected.Name, (string)actual.Name);
- Assert.AreEqual(expected.Email, (string)actual.Email);
- Assert.AreEqual(expected.Age, (int)actual.Age);
+ Assert.Equal(1, response.Count);
+ Assert.Equal(expected.Id, (int)actual.Key);
+ Assert.Equal(expected.Name, (string)actual.Name);
+ Assert.Equal(expected.Email, (string)actual.Email);
+ Assert.Equal(expected.Age, (int)actual.Age);
}
- [Test]
+ [Fact]
public void WHERE_Using_KEY_And_One_Parameter()
{
var expected = _users.Where(x => x.Id == 2).FirstOrDefault();
@@ -107,14 +111,14 @@ public void WHERE_Using_KEY_And_One_Parameter()
var response = query.ToList();
dynamic actual = response.FirstOrDefault();
- Assert.AreEqual(1, response.Count);
- Assert.AreEqual(expected.Id, actual.Key);
- Assert.AreEqual(expected.Name, (string)actual.Name);
- Assert.AreEqual(expected.Email, (string)actual.Email);
- Assert.AreEqual(expected.Age, (int)actual.Age);
+ Assert.Equal(1, response.Count);
+ Assert.Equal(expected.Id, (int)actual.Key);
+ Assert.Equal(expected.Name, (string)actual.Name);
+ Assert.Equal(expected.Email, (string)actual.Email);
+ Assert.Equal(expected.Age, (int)actual.Age);
}
- [Test]
+ [Fact]
public void WHERE_One_Parameter()
{
var expected = _users.Where(x => x.Id == 2).FirstOrDefault();
@@ -126,11 +130,11 @@ public void WHERE_One_Parameter()
var response = query.ToList();
dynamic actual = response.FirstOrDefault();
- Assert.AreEqual(1, response.Count);
- Assert.AreEqual(expected.Id, actual.Key);
- Assert.AreEqual(expected.Name, (string)actual.Name);
- Assert.AreEqual(expected.Email, (string)actual.Email);
- Assert.AreEqual(expected.Age, (int)actual.Age);
+ Assert.Equal(1, response.Count);
+ Assert.Equal(expected.Id, (int)actual.Key);
+ Assert.Equal(expected.Name, (string)actual.Name);
+ Assert.Equal(expected.Email, (string)actual.Email);
+ Assert.Equal(expected.Age, (int)actual.Age);
}
}
}
View
90 test/FluentCassandra.Tests/Linq/LinqToCqlObjectsCassandraTests.cs
@@ -1,16 +1,29 @@
using System;
using System.Linq;
-using NUnit.Framework;
+using Xunit;
namespace FluentCassandra.Linq
{
- [TestFixture]
- public class LinqToCqlObjectsCassandraTests
+
+ public class LinqToCqlObjectsCassandraTests : IUseFixture<CassandraDatabaseSetupFixture>, IDisposable
{
private CassandraContext _db;
private CassandraColumnFamily _family;
private CassandraDatabaseSetup.User[] _users;
+ public void SetFixture(CassandraDatabaseSetupFixture data)
+ {
+ var setup = data.DatabaseSetup();
+ _db = setup.DB;
+ _family = setup.UserFamily;
+ _users = setup.Users;
+ }
+
+ public void Dispose()
+ {
+ _db.Dispose();
+ }
+
public class User
{
public int Id { get; set; }
@@ -19,16 +32,7 @@ public class User
public int Age { get; set; }
}
- [TestFixtureSetUp]
- public void TestInit()
- {
- var setup = new CassandraDatabaseSetup();
- _db = setup.DB;
- _family = setup.UserFamily;
- _users = setup.Users;
- }
-
- [Test]
+ [Fact]
public void SELECT()
{
var query =
@@ -36,55 +40,55 @@ public void SELECT()
select f;
var actual = query.ToList().OrderBy(x => x.Id).ToList();
- Assert.AreEqual(_users.Length, actual.Count);
+ Assert.Equal(_users.Length, actual.Count);
for (int i = 0; i < _users.Length; i++)
{
var objUser = _users[i];
var dbUser = actual[i];
- Assert.AreEqual(objUser.Id, dbUser.Id);
- Assert.AreEqual(objUser.Name, dbUser.Name);
- Assert.AreEqual(objUser.Email, dbUser.Email);
- Assert.AreEqual(objUser.Age, dbUser.Age);
+ Assert.Equal(objUser.Id, dbUser.Id);
+ Assert.Equal(objUser.Name, dbUser.Name);
+ Assert.Equal(objUser.Email, dbUser.Email);
+ Assert.Equal(objUser.Age, dbUser.Age);
}
}
- [Test]
+ [Fact]
public void SELECT_One_Column()
{
var query = _family.AsObjectQueryable<User>().Select(x => x.Age);
var actual = query.ToList().OrderBy(x => x).ToList();
var users = _users.OrderBy(x => x.Age).ToList();
- Assert.AreEqual(users.Count, actual.Count);
+ Assert.Equal(users.Count, actual.Count);
for (int i = 0; i < users.Count; i++)
{
var objUser = users[i];
var dbAge = actual[i];
- Assert.AreEqual(objUser.Age, dbAge);
+ Assert.Equal(objUser.Age, dbAge);
}
}
- [Test]
+ [Fact]
public void SELECT_Two_Columns()
{
var query = _family.AsObjectQueryable<User>().Select(x => new { x.Age, x.Name });
var actual = query.ToList().OrderBy(x => x.Age).ToList();
var users = _users.OrderBy(x => x.Age).ToList();
- Assert.AreEqual(users.Count, actual.Count);
+ Assert.Equal(users.Count, actual.Count);
for (int i = 0; i < users.Count; i++)
{
var objUser = users[i];
var dbUser = actual[i];
- Assert.AreEqual(objUser.Age, dbUser.Age);
- Assert.AreEqual(objUser.Name, dbUser.Name);
+ Assert.Equal(objUser.Age, dbUser.Age);
+ Assert.Equal(objUser.Name, dbUser.Name);
}
}
- [Test]
+ [Fact]
public void WHERE_Using_KEY()
{
var expected = _users.Where(x => x.Id == 2).FirstOrDefault();
@@ -96,14 +100,14 @@ public void WHERE_Using_KEY()
var response = query.ToList();
var actual = response.FirstOrDefault();
- Assert.AreEqual(1, response.Count);
- Assert.AreEqual(expected.Id, actual.Id);
- Assert.AreEqual(expected.Name, actual.Name);
- Assert.AreEqual(expected.Email, actual.Email);
- Assert.AreEqual(expected.Age, actual.Age);
+ Assert.Equal(1, response.Count);
+ Assert.Equal(expected.Id, actual.Id);
+ Assert.Equal(expected.Name, actual.Name);
+ Assert.Equal(expected.Email, actual.Email);
+ Assert.Equal(expected.Age, actual.Age);
}
- [Test]
+ [Fact]
public void WHERE_Using_KEY_And_One_Parameter()
{
var expected = _users.Where(x => x.Id == 2).FirstOrDefault();
@@ -115,14 +119,14 @@ public void WHERE_Using_KEY_And_One_Parameter()
var response = query.ToList();
var actual = response.FirstOrDefault();
- Assert.AreEqual(1, response.Count);
- Assert.AreEqual(expected.Id, actual.Id);
- Assert.AreEqual(expected.Name, actual.Name);
- Assert.AreEqual(expected.Email, actual.Email);
- Assert.AreEqual(expected.Age, actual.Age);
+ Assert.Equal(1, response.Count);
+ Assert.Equal(expected.Id, actual.Id);
+ Assert.Equal(expected.Name, actual.Name);
+ Assert.Equal(expected.Email, actual.Email);
+ Assert.Equal(expected.Age, actual.Age);
}
- [Test]
+ [Fact]
public void WHERE_One_Parameter()
{
var expected = _users.Where(x => x.Id == 2).FirstOrDefault();
@@ -134,11 +138,11 @@ public void WHERE_One_Parameter()
var response = query.ToList();
var actual = response.FirstOrDefault();
- Assert.AreEqual(1, response.Count);
- Assert.AreEqual(expected.Id, actual.Id);
- Assert.AreEqual(expected.Name, actual.Name);
- Assert.AreEqual(expected.Email, actual.Email);
- Assert.AreEqual(expected.Age, actual.Age);
+ Assert.Equal(1, response.Count);
+ Assert.Equal(expected.Id, actual.Id);
+ Assert.Equal(expected.Name, actual.Name);
+ Assert.Equal(expected.Email, actual.Email);
+ Assert.Equal(expected.Age, actual.Age);
}
}
}
View
36 test/FluentCassandra.Tests/Linq/LinqToCqlObjectsTests.cs
@@ -1,13 +1,13 @@
using System.Linq;
using FluentCassandra.Connections;
-using NUnit.Framework;
+using Xunit;
using FluentCassandra.Types;
using System;
namespace FluentCassandra.Linq
{
- [TestFixture]
- public class LinqToCqlObjectsTests
+
+ public class LinqToCqlObjectsTests : IDisposable
{
private CassandraContext _db;
private CassandraColumnFamily<AsciiType> _family;
@@ -20,8 +20,7 @@ public class User
public int Age { get; set; }
}
- [TestFixtureSetUp]
- public void TestInit()
+ public LinqToCqlObjectsTests()
{
var keyspaceName = "Testing";
var server = new Server("localhost");
@@ -30,6 +29,11 @@ public void TestInit()
_family = _db.GetColumnFamily<AsciiType>("Users");
}
+ public void Dispose()
+ {
+ _db.Dispose();
+ }
+
private string ScrubLineBreaks(string query)
{
return query.Replace("\n", "");
@@ -37,10 +41,10 @@ private string ScrubLineBreaks(string query)
private void AreEqual(string expected, string actual)
{
- Assert.AreEqual(ScrubLineBreaks(expected), ScrubLineBreaks(actual));
+ Assert.Equal(ScrubLineBreaks(expected), ScrubLineBreaks(actual));
}
- [Test]
+ [Fact]
public void Provider()
{
var expected = "SELECT * FROM Users";
@@ -51,7 +55,7 @@ public void Provider()
AreEqual(expected, actual);
}
- [Test]
+ [Fact]
public void SELECT()
{
var expected = "SELECT * FROM Users";
@@ -65,7 +69,7 @@ public void SELECT()
AreEqual(expected, actual);
}
- [Test]
+ [Fact]
public void LIMIT()
{
var expected = "SELECT * FROM Users LIMIT 25";
@@ -79,7 +83,7 @@ public void LIMIT()
AreEqual(expected, actual);
}
- [Test]
+ [Fact]
public void SELECT_One_Column()
{
var expected = "SELECT Age FROM Users";
@@ -90,7 +94,7 @@ public void SELECT_One_Column()
AreEqual(expected, actual);
}
- [Test]
+ [Fact]
public void SELECT_Two_Columns()
{
var expected = "SELECT Age, Name FROM Users";
@@ -101,7 +105,7 @@ public void SELECT_Two_Columns()
AreEqual(expected, actual);
}
- [Test]
+ [Fact]
public void WHERE_Using_KEY()
{
var expected = "SELECT * FROM Users WHERE KEY = 1234";
@@ -116,7 +120,7 @@ public void WHERE_Using_KEY()
AreEqual(expected, actual);
}
- [Test]
+ [Fact]
public void WHERE_Using_KEY_And_One_Parameter()
{
var expected = "SELECT * FROM Users WHERE KEY = 1234 AND Age = 10";
@@ -131,17 +135,17 @@ public void WHERE_Using_KEY_And_One_Parameter()
AreEqual(expected, actual);
}
- [Test]
+ [Fact]
public void WHERE_Two_OR_Parameter()
{
- Assert.Throws<NotSupportedException>(delegate {
+ Assert.Throws(typeof(NotSupportedException), delegate {
var query =
from f in _family.AsObjectQueryable<User>()
where f.Id == 1234 || f.Age == 10
select f;
query.ToString();
- }, "OR is not supported");
+ });
}
}
}
View
42 test/FluentCassandra.Tests/Linq/LinqToCqlTests.cs
@@ -1,19 +1,18 @@
using System.Linq;
using FluentCassandra.Connections;
-using NUnit.Framework;
+using Xunit;
using FluentCassandra.Types;
using System;
namespace FluentCassandra.Linq
{
- [TestFixture]
- public class LinqToCqlTests
+
+ public class LinqToCqlTests : IDisposable
{
private CassandraContext _db;
private CassandraColumnFamily<AsciiType> _family;
- [TestFixtureSetUp]
- public void TestInit()
+ public LinqToCqlTests()
{
var keyspaceName = "Testing";
var server = new Server("localhost");
@@ -22,6 +21,11 @@ public void TestInit()
_family = _db.GetColumnFamily<AsciiType>("Users");
}
+ public void Dispose()
+ {
+ _db.Dispose();
+ }
+
private string ScrubLineBreaks(string query)
{
return query.Replace("\n", "");
@@ -29,10 +33,10 @@ private string ScrubLineBreaks(string query)
private void AreEqual(string expected, string actual)
{
- Assert.AreEqual(ScrubLineBreaks(expected), ScrubLineBreaks(actual));
+ Assert.Equal(ScrubLineBreaks(expected), ScrubLineBreaks(actual));
}
- [Test]
+ [Fact]
public void Provider()
{
var expected = "SELECT * FROM Users";
@@ -43,7 +47,7 @@ public void Provider()
AreEqual(expected, actual);
}
- [Test]
+ [Fact]
public void SELECT()
{
var expected = "SELECT * FROM Users";
@@ -57,7 +61,7 @@ public void SELECT()
AreEqual(expected, actual);
}
- [Test]
+ [Fact]
public void LIMIT()
{
var expected = "SELECT * FROM Users LIMIT 25";
@@ -71,7 +75,7 @@ public void LIMIT()
AreEqual(expected, actual);
}
- [Test]
+ [Fact]
public void SELECT_One_Column()
{
var expected = "SELECT Age FROM Users";
@@ -82,7 +86,7 @@ public void SELECT_One_Column()
AreEqual(expected, actual);
}
- [Test]
+ [Fact]
public void SELECT_Two_Columns()
{
var expected = "SELECT Age, Name FROM Users";
@@ -93,7 +97,7 @@ public void SELECT_Two_Columns()
AreEqual(expected, actual);
}
- [Test]
+ [Fact]
public void Cannot_Use_Columns_Property()
{
var query =
@@ -106,7 +110,7 @@ public void Cannot_Use_Columns_Property()
});
}
- [Test]
+ [Fact]
public void WHERE_Using_KEY()
{
var expected = "SELECT * FROM Users WHERE KEY = 1234";
@@ -121,7 +125,7 @@ public void WHERE_Using_KEY()
AreEqual(expected, actual);
}
- [Test]
+ [Fact]
public void WHERE_Using_KEY_And_One_Parameter()
{
var expected = "SELECT * FROM Users WHERE KEY = 1234 AND Age = 10";
@@ -136,7 +140,7 @@ public void WHERE_Using_KEY_And_One_Parameter()
AreEqual(expected, actual);
}
- [Test]
+ [Fact]
public void WHERE_One_Parameter()
{
var expected = "SELECT * FROM Users WHERE Id = 1234";
@@ -151,7 +155,7 @@ public void WHERE_One_Parameter()
AreEqual(expected, actual);
}
- [Test]
+ [Fact]
public void WHERE_Two_AND_Parameter()
{
var expected = "SELECT * FROM Users WHERE Id = 1234 AND Age = 10";
@@ -166,17 +170,17 @@ public void WHERE_Two_AND_Parameter()
AreEqual(expected, actual);
}
- [Test]
+ [Fact]
public void WHERE_Two_OR_Parameter()
{
- Assert.Throws<NotSupportedException>(delegate {
+ Assert.Throws(typeof(NotSupportedException), delegate {
var query =
from f in _family
where f["Id"] == 1234 || f["Age"] == 10
select f;
query.ToString();
- }, "OR is not supported");
+ });
}
}
}
View
126 test/FluentCassandra.Tests/Operations/CassandraIndexClauseTest.cs
@@ -1,15 +1,15 @@
using System;
using System.Linq;
-using NUnit.Framework;
+using Xunit;
using FluentCassandra.Types;
using Apache.Cassandra;
namespace FluentCassandra.Operations
{
- [TestFixture]
+
public class CassandraIndexClauseTest
{
- [Test]
+ [Fact]
public void StartKeySet()
{
// arrange
@@ -25,10 +25,10 @@ public void StartKeySet()
family => family[columnName] == columnValue);
// assert
- Assert.AreEqual(index.StartKey, key);
+ Assert.Same((string)index.StartKey, key);
}
- [Test]
+ [Fact]
public void CountSet()
{
// arrange
@@ -44,10 +44,10 @@ public void CountSet()
family => family[columnName] == columnValue);
// assert
- Assert.AreEqual(index.Count, count);
+ Assert.Equal(index.Count, count);
}
- [Test]
+ [Fact]
public void SingleExpression()
{
// arrange
@@ -64,16 +64,16 @@ public void SingleExpression()
var expressions = index.CompiledExpressions;
// assert
- Assert.AreEqual(1, expressions.Count);
+ Assert.Equal(1, expressions.Count);
var firstExpression = expressions[0];
- Assert.IsNotNull(firstExpression);
- Assert.AreEqual(CassandraObject.GetTypeFromDatabaseValue(firstExpression.Column_name, typeof(BytesType)), (BytesType)columnName);
- Assert.AreEqual(firstExpression.Op, IndexOperator.EQ);
- Assert.AreEqual(CassandraObject.GetTypeFromDatabaseValue(firstExpression.Value, typeof(BytesType)), (BytesType)columnValue);
+ Assert.NotNull(firstExpression);
+ Assert.Equal(CassandraObject.GetTypeFromDatabaseValue(firstExpression.Column_name, typeof(BytesType)), (BytesType)columnName);
+ Assert.Equal(firstExpression.Op, IndexOperator.EQ);
+ Assert.Equal(CassandraObject.GetTypeFromDatabaseValue(firstExpression.Value, typeof(BytesType)), (BytesType)columnValue);
}
- [Test]
+ [Fact]
public void TwoExpressions()
{
// arrange
@@ -93,21 +93,21 @@ public void TwoExpressions()
var expressions = index.CompiledExpressions;
// assert
- Assert.AreEqual(2, expressions.Count);
+ Assert.Equal(2, expressions.Count);
var firstExpression = expressions[0];
- Assert.IsNotNull(firstExpression);
- Assert.AreEqual(CassandraObject.GetTypeFromDatabaseValue(firstExpression.Column_name, typeof(BytesType)), (BytesType)columnName1);
- Assert.AreEqual(firstExpression.Op, IndexOperator.EQ);
- Assert.AreEqual(CassandraObject.GetTypeFromDatabaseValue(firstExpression.Value, typeof(BytesType)), (BytesType)columnValue1);
+ Assert.NotNull(firstExpression);
+ Assert.Equal(CassandraObject.GetTypeFromDatabaseValue(firstExpression.Column_name, typeof(BytesType)), (BytesType)columnName1);
+ Assert.Equal(firstExpression.Op, IndexOperator.EQ);
+ Assert.Equal(CassandraObject.GetTypeFromDatabaseValue(firstExpression.Value, typeof(BytesType)), (BytesType)columnValue1);
var secondExpression = expressions[1];
- Assert.AreEqual(CassandraObject.GetTypeFromDatabaseValue(secondExpression.Column_name, typeof(BytesType)), (BytesType)columnName2);
- Assert.AreEqual(secondExpression.Op, IndexOperator.GT);
- Assert.AreEqual(CassandraObject.GetTypeFromDatabaseValue(secondExpression.Value, typeof(BytesType)), (BytesType)columnValue2);
+ Assert.Equal(CassandraObject.GetTypeFromDatabaseValue(secondExpression.Column_name, typeof(BytesType)), (BytesType)columnName2);
+ Assert.Equal(secondExpression.Op, IndexOperator.GT);
+ Assert.Equal(CassandraObject.GetTypeFromDatabaseValue(secondExpression.Value, typeof(BytesType)), (BytesType)columnValue2);
}
- [Test]
+ [Fact]
public void ThreeExpressions()
{
// arrange
@@ -130,26 +130,26 @@ public void ThreeExpressions()
var expressions = index.CompiledExpressions;
// assert
- Assert.AreEqual(3, expressions.Count);
+ Assert.Equal(3, expressions.Count);
var firstExpression = expressions[0];
- Assert.IsNotNull(firstExpression);
- Assert.AreEqual(CassandraObject.GetTypeFromDatabaseValue(firstExpression.Column_name, typeof(BytesType)), (BytesType)columnName1);
- Assert.AreEqual(firstExpression.Op, IndexOperator.EQ);
- Assert.AreEqual(CassandraObject.GetTypeFromDatabaseValue(firstExpression.Value, typeof(BytesType)), (BytesType)columnValue1);
+ Assert.NotNull(firstExpression);
+ Assert.Equal(CassandraObject.GetTypeFromDatabaseValue(firstExpression.Column_name, typeof(BytesType)), (BytesType)columnName1);
+ Assert.Equal(firstExpression.Op, IndexOperator.EQ);
+ Assert.Equal(CassandraObject.GetTypeFromDatabaseValue(firstExpression.Value, typeof(BytesType)), (BytesType)columnValue1);
var secondExpression = expressions[1];
- Assert.AreEqual(CassandraObject.GetTypeFromDatabaseValue(secondExpression.Column_name, typeof(BytesType)), (BytesType)columnName2);
- Assert.AreEqual(secondExpression.Op, IndexOperator.GT);
- Assert.AreEqual(CassandraObject.GetTypeFromDatabaseValue(secondExpression.Value, typeof(BytesType)), (BytesType)columnValue2);
+ Assert.Equal(CassandraObject.GetTypeFromDatabaseValue(secondExpression.Column_name, typeof(BytesType)), (BytesType)columnName2);
+ Assert.Equal(secondExpression.Op, IndexOperator.GT);
+ Assert.Equal(CassandraObject.GetTypeFromDatabaseValue(secondExpression.Value, typeof(BytesType)), (BytesType)columnValue2);
var thirdExpression = expressions[2];
- Assert.AreEqual(CassandraObject.GetTypeFromDatabaseValue(thirdExpression.Column_name, typeof(BytesType)), (BytesType)columnName3);
- Assert.AreEqual(secondExpression.Op, IndexOperator.GT);
- Assert.AreEqual(CassandraObject.GetTypeFromDatabaseValue(thirdExpression.Value, typeof(BytesType)), (BytesType)columnValue3);
+ Assert.Equal(CassandraObject.GetTypeFromDatabaseValue(thirdExpression.Column_name, typeof(BytesType)), (BytesType)columnName3);
+ Assert.Equal(secondExpression.Op, IndexOperator.GT);
+ Assert.Equal(CassandraObject.GetTypeFromDatabaseValue(thirdExpression.Value, typeof(BytesType)), (BytesType)columnValue3);
}
- [Test]
+ [Fact]
public void EqualsExpression()
{
// arrange
@@ -166,16 +166,16 @@ public void EqualsExpression()
var expressions = index.CompiledExpressions;
// assert
- Assert.AreEqual(1, expressions.Count);
+ Assert.Equal(1, expressions.Count);
var firstExpression = expressions[0];
- Assert.IsNotNull(firstExpression);
- Assert.AreEqual(CassandraObject.GetTypeFromDatabaseValue(firstExpression.Column_name, typeof(BytesType)), (BytesType)columnName);
- Assert.AreEqual(firstExpression.Op, IndexOperator.EQ);
- Assert.AreEqual(CassandraObject.GetTypeFromDatabaseValue(firstExpression.Value, typeof(BytesType)), (BytesType)columnValue);
+ Assert.NotNull(firstExpression);
+ Assert.Equal(CassandraObject.GetTypeFromDatabaseValue(firstExpression.Column_name, typeof(BytesType)), (BytesType)columnName);
+ Assert.Equal(firstExpression.Op, IndexOperator.EQ);
+ Assert.Equal(CassandraObject.GetTypeFromDatabaseValue(firstExpression.Value, typeof(BytesType)), (BytesType)columnValue);
}
- [Test]
+ [Fact]
public void GreaterThanExpression()
{
// arrange
@@ -192,16 +192,16 @@ public void GreaterThanExpression()
var expressions = index.CompiledExpressions;
// assert
- Assert.AreEqual(1, expressions.Count);
+ Assert.Equal(1, expressions.Count);
var firstExpression = expressions[0];
- Assert.IsNotNull(firstExpression);
- Assert.AreEqual(CassandraObject.GetTypeFromDatabaseValue(firstExpression.Column_name, typeof(BytesType)), (BytesType)columnName);
- Assert.AreEqual(firstExpression.Op, IndexOperator.GT);
- Assert.AreEqual(CassandraObject.GetTypeFromDatabaseValue(firstExpression.Value, typeof(BytesType)), (BytesType)columnValue);
+ Assert.NotNull(firstExpression);
+ Assert.Equal(CassandraObject.GetTypeFromDatabaseValue(firstExpression.Column_name, typeof(BytesType)), (BytesType)columnName);
+ Assert.Equal(firstExpression.Op, IndexOperator.GT);
+ Assert.Equal(CassandraObject.GetTypeFromDatabaseValue(firstExpression.Value, typeof(BytesType)), (BytesType)columnValue);
}
- [Test]
+ [Fact]
public void GreaterThanOrEqualExpression()
{
// arrange
@@ -218,16 +218,16 @@ public void GreaterThanOrEqualExpression()
var expressions = index.CompiledExpressions;
// assert
- Assert.AreEqual(1, expressions.Count);
+ Assert.Equal(1, expressions.Count);
var firstExpression = expressions[0];
- Assert.IsNotNull(firstExpression);
- Assert.AreEqual(CassandraObject.GetTypeFromDatabaseValue(firstExpression.Column_name, typeof(BytesType)), (BytesType)columnName);
- Assert.AreEqual(firstExpression.Op, IndexOperator.GTE);
- Assert.AreEqual(CassandraObject.GetTypeFromDatabaseValue(firstExpression.Value, typeof(BytesType)), (BytesType)columnValue);
+ Assert.NotNull(firstExpression);
+ Assert.Equal(CassandraObject.GetTypeFromDatabaseValue(firstExpression.Column_name, typeof(BytesType)), (BytesType)columnName);
+ Assert.Equal(firstExpression.Op, IndexOperator.GTE);
+ Assert.Equal(CassandraObject.GetTypeFromDatabaseValue(firstExpression.Value, typeof(BytesType)), (BytesType)columnValue);
}
- [Test]
+ [Fact]
public void LessThanExpression()
{
// arrange
@@ -244,16 +244,16 @@ public void LessThanExpression()
var expressions = index.CompiledExpressions;
// assert
- Assert.AreEqual(1, expressions.Count);
+ Assert.Equal(1, expressions.Count);
var firstExpression = expressions[0];
- Assert.IsNotNull(firstExpression);
- Assert.AreEqual(CassandraObject.GetTypeFromDatabaseValue(firstExpression.Column_name, typeof(BytesType)), (BytesType)columnName);
- Assert.AreEqual(firstExpression.Op, IndexOperator.LT);
- Assert.AreEqual(CassandraObject.GetTypeFromDatabaseValue(firstExpression.Value, typeof(BytesType)), (BytesType)columnValue);
+ Assert.NotNull(firstExpression);
+ Assert.Equal(CassandraObject.GetTypeFromDatabaseValue(firstExpression.Column_name, typeof(BytesType)), (BytesType)columnName);
+ Assert.Equal(firstExpression.Op, IndexOperator.LT);
+ Assert.Equal(CassandraObject.GetTypeFromDatabaseValue(firstExpression.Value, typeof(BytesType)), (BytesType)columnValue);
}
- [Test]
+ [Fact]
public void LessThanOrEqualExpression()
{
// arrange
@@ -270,13 +270,13 @@ public void LessThanOrEqualExpression()
var expressions = index.CompiledExpressions;
// assert
- Assert.AreEqual(1, expressions.Count);
+ Assert.Equal(1, expressions.Count);
var firstExpression = expressions[0];
- Assert.IsNotNull(firstExpression);
- Assert.AreEqual(CassandraObject.GetTypeFromDatabaseValue(firstExpression.Column_name, typeof(BytesType)), (BytesType)columnName);
- Assert.AreEqual(firstExpression.Op, IndexOperator.LTE);
- Assert.AreEqual(CassandraObject.GetTypeFromDatabaseValue(firstExpression.Value, typeof(BytesType)), (BytesType)columnValue);
+ Assert.NotNull(firstExpression);
+ Assert.Equal(CassandraObject.GetTypeFromDatabaseValue(firstExpression.Column_name, typeof(BytesType)), (BytesType)columnName);
+ Assert.Equal(firstExpression.Op, IndexOperator.LTE);
+ Assert.Equal(CassandraObject.GetTypeFromDatabaseValue(firstExpression.Value, typeof(BytesType)), (BytesType)columnValue);
}
}
}
View
31 test/FluentCassandra.Tests/Operations/ColumnCountTest.cs
@@ -1,35 +1,34 @@
using System;
using System.Linq;
-using NUnit.Framework;
+using Xunit;
using FluentCassandra.Types;
namespace FluentCassandra.Operations
{
- [TestFixture]
- public class ColumnCountTest
+
+ public class ColumnCountTest : IUseFixture<CassandraDatabaseSetupFixture>, IDisposable
{
private CassandraContext _db;
private CassandraColumnFamily<AsciiType> _family;
private CassandraSuperColumnFamily<AsciiType, AsciiType> _superFamily;
- private const string _testKey = "Test1";
- private const string _testSuperName = "SubTest1";
- [TestFixtureSetUp]
- public void TestInit()
+ public void SetFixture(CassandraDatabaseSetupFixture data)
{
- var setup = new CassandraDatabaseSetup();
+ var setup = data.DatabaseSetup();
_db = setup.DB;
_family = setup.Family;
_superFamily = setup.SuperFamily;
}
- [TestFixtureTearDown]
- public void TestCleanup()
+ public void Dispose()
{
_db.Dispose();
}
- [Test]
+ private const string _testKey = "Test1";
+ private const string _testSuperName = "SubTest1";
+
+ [Fact]
public void ColumnFamily_Key()
{
// arrange
@@ -39,10 +38,10 @@ public void ColumnFamily_Key()
int actual = _family.ColumnCount(_testKey, null, null);
// assert
- Assert.AreEqual(expected, actual);
+ Assert.Equal(expected, actual);
}
- [Test]
+ [Fact]
public void SuperColumnFamily_Key()
{
// arrange
@@ -52,10 +51,10 @@ public void SuperColumnFamily_Key()
int actual = _superFamily.ColumnCount(_testKey, null, null);
// assert
- Assert.AreEqual(expected, actual);
+ Assert.Equal(expected, actual);
}
- [Test]
+ [Fact]
public void SuperColumnFamily_Key_And_SuperColumnName()
{
// arrange
@@ -65,7 +64,7 @@ public void SuperColumnFamily_Key_And_SuperColumnName()
int actual = _superFamily.SuperColumnCount(_testKey, _testSuperName, null, null);
// assert
- Assert.AreEqual(expected, actual);
+ Assert.Equal(expected, actual);
}
}
}
View
18 test/FluentCassandra.Tests/Operations/CqlTest.cs
@@ -1,29 +1,27 @@
using System;
using System.Linq;
using FluentCassandra.Connections;
-using NUnit.Framework;
+using Xunit;
namespace FluentCassandra.Operations
{
- [TestFixture]
- public class CqlTest
+
+ public class CqlTest : IUseFixture<CassandraDatabaseSetupFixture>, IDisposable
{
private CassandraContext _db;
- [TestFixtureSetUp]