public async Task Save_DuplicateReferenceNumber_Failed() { var presetReferenceNumber = "refnumber"; referenceNumberGenerator.PresetReferenceNumber(presetReferenceNumber); var repo = new SubmissionRepository(fileSystem, configuration, referenceNumberGenerator); var submission = new Submission { }; await repo.SaveAsync(submission); await Assert.ThrowsAsync <Exception>(async() => await repo.SaveAsync(submission)); }
public async Task Save_FileExistsInFolder() { var repo = new SubmissionRepository(fileSystem, configuration, referenceNumberGenerator); var submission = new Submission { }; var referenceNumber = await repo.SaveAsync(submission); Assert.NotNull(referenceNumber); Assert.True(fileSystem.FileExists(fileSystem.Path.Combine(submissionPersistencePath, $"submission_{referenceNumber}.json"))); }
public async Task Get_SavedSubmissionReturned() { var repo = new SubmissionRepository(fileSystem, configuration, referenceNumberGenerator); var submission = new Submission { }; var referenceNumber = await repo.SaveAsync(submission); var loadedSumbission = await repo.GetAsync(referenceNumber); Assert.NotNull(loadedSumbission); }