コード例 #1
0
        public void LocalizedValidation_ThrowsInvalidOperationException_When_NoLocalizationExists()
        {
            var foo = new IncorrectlyLocalized();

            using (SwitchUICulture(CultureInfo.CreateSpecificCulture("en-US")))
            {
                try
                {
                    runner.IsValid(foo);

                    Assert.Fail("Should have gotten exception");
                }
                catch (InvalidOperationException ex)
                {
                    Assert.AreEqual(
                        "The resource type 'Castle.Components.Validator.Tests.Messages' does not have a publicly visible static property named 'key_that_does_not_exists'. You probably marked the resources as internal, to fix this change the 'Access modifier' dropdown to 'Public' in the VS resources editor.",
                        ex.Message);
                }
            }
        }
コード例 #2
0
		public void LocalizedValidation_ThrowsInvalidOperationException_When_NoLocalizationExists()
		{

			var foo = new IncorrectlyLocalized();

			using (SwitchUICulture(CultureInfo.CreateSpecificCulture("en-US")))
			{
				try
				{
					runner.IsValid(foo);

					Assert.Fail("Should have gotten exception");
				}
				catch (InvalidOperationException ex)
				{
					Assert.AreEqual(
							"The resource type 'Castle.Components.Validator.Tests.Messages' does not have a publicly visible static property named 'key_that_does_not_exists'. You probably marked the resources as internal, to fix this change the 'Access modifier' dropdown to 'Public' in the VS resources editor.",
							ex.Message);
				}
			}
		}