Esempio n. 1
0
        public void ResolveContentId_ResolvesContentIDInUrl(string url, string expectedResolvedUrl)
        {
            Dictionary <string, string> contentIdToLocationMapping = new Dictionary <string, string>();

            contentIdToLocationMapping.Add("1", "http://localhost/OData/Customers(42)");

            string resolvedUrl = ContentIdHelpers.ResolveContentId(url, contentIdToLocationMapping);

            Assert.Equal(expectedResolvedUrl, resolvedUrl);
        }
Esempio n. 2
0
        public void ResolveContentId_CannotResolveUnmatchedContentIDInUrl(string key, string url)
        {
            // Arrange
            Dictionary <string, string> contentIdToLocationMapping = new Dictionary <string, string>();

            contentIdToLocationMapping.Add(key, "http://localhost/OData/Customers(42)");

            // Act
            string resolvedUrl = ContentIdHelpers.ResolveContentId(url, contentIdToLocationMapping);

            // Assert
            Assert.Equal(url, resolvedUrl);
        }
Esempio n. 3
0
        public void ResolveContentId_CannotResolveInvalidContentIDInUrl()
        {
            // Arrange
            string url = "$$/Orders";
            Dictionary <string, string> contentIdToLocationMapping = new Dictionary <string, string>();

            contentIdToLocationMapping.Add("$", "http://localhost/OData/Customers(42)");

            // Act
            string resolvedUrl = ContentIdHelpers.ResolveContentId(url, contentIdToLocationMapping);

            // Assert
            Assert.Equal(url, resolvedUrl);
        }
Esempio n. 4
0
        public void ResolveContentId_ResolvesExactContentID(string url, string expectedResolvedUrl)
        {
            // Arrange
            Dictionary <string, string> contentIdToLocationMapping = new Dictionary <string, string>();

            for (int id = 1; id < 101; id++)
            {
                contentIdToLocationMapping.Add(id.ToString(), string.Format("http://localhost/OData/Customers({0})", id));
            }

            // Act
            string resolvedUrl = ContentIdHelpers.ResolveContentId(url, contentIdToLocationMapping);

            // Assert
            Assert.Equal(expectedResolvedUrl, resolvedUrl);
        }