public void ValidateBadListenRegexTest() { CowSayBotConfig uut = new CowSayBotConfig(); uut.ListenRegex = null; uut.ExeCommand = FakeExe; uut.CowFileInfoList.CommandList["command"] = "name"; Assert.Throws <InvalidOperationException>(() => uut.Validate()); uut.ListenRegex = string.Empty; Assert.Throws <InvalidOperationException>(() => uut.Validate()); uut.ListenRegex = " "; Assert.Throws <InvalidOperationException>(() => uut.Validate()); }
public void ValidateBadCowFileInfoListTest() { CowSayBotConfig uut = new CowSayBotConfig(); uut.ListenRegex = @"^!{%saycmd%} (?<msg>.+)"; uut.ExeCommand = FakeExe; uut.CowFileInfoList.CommandList.Clear(); Assert.Throws <InvalidOperationException>(() => uut.Validate()); }
public void ValidateBadExeCommandTest() { CowSayBotConfig uut = new CowSayBotConfig(); uut.ListenRegex = @"^!{%saycmd%} (?<msg>.+)"; uut.ExeCommand = null; uut.CowFileInfoList.CommandList["command"] = "name"; Assert.Throws <InvalidOperationException>(() => uut.Validate()); uut.ExeCommand = string.Empty; Assert.Throws <InvalidOperationException>(() => uut.Validate()); uut.ExeCommand = " "; Assert.Throws <InvalidOperationException>(() => uut.Validate()); uut.ExeCommand = "doesNotExist"; Assert.Throws <InvalidOperationException>(() => uut.Validate()); }
public void ValidateSuccessTest() { CowSayBotConfig uut = new CowSayBotConfig(); uut.ListenRegex = @"^!{%saycmd%} (?<msg>.+)"; uut.ExeCommand = FakeExe; uut.CowFileInfoList.CommandList["command"] = "name"; Assert.DoesNotThrow(() => uut.Validate()); }