private void RunTest(ErrorMessageParser parser, int code, string input, params string[] expected) { var actual = parser.Parse(code, input); Assert.AreEqual(expected.Length, actual.Count); for (int i = 0; i < expected.Length; i++) { Assert.AreEqual(expected[i], actual[i + 1]); } }
public void TestIfErrorsAreParsedCorrectly() { var errorMessagesMap = ErrorMessageParser.Parse("UnitTests"); Assert.That(errorMessagesMap, Is.Not.Null); Assert.That(errorMessagesMap.Count, Is.EqualTo(3)); Assert.That(errorMessagesMap["UnitTests.TestErrorDiscription.Method1"], Is.EqualTo("Click Make Payment")); Assert.That(errorMessagesMap["UnitTests.TestErrorDiscription.Method2"], Is.EqualTo("Fill CreditCardInfo")); Assert.That(errorMessagesMap["UnitTests.TestErrorDiscription.Method3"], Is.EqualTo("On Payment Page")); }
public Log4Error() { var dllList = Log4ErrorConfigSectionReader.GetDllList(); foreach (var dll in dllList) { var tempDictionary = ErrorMessageParser.Parse(dll); ErrorMap = ErrorMap.Concat(tempDictionary).ToDictionary(x => x.Key, x => x.Value); } }
public async Task <ActionResult> GenerateDocumentationMatrixConfirmed(int customerID) { try { await customerRepository.GenerateDocumentationMatrix(customerID, true); return(RedirectToAction("Index")); } catch (Exception ex) { ModelState.AddModelError("", ErrorMessageParser.Parse(ex.Message)); return(View()); } }
public async Task <ActionResult> DeleteConfirmed(int id) { try { await customerRepository.DeleteAsync(id); return(RedirectToAction("Index")); } catch (Exception ex) { ModelState.AddModelError("", ErrorMessageParser.Parse(ex.Message)); //ModelState.AddModelError("", ex.Message); return(View()); } }