cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sandeep <Sand...@indatus.com>
Subject Nunit Testing & Cassandra
Date Tue, 25 May 2010 13:40:11 GMT
Hi all,

I am recent grad and working on  Cassandra and Nunit testing.

I wrote a unit test in C# which goes like this

List<KeySlice> listOfKeys = new List<KeySlice>();

            KeySlice item1 = new KeySlice();

            KeySlice item2 = new KeySlice();

            KeySlice item3 = new KeySlice();

            KeySlice item4 = new KeySlice();

            item1.Key = "key1";

            item2.Key = "key2";

            item3.Key = "key3";

            item4.Key = "key4";

            List<ColumnOrSuperColumn> listOfColumnOrSuperColumn1 = new List<ColumnOrSuperColumn>();

            List<ColumnOrSuperColumn> listOfColumnOrSuperColumn2 = new List<ColumnOrSuperColumn>();

            List<ColumnOrSuperColumn> listOfColumnOrSuperColumn3 = new List<ColumnOrSuperColumn>();

            List<ColumnOrSuperColumn> listOfColumnOrSuperColumn4 = new List<ColumnOrSuperColumn>();

            listOfColumnOrSuperColumn1.Add(new ColumnOrSuperColumn() { Column = new Column()
{ Name = utf8Encoding.GetBytes("key1"), Value = utf8Encoding.GetBytes("100"), Timestamp =
timeStamp } });

            listOfColumnOrSuperColumn2.Add(new ColumnOrSuperColumn() { Column = new Column()
{ Name = utf8Encoding.GetBytes("key2"), Value = utf8Encoding.GetBytes("200"), Timestamp =
timeStamp } });

            listOfColumnOrSuperColumn3.Add(new ColumnOrSuperColumn() { Column = new Column()
{ Name = utf8Encoding.GetBytes("key3"), Value = utf8Encoding.GetBytes("300"), Timestamp =
timeStamp } });

            listOfColumnOrSuperColumn4.Add(new ColumnOrSuperColumn() { Column = new Column()
{ Name = utf8Encoding.GetBytes("key4"), Value = utf8Encoding.GetBytes("400"), Timestamp =
timeStamp } });

            item1.Columns = listOfColumnOrSuperColumn1;

            item2.Columns = listOfColumnOrSuperColumn2;

            item3.Columns = listOfColumnOrSuperColumn3;

            item4.Columns = listOfColumnOrSuperColumn4;

            listOfKeys.Add(item1);

            listOfKeys.Add(item3);

            listOfKeys.Add(item4);

            listOfKeys.Add(item2);

            Assert.AreEqual(listOfKeys,  Is.EquivalentTo(TestService.GetListOfRowKeysFromCF("ColumnFamilyName","Keyspace1")));

            TestService.GetListOfRowKeysFromCF() returns a List<Keyslices>. I am constructing
the same list<Keyslices> in the same order in which I have inserted in some other method.

            But the test always fails. Can any one please tell me where am I going wrong.
Timestamp value is a global variable and is used through out the class.

      Thanks in advance.

Mime
View raw message