public void Constructor_MessageAndInnerException_MessageAndInnerExcetion() { var target = new SelectionException("1", new Exception("2")); Assert.AreEqual("1", target.Message); Assert.AreEqual("2", target.InnerException.Message); }
public void Constructor_SelectionAndMessageAndInnerException_SelectionAndMessageAndInnerExcetion() { var target = new SelectionException(Substitute.For <ISelection>(), "1", new Exception("2")); Assert.IsNotNull(target.Selection); Assert.AreEqual(target.Selection.GetType().Name + ": 1", target.Message); Assert.AreEqual("2", target.InnerException.Message); }
public void GetObjectData_InfoAndContext_Property() { var propertyValue = Substitute.For <ISelection>(); var target = new SelectionException(propertyValue, "1"); var serializationInfo = new SerializationInfo(typeof(int), Substitute.For <IFormatterConverter>()); target.GetObjectData(serializationInfo, new StreamingContext()); Assert.AreEqual(propertyValue, serializationInfo.GetValue("Selection", typeof(ISelection))); }
private void ProcessManagementSelection() { try { bool validDecision = false; int mdecision = 0; while (!validDecision) { Console.Clear(); DisplayManagementSelection(); Console.Write("Enter an option(1-7): "); try { mdecision = System.Int32.Parse(Console.ReadLine()); } catch (Exception) { mdecision = 0; } if (mdecision >= 1 && mdecision <= 7) { validDecision = true; } Console.WriteLine(); switch (mdecision) { case 1: ManageCourse(); break; case 2: ManageLecturer(); break; case 3: ManageStudent(); break; case 4: ManageRoom(); break; case 5: ManageClass(); break; case 6: ManageReport(); break; case 7: terminateProgram(); break; } } } catch (SelectionException se) { se = new SelectionException("Invalid Exception. Follow the instruction."); Console.WriteLine(se.Message); ProcessManagementSelection(); } }
public void Constructor_Message_Message() { var target = new SelectionException("1"); Assert.AreEqual("1", target.Message); }
public void Constructor_NoArgs_DefaultValue() { var target = new SelectionException(); Assert.IsTrue(target.Message.Contains("SelectionException")); }