public void SingleIdTemplate_GetIdComponents_IdToEnum()
        {
            var template = new OrderIdTemplate(
                "{+BaseUrl}api/{OrderType}/{uuid}",
                "{+BaseUrl}api/{OrderType}/{uuid}#/orderedItems/{OrderItemIdLong}"
                );

            template.RequiredBaseUrl = new Uri("https://example.com/");

            var components = template.GetOrderItemIdComponents("client", new Uri("https://example.com/api/orders/asdf#/orderedItems/123"));

            Assert.NotNull(components);
            Assert.Equal(OrderType.Order, components.OrderType);
            Assert.Equal("asdf", components.uuid);
            Assert.Equal(123, components.OrderItemIdLong);
        }
Пример #2
0
        public void SingleIdTemplate_GetIdComponents_IdToEnum()
        {
            var template = new OrderIdTemplate(
                "{+BaseUrl}api/{OrderType}/{uuid}",
                "{+BaseUrl}api/{OrderType}/{uuid}#/orderedItems/{OrderItemIdLong}"
                );

            template.RequiredBaseUrl = new Uri("https://example.com/");

            var components = template.GetOrderItemIdComponents("client", new Uri("https://example.com/api/orders/3cbb8557-ca8f-4889-b21f-a59f860f8d25#/orderedItems/123"));

            Assert.NotNull(components);
            Assert.Equal(OrderType.Order, components.OrderType);
            Assert.Equal(new Guid("3cbb8557-ca8f-4889-b21f-a59f860f8d25"), components.uuid);
            Assert.Equal(123, components.OrderItemIdLong);
        }