public void SaveShouldWriteOutBuckets()
        {
            var bucketRepo = new InMemoryBudgetBucketRepository(new DtoToBudgetBucketMapper());
            var subject = new XamlOnDiskBudgetRepositoryTestHarness(bucketRepo);

            string savedData = null;
            subject.WriteToDiskMock = (filename, data) => { savedData = data; };
            subject.FileExistsMock = f => true;
            subject.LoadFromDiskMock = OnLoadFromDiskMock;

            BudgetCollection collection = subject.Load(DemoBudgetFileName);
            subject.Save(collection);

            XNamespace ns = "clr-namespace:BudgetAnalyser.Engine.Budget.Data;assembly=BudgetAnalyser.Engine";
            XDocument document = XDocument.Parse(savedData);
            IEnumerable<XElement> bucketCollectionElements = document.Descendants(ns + "BudgetBucketDto");
            foreach (XElement element in bucketCollectionElements)
            {
                Console.WriteLine(element.FirstAttribute);
            }

            Assert.AreEqual(10, bucketCollectionElements.Count());
        }
        public void LoadShouldCallInitialiseOnTheBucketRepository()
        {
            var mockBucketRepository = new Mock<IBudgetBucketRepository>();
            mockBucketRepository.Setup(m => m.Initialise(null));

            var toDomainMapper = new Mock<BasicMapper<BudgetCollectionDto, BudgetCollection>>();
            var subject = new XamlOnDiskBudgetRepositoryTestHarness(
                mockBucketRepository.Object,
                new BasicMapperFake<BudgetCollection, BudgetCollectionDto>(),
                toDomainMapper.Object);
            toDomainMapper.Setup(m => m.Map(It.IsAny<BudgetCollectionDto>())).Returns(BudgetModelTestData.CreateCollectionWith1And2);
            subject.FileExistsMock = f => true;

            subject.LoadFromDiskMock = OnLoadFromDiskMock;
            subject.Load(FileName1);

            mockBucketRepository.Verify();
        }