Exemple #1
0
        public void DisposeCanBeCalledSafelyIfContextIsNull()
        {
            var client = new SnapshotEFClient(null);

            Action act = () => client.Dispose();

            act.Should()
            .NotThrow <NullReferenceException>();
        }
Exemple #2
0
        public void GetLinesForFileRetrievesTheExpectedLines()
        {
            using var context = new HestiaContext(Options);
            var client = new SnapshotEFClient(context);

            var lines = client.GetLinesForFile(SeededFileId);

            lines.Should()
            .HaveCount(1);
        }
Exemple #3
0
        public void ClientShouldDisposeDbContext()
        {
            var context = new HestiaContextSpy(Options);
            var client  = new SnapshotEFClient(context);

            client.Dispose();

            context.IsDisposed.Should()
            .BeTrue();
        }
Exemple #4
0
        public void GetFileDetailsShouldReturnNoneIfFileWasNotFound()
        {
            using var context = new HestiaContext(Options);
            var client = new SnapshotEFClient(context);

            client.GetFileDetails("invalid")
            .IsNone
            .Should()
            .BeTrue();
        }
Exemple #5
0
        public void GetFileDetailsShouldReturnSeededFileDetails()
        {
            using var context = new HestiaContext(Options);
            var client = new SnapshotEFClient(context);

            client.GetFileDetails(SeededFileId)
            .Match(x => x, () => null)
            ?.Id.Should()
            .Be(SeededFileId);
        }
Exemple #6
0
        public void GetSnapshotByIdShouldReturnSeededSnapshot()
        {
            using var context = new HestiaContext(Options);
            var client = new SnapshotEFClient(context);

            client.GetSnapshotById(SeededSnapshotId)
            .Match(x => x, () => null)
            ?.Id.Should()
            .Be(SeededSnapshotId);
        }
Exemple #7
0
        public void GetAllFilesForSnapshotRetrievesAllFilesForSnapshotId()
        {
            using var context = new HestiaContext(Options);
            var client = new SnapshotEFClient(context);

            var files = client.GetAllFilesForSnapshot(SeededSnapshotId);

            files.First()
            .Id.Should()
            .Be(SeededFileId);
        }
Exemple #8
0
        public void GetAllSnapshotsShouldReturnTheSeededSnapshots()
        {
            using var context = new HestiaContext(Options);
            var client = new SnapshotEFClient(context);

            client.GetAllSnapshotsHeaders()
            .First()
            .Id
            .Should()
            .Be(SeededSnapshotId);
        }
Exemple #9
0
        public void InsertSnapshotSyncShouldPersistAsExpected()
        {
            using var context = new HestiaContext(Options);
            var client = new SnapshotEFClient(context);

            client.InsertSnapshotSync(NewSnapshot);

            context.Snapshots.Count()
            .Should()
            .Be(2);
            context.Snapshots.ToList()[1]
            .Name
            .Should()
            .Be("somename");
            context.SourceLines
            .Should()
            .HaveCount(1);
        }
Exemple #10
0
        public void InsertSnapshotShouldPersistAsExpected()
        {
            using var context = new HestiaContext(Options);
            var scheduler = new TestScheduler();
            var client    = new SnapshotEFClient(context);

            scheduler.Start(() => client.InsertSnapshot(NewSnapshot));

            context.Snapshots.Count()
            .Should()
            .Be(2);
            context.Snapshots.ToList()[1]
            .Name
            .Should()
            .Be("somename");
            context.SourceLines
            .Should()
            .HaveCount(1);
        }