Esempio n. 1
0
        public void OpportunityName_MoreThanSeventyfiveCharacters_Success()
        {
            opportunity.OpportunityName = new string('n', 76);
            var         opportunityNameCount            = opportunity.OpportunityName.Length;
            var         brokenRuleCount                 = opportunity.GetBrokenRules().Count();
            Opportunity opportunityWithMoreThanThousand = opportunity;

            Assert.AreEqual(76, opportunityNameCount);
            Assert.AreEqual(1, brokenRuleCount);
        }
Esempio n. 2
0
        public void OpprtunityOwner_OwnerRequired_GetBrokenRulesSuccess()
        {
            opportunity.OwnerId = 0;
            Opportunity opportunitywithOwner = opportunity;
            var         brokenRuleCount      = opportunitywithOwner.GetBrokenRules().Count();

            Assert.AreEqual(0, opportunitywithOwner.OwnerId);
            Assert.AreEqual(1, brokenRuleCount);
        }
Esempio n. 3
0
        public void OpportunityStage_StagewithRequired_GetBrokenRulesSuccess()
        {
            opportunity.StageID = 0;
            Opportunity opportunitywithStageID = opportunity;
            var         brokenRuleCount        = opportunitywithStageID.GetBrokenRules().Count();

            Assert.AreEqual(0, opportunitywithStageID.StageID);
            Assert.AreEqual(1, brokenRuleCount);
        }
Esempio n. 4
0
        public void OpportunityDetail_OpportunityNoName_GetBrokenRuleSuccess()
        {
            opportunity.OpportunityName = null;
            Opportunity opportunitywithNoDescription = opportunity;
            var         brokenRuleCount = opportunitywithNoDescription.GetBrokenRules().Count();

            Assert.AreEqual(null, opportunitywithNoDescription.OpportunityName);
            Assert.AreEqual(1, brokenRuleCount);
        }
Esempio n. 5
0
        void isOpportunityValid(Opportunity opportunity)
        {
            IEnumerable <BusinessRule> brokenRules = opportunity.GetBrokenRules();

            if (brokenRules.Any())
            {
                StringBuilder brokenRulesBuilder = new StringBuilder();
                foreach (BusinessRule rule in brokenRules)
                {
                    brokenRulesBuilder.AppendLine(rule.RuleDescription);
                }
                throw new UnsupportedOperationException(brokenRulesBuilder.ToString());
            }
        }