Ejemplo n.º 1
0
        public static CapabilityStatement.ResourceInteractionComponent AddSingleResourceInteraction(
            CapabilityStatement.TypeRestfulInteraction type)
        {
            var interaction = new CapabilityStatement.ResourceInteractionComponent {
                Code = type
            };

            return(interaction);
        }
        public static ListedCapabilityStatement TryAddRestInteraction(this ListedCapabilityStatement statement, ResourceType resourceType, CapabilityStatement.TypeRestfulInteraction interaction)
        {
            EnsureArg.IsNotNull(statement, nameof(statement));

            statement.BuildRestResourceComponent(resourceType, builder =>
            {
                var hasInteraction = builder
                                     .Interaction
                                     .FirstOrDefault(x => x.Code == interaction);

                if (hasInteraction == null)
                {
                    builder
                    .Interaction
                    .Add(new CapabilityStatement.ResourceInteractionComponent
                    {
                        Code = interaction,
                    });
                }
            });

            return(statement);
        }
Ejemplo n.º 3
0
        public void TheCapabilityStatementRestResourcesShouldContainAResourceWithInteraction(ResourceType resourceType, CapabilityStatement.TypeRestfulInteraction interaction)
        {
            CapabilityStatements.ForEach(capabilityStatement =>
            {
                capabilityStatement.Rest.ForEach(rest =>
                {
                    var resource = rest.Resource.FirstOrDefault(r => r.Type == resourceType);

                    resource.ShouldNotBeNull($"The CapabilityStatement REST Resources should contain {resourceType.ToString()} but did not.");

                    var interactions = resource.Interaction.Where(i => i.Code == interaction);

                    interactions.ShouldNotBeNull($"The CapabilityStatement REST {resourceType.ToString()} Resource Interactions should contain the {interaction.ToString()} Interaction but did not.");
                });
            });
        }