/// <summary> /// Initializes a new instance of the <see cref="CaseManager" /> class. /// </summary> public CaseManager() { this.StartingCaseId = InitialStartingBriefcaseId; this.StartingCase = InitialBriefcase; this.briefcases = new List <Briefcase>(); }
/// <summary> /// Allocates the starting briefcase and its id. /// Precondition: targetBriefcase not equal to null. /// Post-condition: StartingCase = targetBriefcase. StartingCaseId = targetBriefcase.Id /// </summary> /// <param name="targetBriefcase">The target briefcase.</param> public void AllocateStartingBriefcase(Briefcase targetBriefcase) { targetBriefcase = targetBriefcase ?? throw new ArgumentNullException(ExceptionMessage.NullBriefcaseNotAllowed); this.StartingCase = targetBriefcase; this.StartingCaseId = targetBriefcase.Id; }
/// <summary> /// Removes the specified briefcase from play. /// </summary> /// <param name="briefcase">The briefcase.</param> /// <returns>The dollar amount in the removed briefcase.</returns> public int RemoveBriefcaseFromPlay(Briefcase briefcase) { briefcase = briefcase ?? throw new ArgumentNullException(ExceptionMessage.NullBriefcaseNotAllowed); var targetBriefcaseAmount = briefcase.DollarAmount; this.briefcases.Remove(briefcase); return(targetBriefcaseAmount); }