Exemplo n.º 1
0
        public void CompareToString(string resourceProviderID1, string resourceProviderID2, int expected)
        {
            ResourceIdentifier a = new ResourceIdentifier(resourceProviderID1);
            string             b = resourceProviderID2;

            if (a != null)
            {
                Assert.AreEqual(expected, a.CompareTo(resourceProviderID2 == null ? null : new ResourceIdentifier(b)));
            }
        }
        public void CompareToResourceProvider(string resourceProviderID1, string resourceProviderID2, int expected)
        {
            ResourceIdentifier a = resourceProviderID1;
            ResourceIdentifier b = (ResourceIdentifier)resourceProviderID2;

            if (a != null)
            {
                Assert.AreEqual(expected, a.CompareTo(b));
            }
        }
Exemplo n.º 3
0
        public void CompareToString(string resourceProviderID1, string resourceProviderID2, int expected)
        {
            ResourceIdentifier a = resourceProviderID1;
            string             b = resourceProviderID2;

            if (a != null)
            {
                Assert.AreEqual(expected, a.CompareTo(b));
            }

            Assert.AreEqual(expected, ResourceIdentifier.CompareTo(a, b));
        }
Exemplo n.º 4
0
        public void TestResourceIdentifierCompareToMethod()
        {
            // Arrange
            var resourceIdentifier0 = default(ResourceIdentifier);
            var resourceIdentifier1 = new ResourceIdentifier();
            var resourceIdentifier2 = ApiSampleData.PersonResourceIdentifier1;
            var resourceIdentifier3 = ApiSampleData.PersonResourceIdentifier2;
            var resourceIdentifier4 = ApiSampleData.PersonResourceIdentifier1;
            var resourceIdentifier5 = ApiSampleData.CommentResourceIdentifier1;

            // Act

            // Assert

            // ReSharper disable ExpressionIsAlwaysNull
            // ReSharper disable EqualExpressionComparison
            // ReSharper disable HeuristicUnreachableCode
            Assert.True(resourceIdentifier1.CompareTo(resourceIdentifier0) > 0);
            Assert.True(resourceIdentifier1.CompareTo(resourceIdentifier1) == 0);
            Assert.True(resourceIdentifier1.CompareTo(resourceIdentifier2) < 0);
            Assert.True(resourceIdentifier1.CompareTo(resourceIdentifier3) < 0);
            Assert.True(resourceIdentifier1.CompareTo(resourceIdentifier4) < 0);
            Assert.True(resourceIdentifier1.CompareTo(resourceIdentifier5) < 0);

            Assert.True(resourceIdentifier2.CompareTo(resourceIdentifier0) > 0);
            Assert.True(resourceIdentifier2.CompareTo(resourceIdentifier1) > 0);
            Assert.True(resourceIdentifier2.CompareTo(resourceIdentifier2) == 0);
            Assert.True(resourceIdentifier2.CompareTo(resourceIdentifier3) < 0);
            Assert.True(resourceIdentifier2.CompareTo(resourceIdentifier4) == 0);
            Assert.True(resourceIdentifier2.CompareTo(resourceIdentifier5) > 0);

            Assert.True(resourceIdentifier3.CompareTo(resourceIdentifier0) > 0);
            Assert.True(resourceIdentifier3.CompareTo(resourceIdentifier1) > 0);
            Assert.True(resourceIdentifier3.CompareTo(resourceIdentifier2) > 0);
            Assert.True(resourceIdentifier3.CompareTo(resourceIdentifier3) == 0);
            Assert.True(resourceIdentifier3.CompareTo(resourceIdentifier4) > 0);
            Assert.True(resourceIdentifier3.CompareTo(resourceIdentifier5) > 0);

            Assert.True(resourceIdentifier4.CompareTo(resourceIdentifier0) > 0);
            Assert.True(resourceIdentifier4.CompareTo(resourceIdentifier1) > 0);
            Assert.True(resourceIdentifier4.CompareTo(resourceIdentifier2) == 0);
            Assert.True(resourceIdentifier4.CompareTo(resourceIdentifier3) < 0);
            Assert.True(resourceIdentifier4.CompareTo(resourceIdentifier4) == 0);
            Assert.True(resourceIdentifier4.CompareTo(resourceIdentifier5) > 0);

            Assert.True(resourceIdentifier5.CompareTo(resourceIdentifier0) > 0);
            Assert.True(resourceIdentifier5.CompareTo(resourceIdentifier1) > 0);
            Assert.True(resourceIdentifier5.CompareTo(resourceIdentifier2) < 0);
            Assert.True(resourceIdentifier5.CompareTo(resourceIdentifier3) < 0);
            Assert.True(resourceIdentifier5.CompareTo(resourceIdentifier4) < 0);
            Assert.True(resourceIdentifier5.CompareTo(resourceIdentifier5) == 0);
            // ReSharper restore HeuristicUnreachableCode
            // ReSharper restore EqualExpressionComparison
            // ReSharper restore ExpressionIsAlwaysNull
        }