Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Finished adding the Counters bootstrap information to the CassandraDa…

…tabaseSetup.cs file and implemented the Counter_GetSlice_Columns() unit test in the MultiSliceGetTest.cs file
  • Loading branch information...
commit 311cd7b5541e3995014e901d4e61fab9fd0e4616 1 parent a6e3f52
Aaron Stannard Aaronontheweb authored
14 test/FluentCassandra.Tests/CassandraDatabaseSetup.cs
View
@@ -88,8 +88,8 @@ public void ResetDatabase()
keyspace.TryCreateColumnFamily<UUIDType>("StandardUUIDType");
keyspace.TryCreateColumnFamily(new CassandraColumnFamilySchema()
{
- FamilyName = "Counter",
- ColumnNameType = CassandraType.UTF8Type,
+ FamilyName = "Counters",
+ ColumnNameType = CassandraType.AsciiType,
DefaultColumnValueType = CassandraType.CounterColumnType
});
keyspace.TryCreateColumnFamily(new CassandraColumnFamilySchema {
@@ -105,24 +105,24 @@ public void ResetDatabase()
ColumnNameType = CassandraType.DynamicCompositeType(new Dictionary<char, CassandraType> { { 'a', CassandraType.AsciiType }, { 'd', CassandraType.DoubleType } })
});
- db.ExecuteNonQuery(@"
+ db.ExecuteNonQuery(@"
CREATE COLUMNFAMILY Users (
Id int PRIMARY KEY,
Name ascii,
Email ascii,
Age int
);");
- db.ExecuteNonQuery(@"CREATE INDEX User_Age ON Users (Age);");
+ db.ExecuteNonQuery(@"CREATE INDEX User_Age ON Users (Age);");
db.Keyspace.ClearCachedKeyspaceSchema();
var family = db.GetColumnFamily<AsciiType>("Standard");
var superFamily = db.GetColumnFamily<AsciiType, AsciiType>("Super");
- var userFamily = db.GetColumnFamily("Users");
- var counterFamily = db.GetColumnFamily("Counters");
+ var userFamily = db.GetColumnFamily("Users");
+ var counterFamily = db.GetColumnFamily("Counter");
ResetFamily(family);
ResetSuperFamily(superFamily);
- ResetUsersFamily(userFamily);
+ ResetUsersFamily(userFamily);
ResetCounterColumnFamily(counterFamily);
}
}
19 test/FluentCassandra.Tests/Operations/MultiGetSliceTest.cs
View
@@ -10,6 +10,8 @@ public class MultiGetSliceTest : IUseFixture<CassandraDatabaseSetupFixture>, IDi
{
private CassandraContext _db;
private CassandraColumnFamily<AsciiType> _family;
+ private CassandraColumnFamily _counterFamily;
+
private CassandraSuperColumnFamily<AsciiType, AsciiType> _superFamily;
public void SetFixture(CassandraDatabaseSetupFixture data)
@@ -18,6 +20,7 @@ public void SetFixture(CassandraDatabaseSetupFixture data)
_db = setup.DB;
_family = setup.Family;
_superFamily = setup.SuperFamily;
+ _counterFamily = setup.CounterFamily;
}
public void Dispose()
@@ -46,6 +49,22 @@ public void Standard_GetSlice_Columns()
Assert.Equal(expectedCount, columns.Count());
}
+ [Fact]
+ public void Counter_GetSlice_Columns()
+ {
+ // arrange
+ int expectedCount = 2;
+
+ // act
+ var columns = _counterFamily
+ .Get(new BytesType[] { _testKey, _testKey2 })
+ .FetchColumns(new AsciiType[] { "Test1", "Test2" })
+ .Execute();
+
+ // assert
+ Assert.Equal(expectedCount, columns.Count());
+ }
+
[Fact]
public void Super_GetSlice_Columns()
{
Please sign in to comment.
Something went wrong with that request. Please try again.