Exemple #1
0
        public void Compare_WithSecondSchemaNull_ShouldThrow()
        {
            var comparer    = new SchemaVersionComparer <FileDescriptorSet>();
            var firstSchema = this.factory.CreateNew(new Version(1), this.validSchema);

            Assert.Throws <ArgumentNullException>(() => comparer.Compare(firstSchema, null));
        }
Exemple #2
0
        public void Compare_WithFirstSchemaNewerThanTheSecondOne_ShouldReturnPositiveValue()
        {
            var comparer     = new SchemaVersionComparer <FileDescriptorSet>();
            var firstSchema  = this.factory.CreateNew(new Version(2), this.validSchema);
            var secondSchema = this.factory.CreateNew(new Version(1), this.validSchema);

            int result = comparer.Compare(firstSchema, secondSchema);

            Assert.True(result > 0);
        }
Exemple #3
0
        public void Compare_WithSchemasWithEqualVersions_ShouldReturnZero()
        {
            var comparer     = new SchemaVersionComparer <FileDescriptorSet>();
            var firstSchema  = this.factory.CreateNew(new Version(1), this.validSchema);
            var secondSchema = this.factory.CreateNew(new Version(1), this.validSchema);

            int result = comparer.Compare(firstSchema, secondSchema);

            Assert.Equal(0, result);
        }