Beispiel #1
0
        public void Can_loop_each_with_filter_from_ModelWithOnlyStringFields_table()
        {
            using (var db = new OrmLiteConnectionFactory(ConnectionString, FirebirdDialect.Provider).Open())
            {
                db.CreateTable <ModelWithOnlyStringFields>(true);

                var rowIds = new List <string>(new[] { "id-1", "id-2", "id-3" });

                rowIds.ForEach(x => db.Insert(ModelWithOnlyStringFields.Create(x)));

                var filterRow = ModelWithOnlyStringFields.Create("id-4");
                filterRow.AlbumName = "FilteredName";

                db.Insert(filterRow);

                var dbRowIds = new List <string>();
                var rows     = db.Each <ModelWithOnlyStringFields>("AlbumName = {0}", filterRow.AlbumName);
                foreach (var row in rows)
                {
                    dbRowIds.Add(row.Id);
                }

                Assert.That(dbRowIds, Has.Count.EqualTo(1));
                Assert.That(dbRowIds[0], Is.EqualTo(filterRow.Id));
            }
        }
Beispiel #2
0
        public void Can_loop_each_string_from_ModelWithOnlyStringFields_table()
        {
            using (var db = new OrmLiteConnectionFactory(ConnectionString, FirebirdDialect.Provider).Open())
            {
                db.CreateTable <ModelWithOnlyStringFields>(true);

                var rowIds = new List <string>(new[] { "id-1", "id-2", "id-3" });

                rowIds.ForEach(x => db.Insert(ModelWithOnlyStringFields.Create(x)));

                var dbRowIds = new List <string>();
                foreach (var row in db.Each <ModelWithOnlyStringFields>())
                {
                    dbRowIds.Add(row.Id);
                }

                Assert.That(dbRowIds, Is.EquivalentTo(rowIds));
            }
        }
		public void Can_loop_each_with_filter_from_ModelWithOnlyStringFields_table()
		{
			using (var db = new OrmLiteConnectionFactory(ConnectionString, FirebirdDialect.Provider).Open())
			{
				db.CreateTable<ModelWithOnlyStringFields>(true);

				var rowIds = new List<string>(new[] {"id-1", "id-2", "id-3"});

				rowIds.ForEach(x => db.Insert(ModelWithOnlyStringFields.Create(x)));

				var filterRow = ModelWithOnlyStringFields.Create("id-4");
				filterRow.AlbumName = "FilteredName";

				db.Insert(filterRow);

				var dbRowIds = new List<string>();
				var rows = db.Each<ModelWithOnlyStringFields>("AlbumName = {0}", filterRow.AlbumName);
				foreach (var row in rows)
				{
					dbRowIds.Add(row.Id);
				}

				Assert.That(dbRowIds, Has.Count.EqualTo(1));
				Assert.That(dbRowIds[0], Is.EqualTo(filterRow.Id));
			}
		}
		public void Can_loop_each_string_from_ModelWithOnlyStringFields_table()
		{
			using (var db = new OrmLiteConnectionFactory(ConnectionString, FirebirdDialect.Provider).Open())
			{
				db.CreateTable<ModelWithOnlyStringFields>(true);

				var rowIds = new List<string>(new[] {"id-1", "id-2", "id-3"});

				rowIds.ForEach(x => db.Insert(ModelWithOnlyStringFields.Create(x)));

				var dbRowIds = new List<string>();
				foreach (var row in db.Each<ModelWithOnlyStringFields>())
				{
					dbRowIds.Add(row.Id);
				}

				Assert.That(dbRowIds, Is.EquivalentTo(rowIds));
			}
		}