public void Should_Throw_MaterialNotFoundException() { Speaker speaker = new Speaker(); speaker.AnswerQuestion("glob is I"); Assert.Throws <MaterialNotFoundException>(() => speaker.AnswerQuestion("glob glob is 1999 credits")); }
public static void Main(string[] args) { Speaker speaker = new Speaker(); do { Console.WriteLine("Ask a question:"); string line = Console.ReadLine(); try { string message = speaker.AnswerQuestion(line); if (message != "") { Console.WriteLine(message); } } catch (NumeralRepetitionException e) { Console.WriteLine(e.Message); } catch (MaterialNotFoundException e) { Console.WriteLine(e.Message); } catch (Exception) { Console.WriteLine("I think you're not talk my language... :("); } } while (true); }
public void Should_Macth_Convert() { Speaker speaker = new Speaker(); Assert.Equal("", speaker.AnswerQuestion("glob is I") ); Assert.Equal("", speaker.AnswerQuestion("prok is V") ); Assert.Equal("", speaker.AnswerQuestion("pish is X") ); Assert.Equal("", speaker.AnswerQuestion("tegj is L") ); Assert.Equal("", speaker.AnswerQuestion("glob glob Silver is 34 Credits") ); Assert.Equal("", speaker.AnswerQuestion("glob prok Gold is 57800 Credits") ); Assert.Equal("", speaker.AnswerQuestion("pish pish Iron is 3910 Credits") ); Assert.Equal("pish tegj glob glob is 42", speaker.AnswerQuestion("how much is pish tegj glob glob ?") ); Assert.Equal("glob prok silver is 68", speaker.AnswerQuestion("how many Credits is glob prok Silver ?") ); Assert.Equal("glob prok gold is 57800", speaker.AnswerQuestion("how many Credits is glob prok Gold ?") ); Assert.Equal("glob prok iron is 782", speaker.AnswerQuestion("how many Credits is glob prok Iron ?") ); Assert.Equal("I have no idea what you are talking about", speaker.AnswerQuestion("how much wood could a woodchuck chuck if a woodchuck could chuck wood ?") ); }