public static List <AllDataTypesEntity> GetDefaultAllDataTypesList()
        {
            List <AllDataTypesEntity> objectList = new List <AllDataTypesEntity>();

            for (int i = 0; i < AllDataTypesEntity.DefaultListLength; i++)
            {
                objectList.Add(AllDataTypesEntity.GetRandomInstance());
            }
            return(objectList);
        }
Ejemplo n.º 2
0
 public void LinqSelect_BooleanType_Sync()
 {
     List<AllDataTypesEntity> actualEntities = _table.Select(e => new AllDataTypesEntity { BooleanType = e.BooleanType }).Execute().ToList();
     Assert.AreEqual(_entityList.Count, actualEntities.Count);
     foreach (var entity in _entityList)
     {
         AllDataTypesEntity expectedEntity = new AllDataTypesEntity
         {
             BooleanType = entity.BooleanType
         };
         AllDataTypesEntityUtil.AssertListContains(actualEntities, expectedEntity);
     }
 }
        public static List <AllDataTypesEntity> SetupDefaultTable(ISession session)
        {
            // drop table if exists, re-create
            var table = new Table <AllDataTypesEntity>(session, new Cassandra.Mapping.MappingConfiguration());

            table.Create();

            List <AllDataTypesEntity> allDataTypesRandomList = AllDataTypesEntity.GetDefaultAllDataTypesList();

            //Insert some data
            foreach (var allDataTypesEntity in allDataTypesRandomList)
            {
                table.Insert(allDataTypesEntity).Execute();
            }

            return(allDataTypesRandomList);
        }
Ejemplo n.º 4
0
        private static AllDataTypesEntity WriteReadValidateUsingSessionBatch(Table <AllDataTypesEntity> table)
        {
            Batch batch = table.GetSession().CreateBatch();
            AllDataTypesEntity expectedDataTypesEntityRow = AllDataTypesEntity.GetRandomInstance();
            string             uniqueKey = expectedDataTypesEntityRow.StringType;

            batch.Append(table.Insert(expectedDataTypesEntityRow));
            batch.Execute();

            List <AllDataTypesEntity> listOfAllDataTypesObjects = (from x in table where x.StringType.Equals(uniqueKey) select x).Execute().ToList();

            Assert.NotNull(listOfAllDataTypesObjects);
            Assert.AreEqual(1, listOfAllDataTypesObjects.Count);
            AllDataTypesEntity actualDataTypesEntityRow = listOfAllDataTypesObjects.First();

            expectedDataTypesEntityRow.AssertEquals(actualDataTypesEntityRow);
            return(expectedDataTypesEntityRow);
        }
Ejemplo n.º 5
0
        private static AllDataTypesEntity WriteReadValidateUsingTableMethods(Table <AllDataTypesEntity> table)
        {
            AllDataTypesEntity expectedDataTypesEntityRow = AllDataTypesEntity.GetRandomInstance();
            string             uniqueKey = expectedDataTypesEntityRow.StringType;

            // insert record
            table.GetSession().Execute(table.Insert(expectedDataTypesEntityRow));

            // select record
            List <AllDataTypesEntity> listOfAllDataTypesObjects = (from x in table where x.StringType.Equals(uniqueKey) select x).Execute().ToList();

            Assert.NotNull(listOfAllDataTypesObjects);
            Assert.AreEqual(1, listOfAllDataTypesObjects.Count);
            AllDataTypesEntity actualDataTypesEntityRow = listOfAllDataTypesObjects.First();

            expectedDataTypesEntityRow.AssertEquals(actualDataTypesEntityRow);
            return(expectedDataTypesEntityRow);
        }
 public void AssertEquals(AllDataTypesEntity actualEntity)
 {
     AllDataTypesEntityUtil.AssertEquals(this, actualEntity);
 }
        public static AllDataTypesEntity GetRandomInstance()
        {
            AllDataTypesEntity adte = new AllDataTypesEntity();

            return((AllDataTypesEntity)AllDataTypesEntityUtil.Randomize(adte));
        }
Ejemplo n.º 8
0
 public static bool AssertListContains(List <AllDataTypesEntity> expectedEntities, AllDataTypesEntity actualEntity)
 {
     foreach (var expectedEntity in expectedEntities)
     {
         try
         {
             AssertEquals(expectedEntity, actualEntity);
             return(true);
         }
         catch (AssertionException) { }
     }
     return(false);
 }
 public static bool AssertListContains(List<AllDataTypesEntity> expectedEntities, AllDataTypesEntity actualEntity)
 {
     foreach (var expectedEntity in expectedEntities)
     {
         try
         {
             AssertEquals(expectedEntity, actualEntity);
             return true;
         }
         catch (AssertionException) { }
     }
     return false;
 }
Ejemplo n.º 10
0
 public void AssertEquals(AllDataTypesEntity actualEntity)
 {
     AllDataTypesEntityUtil.AssertEquals(this, actualEntity);
 }
Ejemplo n.º 11
0
 public static AllDataTypesEntity GetRandomInstance()
 {
     AllDataTypesEntity adte = new AllDataTypesEntity();
     return (AllDataTypesEntity)AllDataTypesEntityUtil.Randomize(adte);
 }