예제 #1
0
        public void CreateNewFixedBudgetProjectShouldThrowGivenCodeAlreadyExists()
        {
            InMemoryBudgetBucketRepository subject = CreateSubject();

            subject.GetOrCreateNew(FixedBudgetProjectBucket.CreateCode("Foo"), () => new FixedBudgetProjectBucket("Foo", "Foo bajh", 2000));
            subject.CreateNewFixedBudgetProject("Foo", "Foo var", 1000);
            Assert.Fail();
        }
예제 #2
0
        public void GetByOrCreateNewShouldThrowGivenNullFactory()
        {
            InMemoryBudgetBucketRepository subject = Arrange();

            subject.GetOrCreateNew("CODE", null);

            Assert.Fail();
        }
예제 #3
0
        public void GetOrAddShouldAddWhenItemDoesntExist()
        {
            InMemoryBudgetBucketRepository subject = Arrange();

            subject.GetOrCreateNew("Foo", () => new IncomeBudgetBucket("Foo", "Bar"));

            Assert.IsTrue(subject.IsValidCode("Foo"));
        }
예제 #4
0
        public void GetByOrCreateNewShouldThrowGivenNullCode()
        {
            InMemoryBudgetBucketRepository subject = Arrange();

            subject.GetOrCreateNew(null, () => new PayCreditCardBucket());

            Assert.Fail();
        }
예제 #5
0
        public void GetOrAddShouldNotAddWhenItemDoesExist()
        {
            InMemoryBudgetBucketRepository subject = Arrange();

            int count = subject.Buckets.Count();

            subject.GetOrCreateNew(
                TestDataConstants.HairBucketCode,
                () =>
            {
                Assert.Fail();
                return(new IncomeBudgetBucket(TestDataConstants.HairBucketCode, "Bar"));
            });

            Assert.AreEqual(count, subject.Buckets.Count());
        }