public void Fetch_WithConsistencyLevel_Valids() { Table <Author> table = new Table <Author>(_session, new MappingConfiguration()); table.Create(); int totalInserts = 10; var mapper = new Mapper(_session, new MappingConfiguration().Define(new FluentUserMapping())); List <Author> expectedAuthors = Author.GetRandomList(totalInserts); foreach (Author expectedAuthor in expectedAuthors) { mapper.Insert(expectedAuthor); } var consistencyLevels = new[] { ConsistencyLevel.All, ConsistencyLevel.LocalOne, ConsistencyLevel.LocalQuorum, ConsistencyLevel.Quorum, ConsistencyLevel.One, }; foreach (var consistencyLevel in consistencyLevels) { Cql cql = new Cql("SELECT * from " + table.Name).WithOptions(c => c.SetConsistencyLevel(consistencyLevel)); List <Author> actualAuthors = mapper.Fetch <Author>(cql).ToList(); Assert.AreEqual(totalInserts, actualAuthors.Count); Author.AssertListsContainTheSame(expectedAuthors, actualAuthors); } }
public void Fetch_UsingCqlObject() { Table <Author> table = new Table <Author>(_session, new MappingConfiguration()); table.Create(); int totalInserts = 10; var mapper = new Mapper(_session, new MappingConfiguration().Define(new FluentUserMapping())); List <Author> expectedAuthors = Author.GetRandomList(totalInserts); foreach (Author expectedAuthor in expectedAuthors) { mapper.Insert(expectedAuthor); } Cql cql = new Cql("SELECT * from " + table.Name); List <Author> actualAuthors = mapper.Fetch <Author>(cql).ToList(); Assert.AreEqual(totalInserts, actualAuthors.Count); Author.AssertListsContainTheSame(expectedAuthors, actualAuthors); }