public void CanCreateFixture() { using (var fixture = new SqliteFixture()) { Assert.NotNull(fixture); } }
public async Task <bool> Can_save_object_to_store() { using var db = new SqliteFixture <AddSimpleObject>(); db.Open(); var transform = new CreatedAtTransform(() => DateTimeOffset.UtcNow); var logger = new NullLogger <SqlObjectSaveStore>(); var store = new SqlObjectSaveStore(db.ConnectionString, new SqliteDialect(), new AttributeDataInfoProvider(), logger, transform); var result = await store.SaveAsync(new SimpleObject { Id = 1 }); if (!result.Succeeded) { return(false); } var counter = db.GetCountStore(); var count = await counter.CountAsync(typeof(SimpleObject)); if (!count.Succeeded) { return(false); } return(count.Data == 1); }
public async Task <bool> Cannot_create_same_object_twice() { using var db = new SqliteFixture <AddSimpleObject>(); db.Open(); var instance = new SimpleObject { Id = 1 }; var store = db.GetCreateStore(); var result = await store.CreateAsync(instance); if (!result.Succeeded) { return(false); } result = await store.CreateAsync(instance); if (result.Succeeded) { return(false); } var counter = db.GetCountStore(); var count = await counter.CountAsync(typeof(SimpleObject)); if (!count.Succeeded) { return(false); } return(count.Data == 1); }
public void CanGetConnection() { using (var fixture = new SqliteFixture()) { using (var conn = fixture.GetConnection()) { Assert.NotNull(conn); } } }
public async Task <bool> Empty_database_has_no_objects() { using var db = new SqliteFixture <AddSimpleObject>(); db.Open(); var counter = db.GetCountStore(); var count = await counter.CountAsync(typeof(SimpleObject)); if (!count.Succeeded) { return(false); } return(count.Data == 0); }
public async Task <bool> Can_create_object_in_store() { using var db = new SqliteFixture <AddSimpleObject>(); db.Open(); var store = db.GetCreateStore(); var instance = new SimpleObject { Id = 1 }; var result = await store.CreateAsync(instance); if (!result.Succeeded) { return(false); } var countStore = db.GetCountStore(); var count = await countStore.CountAsync(typeof(SimpleObject)); if (!count.Succeeded || count.Data != 1) { return(false); } var queryStore = db.GetSingleObjectQueryByExampleStore(); var fetched = await queryStore.QueryFirstOrDefaultByExampleAsync <SimpleObject>(new { Id = 1 }); if (fetched == null) { return(false); } return(true); }
public UnitOfWorkFacts(SqliteFixture fixture) { this.fixture = fixture; }
public GraphUpdatesSqliteChangedChangingNotificationsTest(SqliteFixture fixture) : base(fixture) { }
public GraphUpdatesSqliteSnapshotNotificationsTest(SqliteFixture fixture) : base(fixture) { }
public GraphUpdatesSqliteFullWithOriginalsNotificationsTest(SqliteFixture fixture) : base(fixture) { }
public FolderScanTests(SqliteFixture fixture) { connection = fixture.GetConnection(); connection.Open(); }
public RepositoryFacts(SqliteFixture fixture) { this.fixture = fixture; }
public SnapshotNotifications(SqliteFixture fixture) : base(fixture) { }
public FullWithOriginalsNotifications(SqliteFixture fixture) : base(fixture) { }
public ChangedNotifications(SqliteFixture fixture) : base(fixture) { }
public SqliteDatabaseTests(SqliteFixture fixture) { connection = fixture.GetConnection(); connection.Open(); }