예제 #1
0
 public void ExpectException <TException> (Action a, string reason) where TException : Exception
 {
     try
     {
         a();
         if (reason != "")
         {
             reason = "\n" + reason;
         }
         _buffer.WriteMessageLine("\n" + reason + "\nExpected " + typeof(TException) + " but was none");
         _matches = false;
     }
     catch (Exception e) {
         //if (!e.GetType().Equals(typeof(TException))) {
         if (!(e is TException))
         {
             if (reason != "")
             {
                 reason = "\n" + reason;
             }
             _buffer.WriteMessageLine("\n" + reason + "\nExpected " + typeof(TException) + " but was " + e.GetType());
             _matches = false;
         }
     }
 }
예제 #2
0
        private void displayCultureInformation(TextMessageWriter writer, CultureCurrencyInfo fromGlobalization, CurrencyInfo fromConfiguration)
        {
            CanonicalCultureAttribute attr;
            CultureInfo configurationCulture = null;

            if (Enumeration.TryGetAttribute(fromConfiguration.Code, out attr))
            {
                configurationCulture = attr.Culture();
            }
            writer.Write("Globalizaton Currency {0} for culture {1} [{2}] ", fromGlobalization.Info.Code, fromGlobalization.Culture.Name, fromGlobalization.Culture.EnglishName);
            writer.WriteLine("differs from Configuration Currency {0}", fromConfiguration.Code);
            writer.WriteMessageLine(1, "Canonical Culture {0}, {1}",
                                    configurationCulture != null ? configurationCulture.Name : "NONE",
                                    configurationCulture != null ? attr.Overwritten.ToString() : "NA");
        }