public void LedgerBookTestData2ShouldHaveACheckSumOf8435()
        {
            string serialisedData = string.Empty;
            {
                var subject = new XamlOnDiskLedgerBookRepositoryTestHarness(new BasicMapperFake<LedgerBookDto, LedgerBook>(), new LedgerBookToDtoMapper());
                subject.WriteToDiskOverride = (f, d) => serialisedData = d;
                subject.Save(LedgerBookTestData.TestData2());
            }

            int checksumPosition = serialisedData.IndexOf("CheckSum=\"", StringComparison.OrdinalIgnoreCase);
            int checksumLength = serialisedData.IndexOf('"', checksumPosition + 11) - checksumPosition;
            string serialisedCheckSum = serialisedData.Substring(checksumPosition + 10, checksumLength - 10);

            Assert.AreEqual(8435.06, double.Parse(serialisedCheckSum));
        }
        public void SerialiseTestData2ToEnsureItMatches_Load_ShouldLoadTheXmlFile_xml()
        {
            var subject = new XamlOnDiskLedgerBookRepositoryTestHarness(new BasicMapperFake<LedgerBookDto, LedgerBook>(), new LedgerBookToDtoMapper());
            string serialisedData = string.Empty;
            subject.WriteToDiskOverride = (f, d) => serialisedData = d;
            subject.Save(LedgerBookTestData.TestData2());

            Console.WriteLine(serialisedData);

            Assert.IsTrue(serialisedData.Length > 100);
        }
        public void SavingAndLoadingShouldProduceTheSameCheckSum()
        {
            string serialisedData = string.Empty;
            {
                var subject = new XamlOnDiskLedgerBookRepositoryTestHarness(new BasicMapperFake<LedgerBookDto, LedgerBook>(), new LedgerBookToDtoMapper());
                subject.WriteToDiskOverride = (f, d) => serialisedData = d;
                subject.Save(LedgerBookTestData.TestData2());
            }

            Debug.WriteLine("Saved / Serialised Xml:");
            Debug.WriteLine(serialisedData);

            LedgerBookDto bookDto;
            {
                var subject = new XamlOnDiskLedgerBookRepositoryTestHarness(new DtoToLedgerBookMapper(), new BasicMapperFake<LedgerBook, LedgerBookDto>());
                subject.FileExistsOverride = f => true;
                subject.LoadXamlAsStringOverride = f => serialisedData;
                subject.LoadXamlFromDiskFromEmbeddedResources = false;
                subject.Load("foo");
                bookDto = subject.LedgerBookDto;
            }

            int checksumPosition = serialisedData.IndexOf("CheckSum=\"", StringComparison.OrdinalIgnoreCase);
            int checksumLength = serialisedData.IndexOf('"', checksumPosition + 11) - checksumPosition;
            string serialisedCheckSum = serialisedData.Substring(checksumPosition + 10, checksumLength - 10);

            Assert.AreEqual(double.Parse(serialisedCheckSum), bookDto.Checksum);
        }