コード例 #1
0
        public void InsufficientData()
        {
            var stream = new MemoryStream();
            var writer = new DateTimeZoneWriter(stream, null);

            writer.WriteByte(1);
            writer.WriteCount(10);

            stream.Position = 0;
            var iterator = TzdbStreamField.ReadFields(stream).GetEnumerator();

            Assert.Throws <InvalidNodaDataException>(() => iterator.MoveNext());
        }
コード例 #2
0
        public void ReadInvalid()
        {
            var stream = new MemoryStream();
            var writer = new DateTimeZoneWriter(stream, null);

            // Valid latitude/longitude
            writer.WriteSignedCount(0);
            writer.WriteSignedCount(0);
            // But no countries
            writer.WriteCount(0);
            writer.WriteString("Europe/Somewhere");
            writer.WriteString("");
            stream.Position = 0;
            var reader = new DateTimeZoneReader(stream, null);

            Assert.Throws <InvalidNodaDataException>(() => TzdbZone1970Location.Read(reader));
        }