示例#1
0
 public void CanCreateFixture()
 {
     using (var fixture = new SqliteFixture())
     {
         Assert.NotNull(fixture);
     }
 }
示例#2
0
        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);
        }
示例#4
0
 public void CanGetConnection()
 {
     using (var fixture = new SqliteFixture())
     {
         using (var conn = fixture.GetConnection())
         {
             Assert.NotNull(conn);
         }
     }
 }
示例#5
0
        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);
        }
示例#7
0
 public UnitOfWorkFacts(SqliteFixture fixture)
 {
     this.fixture = fixture;
 }
示例#8
0
 public GraphUpdatesSqliteChangedChangingNotificationsTest(SqliteFixture fixture)
     : base(fixture)
 {
 }
 public GraphUpdatesSqliteSnapshotNotificationsTest(SqliteFixture fixture)
     : base(fixture)
 {
 }
示例#10
0
 public GraphUpdatesSqliteFullWithOriginalsNotificationsTest(SqliteFixture fixture)
     : base(fixture)
 {
 }
示例#11
0
 public FolderScanTests(SqliteFixture fixture)
 {
     connection = fixture.GetConnection();
     connection.Open();
 }
示例#12
0
 public RepositoryFacts(SqliteFixture fixture)
 {
     this.fixture = fixture;
 }
示例#13
0
 public SnapshotNotifications(SqliteFixture fixture)
     : base(fixture)
 {
 }
示例#14
0
 public FullWithOriginalsNotifications(SqliteFixture fixture)
     : base(fixture)
 {
 }
示例#15
0
 public ChangedNotifications(SqliteFixture fixture)
     : base(fixture)
 {
 }
示例#16
0
 public SqliteDatabaseTests(SqliteFixture fixture)
 {
     connection = fixture.GetConnection();
     connection.Open();
 }