public void Should_substitute_integers_between_1_and_3999_with_roman_numerals(string inputText, string expectedOutputText, int expectedNumberOfSubstitutions) { var result = substitutionService.Substitute(inputText); Assert.That(result.NumberOfSubstitutions.Equals(expectedNumberOfSubstitutions)); Assert.That(result.ResultedText.Equals(expectedOutputText)); }
/// <summary> /// Main business logic process. /// </summary> /// <param name="path"> Path to file </param> /// <returns> Proces result </returns> public Result Process(string path) { var result = new Result { OperationSuccessful = false, Sentences = new List <string>() }; if (!_validationManager.ValidateAll(path)) { return(result); } var records = _tsvParser .Parse(path) .Where(x => !string.IsNullOrWhiteSpace(x.AnalystFirm)) // Workaround, see TsvParser comments .ToList(); var allSentences = _repository.GetSentences(); var limit = _randomGenerator.GetNext(_appSettings.MinSentences, _appSettings.MaxSentences); // Generate stories for (var i = 0; i < limit; i++) { // Works without check for uniqueness of stories and data patches var nextSentence = allSentences.ElementAtOrDefault(_randomGenerator.GetNext(allSentences.Count)); var nextData = records.ElementAtOrDefault(_randomGenerator.GetNext(records.Count)); if (!string.IsNullOrWhiteSpace(nextSentence) && nextData != null) { result.Sentences.Add(_substitutionService.Substitute(nextSentence, records.First())); } } result.OperationSuccessful = true; return(result); }