public void WhenNotUpdatedUnspecifiedShouldBeReturned()
        {
            // Arrange
            var assurer = new CldrVersionConsistencyAssurer();

            // Act & Assert
            Assert.That(assurer.Version, Is.EqualTo("unspecified"));
        }
        public void ShouldThrowExceptionWhenVersionsAreDifferent()
        {
            // Arrange
            var assurer = new CldrVersionConsistencyAssurer();

            // Act & Assert
            Assert.DoesNotThrow(() => assurer.AssureVersionIsConsistent("30", "dummy path 1"));
            Assert.Throws<FormatException>(() => assurer.AssureVersionIsConsistent("31", "dummy path 2"));
        }
        public void WhenUpdatedVersionShouldBeReturned()
        {
            // Arrange
            var assurer = new CldrVersionConsistencyAssurer();

            // Act
            assurer.AssureVersionIsConsistent("30", "dummy path");

            // Assert
            Assert.That(assurer.Version, Is.EqualTo("30"));
        }
        public void ShouldThrowExceptionWhenAfterManySameVersionsDifferentIsDetected()
        {
            // Arrange
            var assurer = new CldrVersionConsistencyAssurer();

            // Act & Assert
            for (var i = 0; i < 100; ++i)
                Assert.DoesNotThrow(() => assurer.AssureVersionIsConsistent("30", $"dummy path {i}"));

            Assert.Throws<FormatException>(() => assurer.AssureVersionIsConsistent("31", "dummy path 101"));
        }
        public void SequenceOfSameUpdatesShouldWork()
        {
            // Arrange
            var assurer = new CldrVersionConsistencyAssurer();

            // Act
            for (var i = 0; i < 100; ++i)
                assurer.AssureVersionIsConsistent("30", $"dummy path {i}");

            // Assert
            Assert.That(assurer.Version, Is.EqualTo("30"));
        }
Esempio n. 6
0
 public CldrDataBuilder()
 {
     this.fileFinder = new CldrJsonFileFinder();
     this.versionConsistencyAssurer = new CldrVersionConsistencyAssurer();
     this.jsonParsers = new CldrJsonParser[]
     {
         new AvailableLocalesParser(),
         new DefaultContentParser(),
         new MainParser(),
         new RbnfParser(),
         new ScriptMetadataParser(),
         new SegmentsParser(),
         new SupplementalParser()
     };
 }
Esempio n. 7
0
 public CldrDataBuilder()
 {
     this.fileFinder = new CldrJsonFileFinder();
     this.versionConsistencyAssurer = new CldrVersionConsistencyAssurer();
     this.jsonParsers = new CldrJsonParser[]
     {
         new AvailableLocalesParser(),
         new DefaultContentParser(),
         new MainParser(),
         new RbnfParser(),
         new ScriptMetadataParser(),
         new SegmentsParser(),
         new SupplementalParser()
     };
 }