public void ValidateShouldReturnTrueGivenGoodBudgets()
        {
            BudgetCollection subject = Arrange();
            bool             result  = subject.Validate(new StringBuilder());

            Assert.IsTrue(result);
        }
        public void ValidateShouldReturnTrueGivenBudgetsWithDuplicateEffectiveDates()
        {
            BudgetCollection subject = Arrange();

            subject.Add(
                new BudgetModelFake
            {
                EffectiveFrom = subject.First().EffectiveFrom,
                Name          = Guid.NewGuid().ToString()
            });

            Assert.IsTrue(subject.Validate(new StringBuilder()));
        }
        public void ValidateShouldFixGivenBudgetsWithDuplicateEffectiveDates()
        {
            BudgetCollection subject = Arrange();

            subject.Add(
                new BudgetModelFake
            {
                EffectiveFrom = subject.First().EffectiveFrom,
                Name          = Guid.NewGuid().ToString()
            });
            subject.Validate(new StringBuilder());

            Assert.IsTrue(subject.GroupBy(b => b.EffectiveFrom).Sum(group => group.Count()) == 3);
        }
        public void ValidateShouldReturnFalseGivenOneBadBudget()
        {
            BudgetCollection subject = Arrange();

            subject.Add(
                new BudgetModelFake
            {
                EffectiveFrom      = DateTime.Now,
                Name               = "Foo123",
                InitialiseOverride = () => { },
                ValidateOverride   = msg => false
            });

            bool result = subject.Validate(new StringBuilder());

            Assert.IsFalse(result);
        }