public void TestInitialise()
        {
            var bucketRepo = new BucketBucketRepoAlwaysFind();

            TestData = BudgetModelTestData.CreateCollectionWith1And2();

            // ExtractXaml All Buckets from The Test Data.
            TestDataBuckets = TestData.SelectMany(b => b.Expenses.Cast <BudgetItem>())
                              .Union(TestData.SelectMany(b => b.Incomes))
                              .Select(x => x.Bucket)
                              .Distinct();

            // Preload the buckets into the bucket repo used by the Mapper.
            foreach (BudgetBucket bucket in TestDataBuckets)
            {
                bucketRepo.GetByCode(bucket.Code);
            }

            var subject = new Mapper_BudgetCollectionDto_BudgetCollection(
                bucketRepo,
                new Mapper_BudgetBucketDto_BudgetBucket(new BudgetBucketFactory()),
                new Mapper_BudgetModelDto_BudgetModel(bucketRepo));

            Result = subject.ToDto(TestData);
        }
Пример #2
0
        private BudgetCollectionDto ArrangeAndAct()
        {
            var bucketRepo = new BucketBucketRepoAlwaysFind();
            var mapper     = new Mapper_BudgetCollectionDto_BudgetCollection(
                bucketRepo,
                new Mapper_BudgetBucketDto_BudgetBucket(new BudgetBucketFactory()),
                new Mapper_BudgetModelDto_BudgetModel(bucketRepo));

            return(mapper.ToDto(TestData));
        }