public void Test2()
 {
     try
     {
         var arg = 0;
         Enforce.Argument(() => arg, ScopeTestHelper.RunNesting);
     }
     catch (ArgumentException ex)
     {
         ScopeTestHelper.ShouldBeClean(ex);
         ScopeTestHelper.ShouldHave(ex, "Error1", "Group1", "Group2");
         throw;
     }
 }
예제 #2
0
 public void Test_Nesting()
 {
     try
     {
         using (var t = Scope.ForValidation("Test", Scope.WhenError))
         {
             ScopeTestHelper.RunNesting(0, t);
         }
     }
     catch (RuleException ex)
     {
         ScopeTestHelper.ShouldBeClean(ex);
         ScopeTestHelper.ShouldHave(ex, "None1", "Warn1", "Group1", "Group2", "None3");
         throw;
     }
 }
예제 #3
0
 public void All_Problems_Are_Collected_Properly()
 {
     try
     {
         using (var t = Scope.ForValidation("Test", Scope.WhenError))
         {
             ScopeTestHelper.FireErrors(t);
         }
     }
     catch (RuleException ex)
     {
         ScopeTestHelper.ShouldBeClean(ex);
         ScopeTestHelper.ShouldHave(ex, "ErrA", "ErrB", "ErrC");
         throw;
     }
 }
 public void Test()
 {
     try
     {
         using (var scope = Scope.ForEnforceArgument("Test", Scope.WhenError))
         {
             ScopeTestHelper.FireErrors(scope);
         }
     }
     catch (ArgumentException ex)
     {
         ScopeTestHelper.ShouldBeClean(ex);
         ScopeTestHelper.ShouldHave(ex, "ErrA");
         ScopeTestHelper.ShouldNotHave(ex, "ErrB", "ErrC");
         throw;
     }
 }
        public void Test()
        {
            var Test = 1;

            try
            {
                using (var t = ScopeFactory.ForEnforce(() => Test, Scope.WhenError))
                {
                    ScopeTestHelper.FireErrors(t);
                }
            }
            catch (RuleException ex)
            {
                ScopeTestHelper.ShouldBeClean(ex);
                ScopeTestHelper.ShouldHave(ex, "ErrA");
                ScopeTestHelper.ShouldNotHave(ex, "ErrB", "ErrC");
                throw;
            }
        }