Example #1
0
        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));
        }
Example #2
0
        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")));
        }
Example #3
0
        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);
        }