Exemplo n.º 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();
        }
Exemplo n.º 2
0
        public void GetByOrCreateNewShouldThrowGivenNullFactory()
        {
            InMemoryBudgetBucketRepository subject = Arrange();

            subject.GetOrCreateNew("CODE", null);

            Assert.Fail();
        }
Exemplo n.º 3
0
        public void GetOrAddShouldAddWhenItemDoesntExist()
        {
            InMemoryBudgetBucketRepository subject = Arrange();

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

            Assert.IsTrue(subject.IsValidCode("Foo"));
        }
Exemplo n.º 4
0
        public void GetByOrCreateNewShouldThrowGivenNullCode()
        {
            InMemoryBudgetBucketRepository subject = Arrange();

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

            Assert.Fail();
        }
Exemplo n.º 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());
        }