Exemplo n.º 1
0
        public void Test_GetBusinessObjectRules_WhenNoRules_ShouldReturnEmptyCol()
        {
            //---------------Set up test pack-------------------
            MyRulesBo myRulesBo = new MyRulesBo();
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            ReadOnlyCollection <IBusinessObjectRule> rules = BOHelper.GetBusinessObjectRules(myRulesBo);

            //---------------Test Result -----------------------
            Assert.IsNotNull(rules);
            Assert.AreEqual(0, rules.Count);
        }
Exemplo n.º 2
0
 public void Test_GetBusinessObjectRules_WhenNull_ShouldRaiseError()
 {
     //---------------Set up test pack-------------------
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     try
     {
         BOHelper.GetBusinessObjectRules(null);
         Assert.Fail("expected ArgumentNullException");
     }
     //---------------Test Result -----------------------
     catch (ArgumentNullException ex)
     {
         StringAssert.Contains("Value cannot be null", ex.Message);
         StringAssert.Contains("businessObject", ex.ParamName);
     }
 }
Exemplo n.º 3
0
        public void Test_GetBusinessObjectRules_WhenHasRules_ShouldReturnCorrectCol()
        {
            //---------------Set up test pack-------------------
            IBusinessObjectRule rule1     = MockRepository.GenerateStub <IBusinessObjectRule>();
            IBusinessObjectRule rule2     = MockRepository.GenerateStub <IBusinessObjectRule>();
            IBusinessObjectRule rule3     = MockRepository.GenerateStub <IBusinessObjectRule>();
            IBusinessObjectRule rule4     = MockRepository.GenerateStub <IBusinessObjectRule>();
            MyRulesBo           myRulesBo = new MyRulesBo(rule1, rule2, rule3, rule4);
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            ReadOnlyCollection <IBusinessObjectRule> rules = BOHelper.GetBusinessObjectRules(myRulesBo);

            //---------------Test Result -----------------------
            Assert.IsNotNull(rules);
            Assert.AreEqual(myRulesBo.Rules.Length, rules.Count);
            Assert.Contains(rule1, rules);
            Assert.Contains(rule2, rules);
            Assert.Contains(rule3, rules);
            Assert.Contains(rule4, rules);
        }