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); }
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); }
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); }
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); }
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()); } }