public void Constructor_TwoParameters()
 {
     HelpPageSampleKey key = new HelpPageSampleKey(new MediaTypeHeaderValue("application/xml"), typeof(Tuple<int, string>));
     Assert.Equal(new MediaTypeHeaderValue("application/xml"), key.MediaType);
     Assert.Equal(typeof(Tuple<int, string>), key.ParameterType);
     Assert.Null(key.SampleDirection);
     Assert.Equal(String.Empty, key.ControllerName);
     Assert.Equal(String.Empty, key.ActionName);
     Assert.Empty(key.ParameterNames);
 }
 public void Constructor_FiveParameters()
 {
     HelpPageSampleKey key = new HelpPageSampleKey(new MediaTypeHeaderValue("application/xml"), SampleDirection.Request, "myController", "myAction", new[] { "id", "name" });
     Assert.Equal(new MediaTypeHeaderValue("application/xml"), key.MediaType);
     Assert.Null(key.ParameterType);
     Assert.Equal(SampleDirection.Request, key.SampleDirection.Value);
     Assert.Equal("myController", key.ControllerName);
     Assert.Equal("myAction", key.ActionName);
     Assert.NotEmpty(key.ParameterNames);
     Assert.True(key.ParameterNames.SetEquals(new[] { "name", "id" }));
 }
        private IEnumerable <KeyValuePair <HelpPageSampleKey, object> > GetAllActionSamples(
            string controllerName,
            string actionName,
            IEnumerable <string> parameterNames,
            SampleDirection sampleDirection
            )
        {
            HashSet <string> parameterNamesSet = new HashSet <string>(
                parameterNames,
                StringComparer.OrdinalIgnoreCase
                );

            foreach (var sample in ActionSamples)
            {
                HelpPageSampleKey sampleKey = sample.Key;
                if (
                    String.Equals(
                        controllerName,
                        sampleKey.ControllerName,
                        StringComparison.OrdinalIgnoreCase
                        ) &&
                    String.Equals(
                        actionName,
                        sampleKey.ActionName,
                        StringComparison.OrdinalIgnoreCase
                        ) &&
                    (
                        sampleKey.ParameterNames.SetEquals(new[] { "*" }) ||
                        parameterNamesSet.SetEquals(sampleKey.ParameterNames)
                    ) &&
                    sampleDirection == sampleKey.SampleDirection
                    )
                {
                    yield return(sample);
                }
            }
        }
 public void GetHashCode_ReturnsDifferent(HelpPageSampleKey key1, HelpPageSampleKey key2)
 {
     Assert.NotEqual(key1.GetHashCode(), key2.GetHashCode());
 }
 public void GetHashCode_ReturnsSame(HelpPageSampleKey key1, HelpPageSampleKey key2)
 {
     Assert.Equal(key1.GetHashCode(), key2.GetHashCode());
 }
 public void Equals_ReturnsFalse(HelpPageSampleKey key1, HelpPageSampleKey key2)
 {
     Assert.False(key1.Equals(key2));
 }