public void Lese_StopwordsDatei_Erwarte_Zeilen() { StopwordsProvider stopwordsProvider = new StopwordsProvider(); List <string> result = stopwordsProvider.Read_Stopwords(); Assert.That(result, Is.Not.Null); Assert.That(result.Count, Is.EqualTo(4)); }
//[TestCase("Marry had a little lamb.", 4)] //[TestCase("", 0)] public void Teste_Marry_Erwarte_Erfolg(string eingabe, int erwartetesErgebnis) { Words words = new Words(); StopwordsProvider stopwordsProvider = new StopwordsProvider(); int cntWords = new WordCount().Count_Words(eingabe); Assert.That(cntWords, Is.EqualTo(erwartetesErgebnis)); }
public void Lese_LeereDatei_Erwarte_Null() { string pathZuStopwords = $"{AppDomain.CurrentDomain.BaseDirectory}\\App_Data\\leer.txt"; StopwordsProvider stopwordsProvider = new StopwordsProvider(pathZuStopwords); List <string> result = stopwordsProvider.Read_Stopwords(); Assert.That(result, Is.Not.Null); Assert.That(result.Count, Is.EqualTo(0)); }
public void ReadStopwords_DateiExisitiertUndHat2Woerter_ErwarteInhaltMit2Woertern() { string filePath = @"C:\Temp\stopwords.txt"; string[] lines = { "a", "on" }; File.WriteAllLines(filePath, lines); IEnumerable <string> fileContent = StopwordsProvider.Read_stopwords(); Assert.That(fileContent.Count(), Is.EqualTo(2)); }
public void ReadStopwords_DateiExisitiertUndLeer_ErwarteLeerenInhalt() { string filePath = @"C:\Temp\stopwords.txt"; var file = File.Create(filePath); file.Close(); IEnumerable <string> fileContent = StopwordsProvider.Read_stopwords(); Assert.That(fileContent.Count(), Is.EqualTo(0)); }
public void GetStopWords_StateUnderTest_ExpectedBehavior() { // Arrange StopwordsProvider provider = CreateProvider(); var expectedResult = new List <string>() { "a", "the", "on", "off" }; // Act ICollection <string> result = provider.GetStopWords(); // Assert result.Should().BeEquivalentTo(expectedResult); }
public void ReadStopwords_DateiExisitiertNicht_ErwarteFileNotFoundException() { string filePath = @"C:\Temp\stopwords.txt"; if (File.Exists(filePath)) { File.Delete(filePath); } //Act ActualValueDelegate <object> testDelegate = () => StopwordsProvider.Read_stopwords(); //Assert Assert.That(testDelegate, Throws.TypeOf <FileNotFoundException>()); }
public WordCount(StopwordsProvider stopwordsProvider) { _words = new Words(); _stopwordsProvider = stopwordsProvider; }
public WordCount() { _words = new Words(); _stopwordsProvider = new StopwordsProvider(); }