示例#1
0
        public void ThenIShouldHaveSingleIntKeyEntitiesInTheDatabase(int entitiesCount)
        {
            var dbConnection = _testContext.DatabaseConnection;
            var entities     = FastCrud.Find <SimpleBenchmarkEntity>(dbConnection);

            Assert.That(entities.Count(), Is.EqualTo(entitiesCount));
        }
示例#2
0
        public void WhenIDeleteAllTheInsertedSingleIntKeyEntitiesUsingFastCrud()
        {
            var dbConnection = _testContext.DatabaseConnection;

            foreach (var entity in _testContext.LocalEntities.OfType <SimpleBenchmarkEntity>())
            {
                FastCrud.Delete(dbConnection, entity);
            }
        }
示例#3
0
        public void WhenISelectAllTheSingleIntKeyEntitiesThatIPreviouslyInsertedUsingFastCrud()
        {
            var dbConnection = _testContext.DatabaseConnection;

            foreach (var entity in _testContext.LocalEntities.OfType <SimpleBenchmarkEntity>())
            {
                _testContext.QueriedEntities.Add(FastCrud.Get <SimpleBenchmarkEntity>(dbConnection, new SimpleBenchmarkEntity()
                {
                    Id = entity.Id
                }));
            }
        }
示例#4
0
        public void WhenIUpdateAllTheSingleIntKeyEntitiesThatIPreviouslyInsertedUsingFastCrud()
        {
            var dbConnection = _testContext.DatabaseConnection;
            var entityCount  = _testContext.LocalEntities.Count;

            for (var entityIndex = 0; entityIndex < _testContext.LocalEntities.Count; entityIndex++)
            {
                var oldEntity = _testContext.LocalEntities[entityIndex] as SimpleBenchmarkEntity;
                var newEntity = this.GenerateSimpleBenchmarkEntity(entityCount++);
                newEntity.Id = oldEntity.Id;
                FastCrud.Update(dbConnection, newEntity);
                _testContext.LocalEntities[entityIndex] = newEntity;
            }
        }
示例#5
0
        public void WhenIInsertSingleIntKeyEntitiesUsingFastCrud(int entitiesCount)
        {
            var dbConnection = _testContext.DatabaseConnection;

            for (var entityIndex = 1; entityIndex <= entitiesCount; entityIndex++)
            {
                var generatedEntity = this.GenerateSimpleBenchmarkEntity(entityIndex);

                FastCrud.Insert(dbConnection, generatedEntity);
                // the entity already has the associated id set

                Assert.Greater(generatedEntity.Id, 1); // the seed starts from 2 in the db to avoid confusion with the number of rows modified
                _testContext.LocalEntities.Add(generatedEntity);
            }
        }
示例#6
0
        public void WhenISelectAllTheSingleIntKeyEntitiesUsingFastCrud()
        {
            var dbConnection = _testContext.DatabaseConnection;

            _testContext.QueriedEntities.AddRange(FastCrud.Find <SimpleBenchmarkEntity>(dbConnection));
        }