public void Fetch_UsingSelectCqlString() { Table <Author> table = new Table <Author>(_session, new MappingConfiguration()); table.Create(); var mapper = new Mapper(_session, new MappingConfiguration().Define(new FluentUserMapping())); List <string> followersForAuthor = new List <string>() { "follower1", "follower2", "" }; Author expectedAuthor = new Author { AuthorId = Guid.NewGuid().ToString(), Followers = followersForAuthor, }; mapper.Insert(expectedAuthor); List <Author> authors = mapper.Fetch <Author>("SELECT * from " + table.Name).ToList(); Assert.AreEqual(1, authors.Count); expectedAuthor.AssertEquals(authors[0]); }
public void Fetch_ListUploadedAsNull() { Table <Author> table = new Table <Author>(_session, new MappingConfiguration()); table.Create(); var mapper = new Mapper(_session, new MappingConfiguration().Define(new FluentUserMapping())); Author expectedAuthor = Author.GetRandom(); expectedAuthor.Followers = null; mapper.Insert(expectedAuthor); // Assert values from cql query Author expectedAuthorFromQuery = new Author { Followers = new List <string>(), // not null AuthorId = expectedAuthor.AuthorId, }; Cql cql = new Cql("SELECT * from " + table.Name); List <Author> actualAuthors = mapper.Fetch <Author>(cql).ToList(); Assert.AreEqual(1, actualAuthors.Count); expectedAuthorFromQuery.AssertEquals(actualAuthors[0]); }