Exemple #1
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));
        }
Exemple #2
0
        public void ReadInvalid()
        {
            var stream = new MemoryStream();
            var writer = new DateTimeZoneWriter(stream, null);

            // This is invalid
            writer.WriteSignedCount(90 * 3600 + 1);
            writer.WriteSignedCount(0);
            writer.WriteString("name");
            writer.WriteString("co");
            writer.WriteString("Europe/Somewhere");
            writer.WriteString("");
            stream.Position = 0;
            var reader = new DateTimeZoneReader(stream, null);

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