public async Task RemovePostingWarningFromPostingJournalResult_WhenPostingJournalResultKeyHasValueAndPostingJournalResultFromKeyValueEntryDoesNotContainPostingWarningForPostingWarningIdentifier_ReturnsPartialViewResultWhereModelIsPostingWarningCollectionViewModelWithPostingWarningsFromReturnedPostingJournalResult() { Guid[] postingWarningIdentifierCollection = BuildPostingWarningIdentifierCollection(); PostingWarningCollectionViewModel postingWarningCollectionViewModel = BuildPostingWarningCollectionViewModel(postingWarningIdentifierCollection); ApplyPostingJournalResultViewModel applyPostingJournalResultViewModel = BuildApplyPostingJournalResultViewModel(postingWarningCollectionViewModel); IKeyValueEntry keyValueEntryForPostingJournalResult = BuildKeyValueEntryForPostingJournalResult(applyPostingJournalResultViewModel); Controller sut = CreateSut(keyValueEntryForPostingJournalResult: keyValueEntryForPostingJournalResult); PartialViewResult result = (PartialViewResult)await sut.RemovePostingWarningFromPostingJournalResult(_fixture.Create <int>(), _fixture.Create <string>(), Guid.NewGuid()); PostingWarningCollectionViewModel resultViewModel = (PostingWarningCollectionViewModel)result.Model; Assert.That(resultViewModel.All(postingWarningViewModel => postingWarningIdentifierCollection.Any(postingWarningIdentifier => postingWarningViewModel.Identifier == postingWarningIdentifier)), Is.True); }
public async Task RemovePostingWarningFromPostingJournalResult_WhenPostingJournalResultKeyHasValueAndPostingJournalResultFromKeyValueEntryContainsMultiplePostingWarningsWhereOneMatchesPostingWarningIdentifier_ReturnsPartialViewResultWhereModelIsPostingWarningCollectionViewModelWithPostingWarningsFromReturnedPostingJournalResultExceptPostingWarningForPostingWarningIdentifier() { Guid[] postingWarningIdentifierCollection = BuildPostingWarningIdentifierCollection(); PostingWarningCollectionViewModel postingWarningCollectionViewModel = BuildPostingWarningCollectionViewModel(postingWarningIdentifierCollection); ApplyPostingJournalResultViewModel applyPostingJournalResultViewModel = BuildApplyPostingJournalResultViewModel(postingWarningCollectionViewModel); IKeyValueEntry keyValueEntryForPostingJournalResult = BuildKeyValueEntryForPostingJournalResult(applyPostingJournalResultViewModel); Controller sut = CreateSut(keyValueEntryForPostingJournalResult: keyValueEntryForPostingJournalResult); Guid postingWarningIdentifier = postingWarningIdentifierCollection[_random.Next(0, postingWarningIdentifierCollection.Length - 1)]; PartialViewResult result = (PartialViewResult)await sut.RemovePostingWarningFromPostingJournalResult(_fixture.Create <int>(), _fixture.Create <string>(), postingWarningIdentifier); PostingWarningCollectionViewModel resultViewModel = (PostingWarningCollectionViewModel)result.Model; Assert.That(resultViewModel.All(postingWarningViewModel => postingWarningIdentifierCollection.Where(identifier => identifier != postingWarningIdentifier).Any(identifier => postingWarningViewModel.Identifier == identifier)), Is.True); }