コード例 #1
0
ファイル: UserInputTest.cs プロジェクト: bjackson1/techtest1
 public void TestMatchType_WillThrowArgumentException_WhenCalledWithInvalidMatchTypeParameter()
 {
     try
     {
         UserInput userInput = new UserInput(new string[] { POSITIVE_TEST_NEWS_FILE_PATH, "aaa", "Care" });
         Assert.Fail("Expected {0} to be thrown.", typeof(ArgumentException));
     }
     catch (Exception ex)
     {
         Assert.AreEqual(ex.GetType(), typeof(ArgumentException));
     }
 }
コード例 #2
0
ファイル: UserInputTest.cs プロジェクト: bjackson1/techtest1
 public void TestFilePath_WillThrowFileNotFoundException_WhenCalledWithNonExistantFilePath()
 {
     try
     {
         UserInput userInput = new UserInput(new string[] { "filethatdoesnotexist.txt", "AND", "Care" });
         Assert.Fail("Expected {0} to be thrown.", typeof(FileNotFoundException));
     }
     catch (Exception ex)
     {
         Assert.AreEqual(typeof(FileNotFoundException), ex.GetType());
     }
 }
コード例 #3
0
ファイル: UserInputTest.cs プロジェクト: bjackson1/techtest1
 public void TestFilePath_WillSetFilePathProperty_WhenCalled()
 {
     try
     {
         UserInput userInput = new UserInput(new string[] { POSITIVE_TEST_NEWS_FILE_PATH, "AND", "Care" });
         Assert.AreEqual(POSITIVE_TEST_NEWS_FILE_PATH, userInput.FilePath);
     }
     catch (Exception ex)
     {
         Assert.Fail(ex.Message);
     }
 }
コード例 #4
0
 public ConsoleContext(ApplicationContext appContext, UserInput userInput = null)
 {
     UserInput  = userInput;
     AppContext = appContext;
 }
コード例 #5
0
ファイル: UserInputTest.cs プロジェクト: bjackson1/techtest1
 public void TestSearchTerm_WillSetThreeSearchTerms_WhenCalledWithFiveValidArguments()
 {
     UserInput userInput = new UserInput(new string[] { POSITIVE_TEST_NEWS_FILE_PATH, "and", "Care", "Quality", "Commission" });
     Assert.AreEqual("Care,Quality,Commission", string.Join(",", userInput.Terms));
 }
コード例 #6
0
ファイル: UserInputTest.cs プロジェクト: bjackson1/techtest1
 public void TestSearchTerm_WillSetSingleSearchTerm_WhenCalledWithSingleSearchTerm()
 {
     UserInput userInput = new UserInput(new string[] { POSITIVE_TEST_NEWS_FILE_PATH, "and", "Care" });
     Assert.AreEqual("Care", string.Join(",", userInput.Terms));
 }
コード例 #7
0
ファイル: UserInputTest.cs プロジェクト: bjackson1/techtest1
 public void TestMatchType_WillSetMatchTypeToOr_WhenCalledWithOrParameter()
 {
     UserInput userInput = new UserInput(new string[] { POSITIVE_TEST_NEWS_FILE_PATH, "or", "Care" });
     Assert.AreEqual(MatchType.Or, userInput.MatchType);
 }
コード例 #8
0
ファイル: UserInputTest.cs プロジェクト: bjackson1/techtest1
 public void TestMatchType_WillSetMatchTypeToAnd_WhenCalledWithAndParameterInUppercase()
 {
     UserInput userInput = new UserInput(new string[] { POSITIVE_TEST_NEWS_FILE_PATH, "AND", "Care" });
     Assert.AreEqual(MatchType.And, userInput.MatchType);
 }
コード例 #9
0
ファイル: UserInputTest.cs プロジェクト: bjackson1/techtest1
 public void TestSearchTerm_WillTrowArgumentException_WhenCalledWithTwoArguments()
 {
     try
     {
         UserInput userInput = new UserInput(new string[] { POSITIVE_TEST_NEWS_FILE_PATH, "and" });
         Assert.Fail();
     }
     catch (Exception ex)
     {
         Assert.AreEqual(ex.GetType(), typeof(ArgumentException));
     }
 }