public void MenuParser_ParseFromFile_ThrowsOnNullOrEmpty() { Action parseAction = () => MenuParser.ParseFromFile(null); parseAction.ShouldThrow <ArgumentException>("because we don't accept null for the path"); parseAction = () => MenuParser.ParseFromFile(string.Empty); parseAction.ShouldThrow <ArgumentException>("because we don't accept an empty string for the path"); }
public void Menu_FromTestFile_ProperlySetsValue(string pathToFile, string path, bool expectedResult, string reason) { var menu = MenuParser.ParseFromFile(pathToFile); menu.Should().NotBeNull(); menu.SetActive(path); // The call would have been successful if at least one of the top level elements is set to true bool result = false; foreach (var mi in menu.Items) { result |= mi.IsActive; } result.ShouldBeEquivalentTo(expectedResult, reason); }
public void MenuParser_ParseFromFile_ThrowsOnFileNotFound() { Action parseAction = () => MenuParser.ParseFromFile(@"C:\thisdirectorydoesntexist\filenotfound.abc"); parseAction.ShouldThrow <FileNotFoundException>(); }