コード例 #1
0
        public async Task EmptyFile(string filename)
        {
            using var blmFileReader = new BlmFileReader(GetTestFile(filename));

            await blmFileReader.ReadHeader();

            Assert.That(blmFileReader.Definitions, Has.Count.EqualTo(ExpectedDefinitions.Length));

            var record = await blmFileReader.ReadRecord();

            Assert.That(record, Is.Null);
        }
コード例 #2
0
        public async Task SimpleData(string filename)
        {
            using var blmFileReader = new BlmFileReader(GetTestFile(filename));

            await blmFileReader.ReadHeader();

            Assert.That(blmFileReader.Definitions, Has.Count.EqualTo(ExpectedDefinitions.Length));

            var record = await blmFileReader.ReadRecord();

            Assert.That(record, Is.Not.Null);

            Assert.That(record.Fields, Has.Count.EqualTo(ExpectedDefinitions.Length));

            Assert.That(record.Fields["AGENT_REF"], Is.EqualTo("REF_123"));
            Assert.That(record.Fields["ADDRESS_1"], Is.EqualTo("1"));
            Assert.That(record.Fields["ADDRESS_2"], Is.EqualTo("Bobbington Road"));
            Assert.That(record.Fields["ADDRESS_3"], Is.EqualTo(""));
            Assert.That(record.Fields["TOWN"], Is.EqualTo("Bobsville"));
            Assert.That(record.Fields["POSTCODE1"], Is.EqualTo("BO6"));
            Assert.That(record.Fields["POSTCODE2"], Is.EqualTo("3RT"));
        }