ApiDescriptionGroup

We found 10 examples in language CSharp for this search. You will see 25 fragments of code.
using System.Collections.Generic;
using System.Linq;
using AspNetX.Server.Abstractions;
using Microsoft.AspNet.Mvc.ApiExplorer;
using Newtonsoft.Json;

namespace AspNetX.Server.Wrappers
{
    internal class ApiDescriptionGroupWrapper : IApiDescriptionGroupWrapper
    {
        [JsonIgnore]
        public ApiDescriptionGroup ApiDescriptionGroup { get; }

        public ApiDescriptionGroupWrapper(ApiDescriptionGroup apiDescriptionGroup)
        {
            this.ApiDescriptionGroup = apiDescriptionGroup;
        }

        public string GroupName { get { return this.ApiDescriptionGroup.GroupName; } }

        public IReadOnlyList<IApiDescriptionWrapper> Items
        {
            get
            {
                return this.ApiDescriptionGroup
                    .Items
                    .Select(o => new ApiDescriptionWrapper(o))
                    .ToList()
                    .AsReadOnly();
            }
        }
    }
}


        private IReadOnlyList<ApiDescriptionGroup> GetGroups()
        {
            return new Collection<ApiDescriptionGroup>
            {
                new ApiDescriptionGroup("InterfaceName", new []
                {
                    new ApiDescription
                    {
                        
                    }
                })
            };
        }


        public void Add(ApiDescriptionGroup apiDescriptionGroup)
        {
            _apiDescriptionGroups.Add(apiDescriptionGroup.GroupName, apiDescriptionGroup);
        }

        public bool TryGet(string groupName, out ApiDescriptionGroup apiDescriptionGroup)
        {
            return _apiDescriptionGroups.TryGetValue(groupName, out apiDescriptionGroup);
        }

        private IReadOnlyList<ApiDescriptionGroup> CreateApiDescriptionGroups()
        {
            return _hostConfiguration.Configurations
                .Select(CreateApiDescriptionGroup)
                .ToList()
                .AsReadOnly();
        }


        [TestInitialize]
        public void TestInitialize()
        {
            _httpFunctionParameterProcessor = A.Fake<IHttpFunctionParameterProcessor>();
            _httpFunctionResponseProcessor = A.Fake<IHttpFunctionResponseProcessor>();
            _httpOptions = A.Fake<IOptions<HttpOptions>>();
            A.CallTo(() => _httpOptions.Value).Returns(new HttpOptions { RoutePrefix = _routePrefix } );
            A.CallTo(() => _httpFunctionParameterProcessor.GetApiParameterDescriptions(A<MethodInfo>._, A<string>._)).Returns(new List<ApiParameterDescription>(0));

            _sut = new HttpFunctionProcessor(_httpFunctionParameterProcessor, _httpFunctionResponseProcessor, _httpOptions);
        }

        [TestMethod]
        public void Constructor_WithNullForHttpFunctionParameterProcessor_ThrowsException()
        {
            // ReSharper disable once ObjectCreationAsStatement
            Action action = () => new HttpFunctionProcessor(null, _httpFunctionResponseProcessor, _httpOptions);

            action.Should().Throw<ArgumentNullException>().And.ParamName.Should().Be("httpFunctionParameterProcessor");
        }

        [TestMethod]
        public void Constructor_WithNullForHttpFunctionResponseProcessor_ThrowsException()
        {
            // ReSharper disable once ObjectCreationAsStatement
            Action action = () => new HttpFunctionProcessor(_httpFunctionParameterProcessor, null, _httpOptions);

            action.Should().Throw<ArgumentNullException>().And.ParamName.Should().Be("httpFunctionResponseProcessor");
        }

        [TestMethod]
        public void Constructor_WithNullForHttpOptions_ThrowsException()
        {
            // ReSharper disable once ObjectCreationAsStatement
            Action action = () => new HttpFunctionProcessor(_httpFunctionParameterProcessor, _httpFunctionResponseProcessor, null);

            action.Should().Throw<ArgumentNullException>().And.ParamName.Should().Be("httpOptions");
        }

        [TestMethod]
        public void ProcessHttpFunction_WithNullForHttpFunctionMethod_ThrowsException()
        {
            // ReSharper disable once ObjectCreationAsStatement
            Action action = () => _sut.ProcessHttpFunction(null);

            action.Should().Throw<ArgumentNullException>().And.ParamName.Should().Be("httpFunction");
        }

        [TestMethod]
        public void ProcessHttpFunction_ForMetadataTestSingleMethod_GetsGroupName()
        {
            const string methodName = nameof(FunctionMethodTestSource.MetadataTestSingleMethod);
            var method = GetMethodInfo(methodName);

            // ReSharper disable once ObjectCreationAsStatement
            var apiDescriptionGroup = _sut.ProcessHttpFunction(method);

            apiDescriptionGroup.GroupName.Should().Be(methodName);
        }

                    public static T GetProperty<T>(this Microsoft.AspNetCore.Mvc.ApiExplorer.ApiDescription apiDescription) => throw null;
                    public static void SetProperty<T>(this Microsoft.AspNetCore.Mvc.ApiExplorer.ApiDescription apiDescription, T value) => throw null;
                    public void OnProvidersExecuted(Microsoft.AspNetCore.Mvc.ApiExplorer.ApiDescriptionProviderContext context) => throw null;
                    public void OnProvidersExecuting(Microsoft.AspNetCore.Mvc.ApiExplorer.ApiDescriptionProviderContext context) => throw null;
                public static Microsoft.Extensions.DependencyInjection.IMvcCoreBuilder AddApiExplorer(this Microsoft.Extensions.DependencyInjection.IMvcCoreBuilder builder) => throw null;

                    public static T GetProperty<T>(this Microsoft.AspNetCore.Mvc.ApiExplorer.ApiDescription apiDescription) => throw null;
                    public static void SetProperty<T>(this Microsoft.AspNetCore.Mvc.ApiExplorer.ApiDescription apiDescription, T value) => throw null;
                    public void OnProvidersExecuted(Microsoft.AspNetCore.Mvc.ApiExplorer.ApiDescriptionProviderContext context) => throw null;
                    public void OnProvidersExecuting(Microsoft.AspNetCore.Mvc.ApiExplorer.ApiDescriptionProviderContext context) => throw null;
                public static Microsoft.Extensions.DependencyInjection.IMvcCoreBuilder AddApiExplorer(this Microsoft.Extensions.DependencyInjection.IMvcCoreBuilder builder) => throw null;

// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Collections.Generic;

namespace Microsoft.AspNetCore.Mvc.ApiExplorer
{
    /// <summary>
    /// A cached collection of <see cref="ApiDescriptionGroup" />.
    /// </summary>
    public class ApiDescriptionGroupCollection
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ApiDescriptionGroupCollection"/>.
        /// </summary>
        /// <param name="items">The list of <see cref="ApiDescriptionGroup"/>.</param>
        /// <param name="version">The unique version of discovered groups.</param>
        public ApiDescriptionGroupCollection(IReadOnlyList<ApiDescriptionGroup> items, int version)
        {
            if (items == null)
            {
                throw new ArgumentNullException(nameof(items));
            }

            Items = items;
            Version = version;
        }

        /// <summary>
        /// Returns the list of <see cref="IReadOnlyList{ApiDescriptionGroup}"/>.
        /// </summary>
        public IReadOnlyList<ApiDescriptionGroup> Items { get; private set; }

        /// <summary>
        /// Returns the unique version of the current items.
        /// </summary>
        public int Version { get; private set; }
    }
}

// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Collections.Generic;

namespace Microsoft.AspNet.Mvc.ApiExplorer
{
    /// <summary>
    /// A cached collection of <see cref="ApiDescriptionGroup" />.
    /// </summary>
    public class ApiDescriptionGroupCollection
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ApiDescriptionGroupCollection"/>.
        /// </summary>
        /// <param name="items">The list of <see cref="ApiDescriptionGroup"/>.</param>
        /// <param name="version">The unique version of discovered groups.</param>
        public ApiDescriptionGroupCollection(IReadOnlyList<ApiDescriptionGroup> items, int version)
        {
            if (items == null)
            {
                throw new ArgumentNullException(nameof(items));
            }

            Items = items;
            Version = version;
        }

        /// <summary>
        /// Returns the list of <see cref="IReadOnlyList{ApiDescriptionGroup}"/>.
        /// </summary>
        public IReadOnlyList<ApiDescriptionGroup> Items { get; private set; }

        /// <summary>
        /// Returns the unique version of the current items.
        /// </summary>
        public int Version { get; private set; }
    }
}

// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Collections.Generic;

namespace Microsoft.AspNetCore.Mvc.ApiExplorer
{
    /// <summary>
    /// A cached collection of <see cref="ApiDescriptionGroup" />.
    /// </summary>
    public class ApiDescriptionGroupCollection
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ApiDescriptionGroupCollection"/>.
        /// </summary>
        /// <param name="items">The list of <see cref="ApiDescriptionGroup"/>.</param>
        /// <param name="version">The unique version of discovered groups.</param>
        public ApiDescriptionGroupCollection(IReadOnlyList<ApiDescriptionGroup> items, int version)
        {
            if (items == null)
            {
                throw new ArgumentNullException(nameof(items));
            }

            Items = items;
            Version = version;
        }

        /// <summary>
        /// Returns the list of <see cref="IReadOnlyList{ApiDescriptionGroup}"/>.
        /// </summary>
        public IReadOnlyList<ApiDescriptionGroup> Items { get; private set; }

        /// <summary>
        /// Returns the unique version of the current items.
        /// </summary>
        public int Version { get; private set; }
    }
}

// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Collections.Generic;

namespace Microsoft.AspNetCore.Mvc.ApiExplorer
{
    /// <summary>
    /// A cached collection of <see cref="ApiDescriptionGroup" />.
    /// </summary>
    public class ApiDescriptionGroupCollection
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ApiDescriptionGroupCollection"/>.
        /// </summary>
        /// <param name="items">The list of <see cref="ApiDescriptionGroup"/>.</param>
        /// <param name="version">The unique version of discovered groups.</param>
        public ApiDescriptionGroupCollection(IReadOnlyList<ApiDescriptionGroup> items, int version)
        {
            if (items == null)
            {
                throw new ArgumentNullException(nameof(items));
            }

            Items = items;
            Version = version;
        }

        /// <summary>
        /// Returns the list of <see cref="IReadOnlyList{ApiDescriptionGroup}"/>.
        /// </summary>
        public IReadOnlyList<ApiDescriptionGroup> Items { get; private set; }

        /// <summary>
        /// Returns the unique version of the current items.
        /// </summary>
        public int Version { get; private set; }
    }
}

Other methods