public void AppliesToEndpointsReturnsTrueAlways()
        {
            // Arrange
            ODataEndpointSelectorPolicy policy = new ODataEndpointSelectorPolicy();

            // Act & Assert
            Assert.True(policy.AppliesToEndpoints(endpoints: null));

            // Act & Assert
            Assert.True(policy.AppliesToEndpoints(endpoints: new List <Endpoint>()));
        }
        public void ApplyAsyncDoNothingIfActionDescriptorNotSelected()
        {
            // Arrange
            HttpContext context = new DefaultHttpContext();

            CandidateSet candidateSet = CreateCandidateSet();

            Assert.True(candidateSet.IsValidCandidate(0)); // Guard

            // Act
            Task actual = new ODataEndpointSelectorPolicy().ApplyAsync(context, candidateSet);

            // Assert
            Assert.Equal(Task.CompletedTask, actual);
            Assert.True(candidateSet.IsValidCandidate(0));
        }
        public void ApplyAsyncDoNothingIfEndpointHasODataSelectedActionDescriptor()
        {
            // Arrange
            HttpContext             context          = new DefaultHttpContext();
            Mock <ActionDescriptor> actionDescriptor = new Mock <ActionDescriptor>();

            context.ODataFeature().ActionDescriptor = actionDescriptor.Object;

            CandidateSet candidateSet = CreateCandidateSet(actionDescriptor.Object);

            Assert.True(candidateSet.IsValidCandidate(0)); // Guard

            // Act
            Task actual = new ODataEndpointSelectorPolicy().ApplyAsync(context, candidateSet);

            // Assert
            Assert.Equal(Task.CompletedTask, actual);
            Assert.True(candidateSet.IsValidCandidate(0));
        }