public void SampleRequests_Property()
 {
     HelpPageApiModel model = new HelpPageApiModel();
     ImageSample sample = new ImageSample("http://host/image.png");
     model.SampleRequests.Add(new MediaTypeHeaderValue("text/plain"), sample);
     object sampleRequest;
     model.SampleRequests.TryGetValue(new MediaTypeHeaderValue("text/plain"), out sampleRequest);
     Assert.NotEmpty(model.SampleRequests);
     Assert.Same(sample, sampleRequest);
 }
 public void GetHashCode_ReturnsSrcHashCode()
 {
     ImageSample sample = new ImageSample("http://host/image.png");
     Assert.Equal("http://host/image.png".GetHashCode(), sample.GetHashCode());
 }
 public void ToString_ReturnsSrc()
 {
     ImageSample sample = new ImageSample("http://host/image.png");
     Assert.Equal("http://host/image.png", sample.ToString());
 }
 public void Equals_ReturnsTrue()
 {
     ImageSample sample = new ImageSample("http://host/image.png");
     Assert.Equal(new ImageSample("http://host/image.png"), sample);
 }
 public void Constructor()
 {
     ImageSample sample = new ImageSample("http://host/image.png");
     Assert.Equal("http://host/image.png", sample.Src);
 }
 public void SetSampleForType()
 {
     HttpConfiguration config = new HttpConfiguration();
     ImageSample sample = new ImageSample("http://localhost/test.png");
     config.SetSampleForType(sample, new MediaTypeHeaderValue("image/png"), typeof(string));
     object sampleGeneratorObj;
     config.Properties.TryGetValue(typeof(HelpPageSampleGenerator), out sampleGeneratorObj);
     HelpPageSampleGenerator sampleGenerator = Assert.IsType<HelpPageSampleGenerator>(sampleGeneratorObj);
     Assert.NotEmpty(sampleGenerator.ActionSamples);
     var actionSample = sampleGenerator.ActionSamples.First();
     Assert.Equal(String.Empty, actionSample.Key.ControllerName);
     Assert.Equal(String.Empty, actionSample.Key.ActionName);
     Assert.Equal(new MediaTypeHeaderValue("image/png"), actionSample.Key.MediaType);
     Assert.Null(actionSample.Key.SampleDirection);
     Assert.Empty(actionSample.Key.ParameterNames);
     Assert.Same(sample, actionSample.Value);
 }