public void DisposeCanBeCalledSafelyIfContextIsNull() { var client = new SnapshotEFClient(null); Action act = () => client.Dispose(); act.Should() .NotThrow <NullReferenceException>(); }
public void GetLinesForFileRetrievesTheExpectedLines() { using var context = new HestiaContext(Options); var client = new SnapshotEFClient(context); var lines = client.GetLinesForFile(SeededFileId); lines.Should() .HaveCount(1); }
public void ClientShouldDisposeDbContext() { var context = new HestiaContextSpy(Options); var client = new SnapshotEFClient(context); client.Dispose(); context.IsDisposed.Should() .BeTrue(); }
public void GetFileDetailsShouldReturnNoneIfFileWasNotFound() { using var context = new HestiaContext(Options); var client = new SnapshotEFClient(context); client.GetFileDetails("invalid") .IsNone .Should() .BeTrue(); }
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); }
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); }
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); }
public void GetAllSnapshotsShouldReturnTheSeededSnapshots() { using var context = new HestiaContext(Options); var client = new SnapshotEFClient(context); client.GetAllSnapshotsHeaders() .First() .Id .Should() .Be(SeededSnapshotId); }
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); }
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); }