Exemplo n.º 1
0
        DraftFileBusinessLogic_Update_When_Data_Is_Sent_Repeatedly_Draft_Integrity_Is_MaintainedAsync()
        {
            // Arrange
            var maryUserId           = testUserId;
            var systemFileRepository = new SystemFileRepository(new StorageOptions());

            testDraftFileBusinessLogic = new DraftFileBusinessLogic(null, systemFileRepository);
            var returnViewModelThatMaryWillSendTwice = new ReturnViewModel {
                DiffMeanBonusPercent = 65.3m
            };

            // Act
            var emptyDraftLockedToMary =
                await testDraftFileBusinessLogic.GetExistingOrNewAsync(testOrganisationId, testSnapshotYear,
                                                                       maryUserId);

            var intermediateDraftInfo =
                await testDraftFileBusinessLogic.GetExistingOrNewAsync(testOrganisationId, testSnapshotYear,
                                                                       maryUserId);

            Assert.Null(intermediateDraftInfo.ReturnViewModelContent, "Expected file to be empty");
            Assert.AreEqual(maryUserId, intermediateDraftInfo.LastWrittenByUserId, "Should have been locked to Mary");
            Assert.True(await systemFileRepository.GetFileExistsAsync(intermediateDraftInfo.DraftPath));
            Assert.True(await systemFileRepository.GetFileExistsAsync(intermediateDraftInfo.BackupDraftPath));

            var draftWithData = await testDraftFileBusinessLogic.UpdateAsync(
                returnViewModelThatMaryWillSendTwice,
                emptyDraftLockedToMary,
                maryUserId);

            intermediateDraftInfo =
                await testDraftFileBusinessLogic.GetExistingOrNewAsync(testOrganisationId, testSnapshotYear,
                                                                       maryUserId);

            Assert.AreEqual(65.3m, intermediateDraftInfo.ReturnViewModelContent.DiffMeanBonusPercent);
            Assert.AreEqual(maryUserId, intermediateDraftInfo.LastWrittenByUserId, "Should have been locked to Mary");
            Assert.True(await systemFileRepository.GetFileExistsAsync(intermediateDraftInfo.DraftPath));
            Assert.True(await systemFileRepository.GetFileExistsAsync(intermediateDraftInfo.BackupDraftPath));

            var updatedDraft = await testDraftFileBusinessLogic.UpdateAsync(
                returnViewModelThatMaryWillSendTwice,
                draftWithData,
                maryUserId);

            intermediateDraftInfo =
                await testDraftFileBusinessLogic.GetExistingOrNewAsync(testOrganisationId, testSnapshotYear,
                                                                       maryUserId);

            Assert.AreEqual(65.3m, intermediateDraftInfo.ReturnViewModelContent.DiffMeanBonusPercent);
            Assert.AreEqual(maryUserId, intermediateDraftInfo.LastWrittenByUserId, "Should have been locked to Mary");
            Assert.True(await systemFileRepository.GetFileExistsAsync(intermediateDraftInfo.DraftPath));
            Assert.True(await systemFileRepository.GetFileExistsAsync(intermediateDraftInfo.BackupDraftPath));

            // Cleanup
            await testDraftFileBusinessLogic.DiscardDraftAsync(updatedDraft);
        }
Exemplo n.º 2
0
        DraftFileBusinessLogic_GetDraftIfAvailable_When_Json_Has_Data_And_Bak_File_Has_Data_Return_Bak_Draft_InfoAsync()
        {
            // Arrange
            var joeUserId            = testUserId;
            var systemFileRepository = new SystemFileRepository(new StorageOptions());

            testDraftFileBusinessLogic = new DraftFileBusinessLogic(null, systemFileRepository);
            var returnViewModelThatJoeWillSendFirst = new ReturnViewModel {
                DiffMedianBonusPercent = 11.1m
            };
            var returnViewModelThatJoeWillSendSecond =
                new ReturnViewModel {
                DiffMedianBonusPercent = 22.02m, DiffMeanHourlyPayPercent = 20.2m
            };

            var emptyDraftLockedToJoe =
                await testDraftFileBusinessLogic.GetExistingOrNewAsync(testOrganisationId, testSnapshotYear, joeUserId);

            var draftWithFirstLoadOfData = await testDraftFileBusinessLogic.UpdateAsync(
                returnViewModelThatJoeWillSendFirst,
                emptyDraftLockedToJoe,
                joeUserId);

            await testDraftFileBusinessLogic.CommitDraftAsync(draftWithFirstLoadOfData);

            emptyDraftLockedToJoe =
                await testDraftFileBusinessLogic.GetExistingOrNewAsync(testOrganisationId, testSnapshotYear, joeUserId);

            draftWithFirstLoadOfData = await testDraftFileBusinessLogic.UpdateAsync(
                returnViewModelThatJoeWillSendSecond,
                emptyDraftLockedToJoe,
                joeUserId);

            // Act
            var availableDraft =
                await testDraftFileBusinessLogic.GetDraftIfAvailableAsync(testOrganisationId, testSnapshotYear);

            // Assert
            Assert.NotNull(
                availableDraft,
                "Both files contain data, as it is an inconsistent state (bak shouldn't be there if the process completed correctly), we used the backed up data as it is the file we consider the most 'correct'");
            Assert.AreEqual(
                11.1m,
                availableDraft.ReturnViewModelContent.DiffMedianBonusPercent,
                "Information in the draft should be the one from the bak file");

            // Cleanup
            await testDraftFileBusinessLogic.DiscardDraftAsync(availableDraft);
        }
Exemplo n.º 3
0
        DraftFileBusinessLogic_GetDraftIfAvailable_When_Json_Has_Data_And_Not_Bak_File_Return_DraftAsync()
        {
            // Arrange
            var trevorUserId         = testUserId;
            var systemFileRepository = new SystemFileRepository(new StorageOptions());

            testDraftFileBusinessLogic = new DraftFileBusinessLogic(null, systemFileRepository);
            var returnViewModelThatTrevorWillSendFirst = new ReturnViewModel {
                DiffMedianBonusPercent = 11.1m
            };

            var emptyDraftLockedToTrevor =
                await testDraftFileBusinessLogic.GetExistingOrNewAsync(testOrganisationId, testSnapshotYear,
                                                                       trevorUserId);

            var draftWithFirstLoadOfData = await testDraftFileBusinessLogic.UpdateAsync(
                returnViewModelThatTrevorWillSendFirst,
                emptyDraftLockedToTrevor,
                trevorUserId);

            await testDraftFileBusinessLogic.CommitDraftAsync(draftWithFirstLoadOfData);

            // Act
            var availableDraft =
                await testDraftFileBusinessLogic.GetDraftIfAvailableAsync(testOrganisationId, testSnapshotYear);

            // Assert
            Assert.NotNull(availableDraft,
                           "Json has data and there isn't a bak file, this is a consistent state, so a draft is available");

            // Cleanup
            await testDraftFileBusinessLogic.DiscardDraftAsync(availableDraft);
        }
Exemplo n.º 4
0
        DraftFileBusinessLogic_GetDraftIfAvailable_When_Json_Has_Data_And_Bak_File_Empty_Return_NullAsync()
        {
            // Arrange
            var oliviaUserId         = testUserId;
            var systemFileRepository = new SystemFileRepository(new StorageOptions());

            testDraftFileBusinessLogic = new DraftFileBusinessLogic(null, systemFileRepository);
            var returnViewModelThatOliviaWillSendFirst = new ReturnViewModel {
                DiffMedianBonusPercent = 11.1m
            };

            var emptyDraftLockedToOlivia =
                await testDraftFileBusinessLogic.GetExistingOrNewAsync(testOrganisationId, testSnapshotYear,
                                                                       oliviaUserId);

            await testDraftFileBusinessLogic.UpdateAsync(returnViewModelThatOliviaWillSendFirst,
                                                         emptyDraftLockedToOlivia, oliviaUserId);

            // Act
            var availableDraft =
                await testDraftFileBusinessLogic.GetDraftIfAvailableAsync(testOrganisationId, testSnapshotYear);

            // Assert
            Assert.Null(
                availableDraft,
                "Both files exist, as it is an inconsistent state (bak shouldn't be there if the process completed correctly), we used the backed up file as the reference because it's the most 'correct'. Bak file was empty, therefore null was expected");

            // Cleanup
            await testDraftFileBusinessLogic.DiscardDraftAsync(emptyDraftLockedToOlivia);
        }
Exemplo n.º 5
0
        public async Task DraftFileBusinessLogic_Update_When_New_Data_Is_Received_Backup_Is_MaintainedAsync()
        {
            // Arrange
            var dominicUserId        = testUserId;
            var systemFileRepository = new SystemFileRepository(new StorageOptions());

            testDraftFileBusinessLogic = new DraftFileBusinessLogic(null, systemFileRepository);
            var returnViewModelThatDominicWillSendFirst = new ReturnViewModel {
                DiffMeanBonusPercent = 40.4m
            };
            var returnViewModelThatDominicWillSendSecond =
                new ReturnViewModel {
                DiffMeanBonusPercent = 50.5m, DiffMedianBonusPercent = 55.5m
            };

            // Act
            var emptyDraftLockedToDominic =
                await testDraftFileBusinessLogic.GetExistingOrNewAsync(testOrganisationId, testSnapshotYear,
                                                                       dominicUserId);

            Assert.True(await systemFileRepository.GetFileExistsAsync(emptyDraftLockedToDominic.DraftPath));
            Assert.True(await systemFileRepository.GetFileExistsAsync(emptyDraftLockedToDominic.BackupDraftPath));

            var draftWithFirstLoadOfData = await testDraftFileBusinessLogic.UpdateAsync(
                returnViewModelThatDominicWillSendFirst,
                emptyDraftLockedToDominic,
                dominicUserId); // send data

            var intermediateDraftInfo =
                await testDraftFileBusinessLogic.GetExistingOrNewAsync(testOrganisationId, testSnapshotYear,
                                                                       dominicUserId);

            Assert.AreEqual(40.4m, intermediateDraftInfo.ReturnViewModelContent.DiffMeanBonusPercent);
            Assert.True(await systemFileRepository.GetFileExistsAsync(draftWithFirstLoadOfData.DraftPath));
            Assert.True(await systemFileRepository.GetFileExistsAsync(draftWithFirstLoadOfData.BackupDraftPath));

            var draftWithSecondLoadOfData = await testDraftFileBusinessLogic.UpdateAsync(
                returnViewModelThatDominicWillSendSecond,
                draftWithFirstLoadOfData,
                dominicUserId); // send data

            Assert.True(await systemFileRepository.GetFileExistsAsync(draftWithSecondLoadOfData.BackupDraftPath));

            // Cleanup
            await testDraftFileBusinessLogic.DiscardDraftAsync(draftWithSecondLoadOfData);
        }
Exemplo n.º 6
0
        public async Task DraftFileBusinessLogic_GetExistingOrNew_User_Can_Create_And_Update_DraftAsync()
        {
            // Arrange
            var lizzyUserId = testUserId;
            var fileRepo    = new SystemFileRepository(new StorageOptions());

            testDraftFileBusinessLogic =
                new DraftFileBusinessLogic(null, new SystemFileRepository(new StorageOptions()));
            var expectedDraft = new Draft(testOrganisationId, testSnapshotYear, true, VirtualDateTime.Now, lizzyUserId,
                                          fileRepo.RootDir);
            var returnViewModelChangedByLizzy = new ReturnViewModel {
                DiffMeanBonusPercent = 78.2m
            };

            // Act
            var draftLockedToLizzy =
                await testDraftFileBusinessLogic.GetExistingOrNewAsync(testOrganisationId, testSnapshotYear,
                                                                       lizzyUserId);

            var updatedDraft = await testDraftFileBusinessLogic.UpdateAsync(
                returnViewModelChangedByLizzy,
                draftLockedToLizzy,
                lizzyUserId);

            // Assert
            Assert.Multiple(
                () =>
            {
                Assert.NotNull(updatedDraft.ReturnViewModelContent);
                Assert.AreEqual(expectedDraft.DraftPath, updatedDraft.DraftPath);
                Assert.AreEqual(expectedDraft.DraftFilename, updatedDraft.DraftFilename);
                Assert.AreEqual(expectedDraft.IsUserAllowedAccess, updatedDraft.IsUserAllowedAccess);
                Assert.AreEqual(expectedDraft.LastWrittenByUserId, updatedDraft.LastWrittenByUserId);
                Assert.AreEqual(expectedDraft.BackupDraftFilename, updatedDraft.BackupDraftFilename);
                Assert.AreEqual(expectedDraft.BackupDraftPath, updatedDraft.BackupDraftPath);
                Assert.False(
                    updatedDraft.HasDraftBeenModifiedDuringThisSession,
                    "IsDraftDirty flag is set exclusively by the front end, so it always be 'false' unless the front end decides to change it.");
            });

            // Cleanup
            await testDraftFileBusinessLogic.DiscardDraftAsync(updatedDraft);
        }
Exemplo n.º 7
0
        public async Task DraftFileBusinessLogic_Update_When_Json_Exists_But_Does_Not_Have_Data_Backup_Is_CreatedAsync()
        {
            // Arrange
            var fredUserId           = testUserId;
            var systemFileRepository = new SystemFileRepository(new StorageOptions());

            testDraftFileBusinessLogic = new DraftFileBusinessLogic(null, systemFileRepository);

            // Act
            var emptyDraftLockedToFred =
                await testDraftFileBusinessLogic.GetExistingOrNewAsync(testOrganisationId, testSnapshotYear,
                                                                       fredUserId);

            var updatedDraft =
                await testDraftFileBusinessLogic.UpdateAsync(new ReturnViewModel(), emptyDraftLockedToFred, fredUserId);

            // Assert
            Assert.True(await systemFileRepository.GetFileExistsAsync(updatedDraft.BackupDraftPath));

            // Cleanup
            await testDraftFileBusinessLogic.DiscardDraftAsync(updatedDraft);
        }
Exemplo n.º 8
0
        public async Task DraftFileBusinessLogic_RollbackDraft_Maintains_Initial_Information_Added_In_One_SessionAsync()
        {
            // Arrange
            var kathyUserId          = testUserId;
            var systemFileRepository = new SystemFileRepository(new StorageOptions());

            testDraftFileBusinessLogic = new DraftFileBusinessLogic(null, systemFileRepository);
            var returnViewModelThatKathyWillSendFirst = new ReturnViewModel {
                DiffMeanBonusPercent = 20.2m
            };
            var returnViewModelThatKathyWillSendSecond = new ReturnViewModel
            {
                DiffMeanBonusPercent = 30.3m, DiffMedianBonusPercent = 33.3m
            };
            var returnViewModelThatKathyWillSendThird = new ReturnViewModel
            {
                DiffMeanBonusPercent = 40.4m, DiffMedianBonusPercent = 44.4m,
                OrganisationSize     = OrganisationSizes.Employees250To499
            };

            // Act
            var emptyDraftLockedToKathy =
                await testDraftFileBusinessLogic.GetExistingOrNewAsync(testOrganisationId, testSnapshotYear,
                                                                       kathyUserId);

            Assert.True(await systemFileRepository.GetFileExistsAsync(emptyDraftLockedToKathy.DraftPath));
            Assert.True(await systemFileRepository.GetFileExistsAsync(emptyDraftLockedToKathy.BackupDraftPath));

            var draftWithFirstLoadOfData = await testDraftFileBusinessLogic.UpdateAsync(
                returnViewModelThatKathyWillSendFirst,
                emptyDraftLockedToKathy,
                kathyUserId); // send data

            var intermediateDraftInfo =
                await testDraftFileBusinessLogic.GetExistingOrNewAsync(testOrganisationId, testSnapshotYear,
                                                                       kathyUserId);

            Assert.AreEqual(20.2m, intermediateDraftInfo.ReturnViewModelContent.DiffMeanBonusPercent);
            Assert.True(await systemFileRepository.GetFileExistsAsync(draftWithFirstLoadOfData.DraftPath));
            Assert.True(await systemFileRepository.GetFileExistsAsync(draftWithFirstLoadOfData.BackupDraftPath));

            var draftWithSecondLoadOfData = await testDraftFileBusinessLogic.UpdateAsync(
                returnViewModelThatKathyWillSendSecond,
                draftWithFirstLoadOfData,
                kathyUserId); // send data

            intermediateDraftInfo =
                await testDraftFileBusinessLogic.GetExistingOrNewAsync(testOrganisationId, testSnapshotYear,
                                                                       kathyUserId);

            Assert.AreEqual(30.3m, intermediateDraftInfo.ReturnViewModelContent.DiffMeanBonusPercent);
            Assert.AreEqual(33.3m, intermediateDraftInfo.ReturnViewModelContent.DiffMedianBonusPercent);
            Assert.True(await systemFileRepository.GetFileExistsAsync(draftWithSecondLoadOfData.DraftPath));
            Assert.True(await systemFileRepository.GetFileExistsAsync(draftWithSecondLoadOfData.BackupDraftPath));

            var draftWithThirdLoadOfData = await testDraftFileBusinessLogic.UpdateAsync(
                returnViewModelThatKathyWillSendThird,
                draftWithSecondLoadOfData,
                kathyUserId); // send data

            intermediateDraftInfo =
                await testDraftFileBusinessLogic.GetExistingOrNewAsync(testOrganisationId, testSnapshotYear,
                                                                       kathyUserId);

            Assert.AreEqual(40.4m, intermediateDraftInfo.ReturnViewModelContent.DiffMeanBonusPercent);
            Assert.AreEqual(44.4m, intermediateDraftInfo.ReturnViewModelContent.DiffMedianBonusPercent);
            Assert.AreEqual(OrganisationSizes.Employees250To499,
                            intermediateDraftInfo.ReturnViewModelContent.OrganisationSize);
            Assert.True(await systemFileRepository.GetFileExistsAsync(draftWithThirdLoadOfData.DraftPath));
            Assert.True(await systemFileRepository.GetFileExistsAsync(draftWithThirdLoadOfData.BackupDraftPath));

            await testDraftFileBusinessLogic.RollbackDraftAsync(draftWithThirdLoadOfData);

            intermediateDraftInfo =
                await testDraftFileBusinessLogic.GetExistingOrNewAsync(testOrganisationId, testSnapshotYear,
                                                                       kathyUserId);

            Assert.Null(intermediateDraftInfo.ReturnViewModelContent);
            Assert.True(await systemFileRepository.GetFileExistsAsync(draftWithFirstLoadOfData.BackupDraftPath));

            // Cleanup
            await testDraftFileBusinessLogic.DiscardDraftAsync(draftWithSecondLoadOfData);
        }
Exemplo n.º 9
0
        DraftFileBusinessLogic_CommitDraft_And_Then_RollbackDraft_Leaves_The_File_In_A_Consistent_StateAsync()
        {
            // Arrange
            var nicolasUserId        = testUserId;
            var systemFileRepository = new SystemFileRepository(new StorageOptions());

            testDraftFileBusinessLogic = new DraftFileBusinessLogic(null, systemFileRepository);
            var returnViewModelThatNicolasWillSendFirst = new ReturnViewModel {
                DiffMeanBonusPercent = 10.1m
            };
            var returnViewModelThatNicolasWillSendSecond =
                new ReturnViewModel {
                DiffMeanBonusPercent = 20.2m, DiffMedianBonusPercent = 22.2m
            };
            var returnViewModelThatNicolasWillSendThird = new ReturnViewModel
            {
                DiffMeanBonusPercent = 30.3m, DiffMedianBonusPercent = 33.3m,
                OrganisationSize     = OrganisationSizes.Employees250To499
            };
            var returnViewModelThatNicolasWillSendFourth = new ReturnViewModel
            {
                DiffMeanBonusPercent = 40.4m, DiffMedianBonusPercent = 44.4m,
                OrganisationSize     = OrganisationSizes.Employees1000To4999
            };

            // Act
            var emptyDraftLockedToNicolas =
                await testDraftFileBusinessLogic.GetExistingOrNewAsync(testOrganisationId, testSnapshotYear,
                                                                       nicolasUserId);

            Assert.False(emptyDraftLockedToNicolas.HasDraftBeenModifiedDuringThisSession);

            var draftWithFirstLoadOfData = await testDraftFileBusinessLogic.UpdateAsync(
                returnViewModelThatNicolasWillSendFirst,
                emptyDraftLockedToNicolas,
                nicolasUserId); // send data

            Assert.False(draftWithFirstLoadOfData.HasDraftBeenModifiedDuringThisSession,
                         "this flag is set up by the front end");

            #region Confirm file status

            var intermediateDraftInfo =
                await testDraftFileBusinessLogic.GetExistingOrNewAsync(testOrganisationId, testSnapshotYear,
                                                                       nicolasUserId);

            Assert.AreEqual(10.1m, intermediateDraftInfo.ReturnViewModelContent.DiffMeanBonusPercent);
            Assert.True(await systemFileRepository.GetFileExistsAsync(draftWithFirstLoadOfData.DraftPath));
            Assert.True(await systemFileRepository.GetFileExistsAsync(draftWithFirstLoadOfData.BackupDraftPath));

            #endregion

            var draftWithSecondLoadOfData = await testDraftFileBusinessLogic.UpdateAsync(
                returnViewModelThatNicolasWillSendSecond,
                draftWithFirstLoadOfData,
                nicolasUserId); // send data

            Assert.False(
                draftWithSecondLoadOfData.HasDraftBeenModifiedDuringThisSession,
                "IsDraftDirty flag is set exclusively by the front end, so it always be 'false' unless the front end decides to change it.");

            #region Confirm file status

            intermediateDraftInfo =
                await testDraftFileBusinessLogic.GetExistingOrNewAsync(testOrganisationId, testSnapshotYear,
                                                                       nicolasUserId);

            Assert.AreEqual(20.2m, intermediateDraftInfo.ReturnViewModelContent.DiffMeanBonusPercent);
            Assert.AreEqual(22.2m, intermediateDraftInfo.ReturnViewModelContent.DiffMedianBonusPercent);
            Assert.True(await systemFileRepository.GetFileExistsAsync(draftWithFirstLoadOfData.DraftPath));
            Assert.True(await systemFileRepository.GetFileExistsAsync(draftWithFirstLoadOfData.BackupDraftPath));

            #endregion

            await testDraftFileBusinessLogic.CommitDraftAsync(draftWithSecondLoadOfData);

            Assert.False(await systemFileRepository.GetFileExistsAsync(draftWithSecondLoadOfData.BackupDraftPath));

            var draftWithThirdLoadOfData = await testDraftFileBusinessLogic.UpdateAsync(
                returnViewModelThatNicolasWillSendThird,
                draftWithSecondLoadOfData,
                nicolasUserId); // send data

            Assert.False(
                draftWithThirdLoadOfData.HasDraftBeenModifiedDuringThisSession,
                "IsDraftDirty flag is set exclusively by the front end, so it always be 'false' unless the front end decides to change it.");

            #region Confirm file status

            intermediateDraftInfo =
                await testDraftFileBusinessLogic.GetExistingOrNewAsync(testOrganisationId, testSnapshotYear,
                                                                       nicolasUserId);

            Assert.AreEqual(30.3m, intermediateDraftInfo.ReturnViewModelContent.DiffMeanBonusPercent);
            Assert.AreEqual(33.3m, intermediateDraftInfo.ReturnViewModelContent.DiffMedianBonusPercent);
            Assert.AreEqual(OrganisationSizes.Employees250To499,
                            intermediateDraftInfo.ReturnViewModelContent.OrganisationSize);

            #endregion

            var draftWithFourthLoadOfData = await testDraftFileBusinessLogic.UpdateAsync(
                returnViewModelThatNicolasWillSendFourth,
                draftWithThirdLoadOfData,
                nicolasUserId); // send data

            Assert.False(
                draftWithFourthLoadOfData.HasDraftBeenModifiedDuringThisSession,
                "IsDraftDirty flag is set exclusively by the front end, so it always be 'false' unless the front end decides to change it.");

            #region Confirm file status

            intermediateDraftInfo =
                await testDraftFileBusinessLogic.GetExistingOrNewAsync(testOrganisationId, testSnapshotYear,
                                                                       nicolasUserId);

            Assert.AreEqual(40.4m, intermediateDraftInfo.ReturnViewModelContent.DiffMeanBonusPercent);
            Assert.AreEqual(44.4m, intermediateDraftInfo.ReturnViewModelContent.DiffMedianBonusPercent);
            Assert.AreEqual(OrganisationSizes.Employees1000To4999,
                            intermediateDraftInfo.ReturnViewModelContent.OrganisationSize);

            #endregion

            await testDraftFileBusinessLogic.RollbackDraftAsync(draftWithFourthLoadOfData);

            #region Confirm file status

            intermediateDraftInfo =
                await testDraftFileBusinessLogic.GetExistingOrNewAsync(testOrganisationId, testSnapshotYear,
                                                                       nicolasUserId);

            Assert.AreEqual(20.2m, intermediateDraftInfo.ReturnViewModelContent.DiffMeanBonusPercent);
            Assert.AreEqual(22.2m, intermediateDraftInfo.ReturnViewModelContent.DiffMedianBonusPercent);
            Assert.True(await systemFileRepository.GetFileExistsAsync(draftWithFirstLoadOfData.BackupDraftPath));
            Assert.False(
                intermediateDraftInfo.HasDraftBeenModifiedDuringThisSession,
                "IsDraftDirty flag is set exclusively by the front end, so it always be 'false' unless the front end decides to change it.");

            #endregion

            // Cleanup
            await testDraftFileBusinessLogic.DiscardDraftAsync(draftWithSecondLoadOfData);
        }