public void TheWebServiceGetCatalogueApiIsCalled()
 {
     _catalogue = RestClient.GetCatalogue(new GetConfigurationCatalogue());
 }
 public void TheWebServiceGetCatalogueApiIsCalledWithTags_(string csvTags)
 {
     var tags = csvTags.Split(new[] {","}, StringSplitOptions.RemoveEmptyEntries);
     _catalogue = RestClient.GetCatalogue(new GetConfigurationCatalogue { Tags = tags });
 }
Пример #3
0
        private dynamic GetCatalogue(dynamic request)
        {
            var catalogueRequest = this.Bind<GetConfigurationCatalogue>();
            var catalogue = ConfigurationManager.GetCatalogue(catalogueRequest.Tags);
            var response = new RestConfigurationCatalogue
            {
                InstanceId = catalogue.InstanceId,
                Links = new List<RestLink>
                {
                    new RestLink
                    {
                        Action = "Accept Changes",
                        Link = BuildLink("applychanges"),
                        Method = "GET"
                    }
                },
                Pending = catalogue.Pending.Select(
                    ce =>
                    {
                        var entry = new RestConfigurationChangeSummary(ce);
                        entry.Links.Add(new RestLink
                        {
                            Action = "Undo change",
                            Method = "GET",
                            Link = BuildLink("configuration/undo?id={0}", ce.Id)
                        });
                        return entry;
                    }
                    ).ToList(),
                Items = catalogue.Items.Select(
                    ce =>
                    {
                        var entry = new RestCatalogueEntry(ce);
                        entry.Links.Add(new RestLink
                        {
                            Action = "Create a new instance",
                            Method = "POST",
                            Link = BuildLink("configuration")
                        });
                        return entry;
                    }).ToList()
            };

            return Response.AsJson(response);
        }