public void CompareTo_DoesNotTakeIntoAccountValueSemantics()
        {
            Qualified html = new Qualified("text/html", new Quality(.5f)),
                      text = new Qualified("text/*", new Quality(.5f));

            Assert.That(text.CompareTo(html), Is.EqualTo(0),
                        "if value semantics were used, html should be more important than any text");
        }
        public void CompareTo_OnlyQualityTakenIntoAccount()
        {
            Qualified subject        = new Qualified("anything", new Quality(.5f)),
                      striclySmaller = new Qualified("smaller", new Quality(.3f)),
                      striclyLarger  = new Qualified("larger", new Quality(.7f)),
                      equal          = new Qualified("same", new Quality(.5f));

            Assert.That(subject, Is.GreaterThan(striclySmaller));
            Assert.That(subject, Is.LessThan(striclyLarger));
            Assert.That(subject, Is.LessThanOrEqualTo(equal));
            Assert.That(subject, Is.GreaterThanOrEqualTo(equal));
            Assert.That(subject.CompareTo(null), Is.GreaterThan(0));
        }
 public void CompareToSmallerName()
 {
     IQualifiedName<SchemaName> x = new Qualified<SchemaName, TableName>(new SchemaName("xyz"), new TableName("abc"));
     IQualifiedName<SchemaName> y = new Qualified<SchemaName, TableName>(new SchemaName("dbo"), new TableName("abc"));
     Expect(x.CompareTo(y), GreaterThan(0));
 }
 public void CompareToSimilar()
 {
     IQualifiedName<SchemaName> x = new Qualified<SchemaName, TableName>(new SchemaName("dbo"), new TableName("abc"));
     IQualifiedName<SchemaName> y = new Qualified<SchemaName, FunctionName>(new SchemaName("dbo"), new FunctionName("abc"));
     Expect(x.CompareTo(y), GreaterThan(0));
 }
 public void CompareToSelf()
 {
     IQualifiedName<SchemaName> x = new Qualified<SchemaName, TableName>(new SchemaName("dbo"), new TableName("abc"));
     Expect(x.CompareTo(x), EqualTo(0));
 }
 public void CompareToNull()
 {
     IQualifiedName<SchemaName> x = new Qualified<SchemaName, TableName>(new SchemaName("dbo"), new TableName("abc"));
     Expect(x.CompareTo(null), GreaterThan(0));
 }
 public void CompareToLargerSchema()
 {
     IQualifiedName<SchemaName> x = new Qualified<SchemaName, TableName>(new SchemaName("dbo"), new TableName("abc"));
     IQualifiedName<SchemaName> y = new Qualified<SchemaName, TableName>(new SchemaName("xyz"), new TableName("abc"));
     Expect(x.CompareTo(y), LessThan(0));
 }
 public void CompareToIdentical()
 {
     IQualifiedName<SchemaName> x = new Qualified<SchemaName, TableName>(new SchemaName("dbo"), new TableName("abc"));
     IQualifiedName<SchemaName> y = new Qualified<SchemaName, TableName>(new SchemaName("dbo"), new TableName("abc"));
     Expect(x.CompareTo(y), EqualTo(0));
 }
 public void CompareToEquivalent()
 {
     IQualifiedName<SchemaName> x = new Qualified<SchemaName, TableName>(new SchemaName("dbo"), new TableName("abc"));
     IQualifiedName<SchemaName> y = new Qualified<SchemaName, TableName>(new SchemaName("DBO"), new TableName("ABC"));
     Expect(x.CompareTo(y), EqualTo(0));
 }