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

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

            OrderIdComponents components = new OrderIdComponents
            {
                uuid            = "asdf",
                OrderItemIdLong = 123,
                OrderType       = OrderType.Order
            };

            var id = template.RenderOrderItemId(components);

            Assert.Equal(new Uri("https://example.com/api/orders/asdf#/orderedItems/123"), id);
        }
예제 #2
0
        public void SingleIdTemplate_GetIdComponents_EnumToId()
        {
            var template = new OrderIdTemplate(
                "{+BaseUrl}api/{OrderType}/{uuid}",
                "{+BaseUrl}api/{OrderType}/{uuid}#/orderedItems/{OrderItemIdLong}"
                );

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

            OrderIdComponents components = new OrderIdComponents
            {
                uuid            = new Guid("3cbb8557-ca8f-4889-b21f-a59f860f8d25"),
                OrderItemIdLong = 123,
                OrderType       = OrderType.Order
            };

            var id = template.RenderOrderItemId(components);

            Assert.Equal(new Uri("https://example.com/api/orders/3cbb8557-ca8f-4889-b21f-a59f860f8d25#/orderedItems/123"), id);
        }