public void ProducesResponseTypeAttribute_WithTypeOnly_DoesNotSetContentTypes() { // Arrange var producesResponseTypeAttribute = new ProducesResponseTypeAttribute(typeof(Person), StatusCodes.Status200OK); // Act and Assert Assert.Null(producesResponseTypeAttribute.ContentTypes); }
public void ProducesResponseTypeAttribute_WithTypeOnly_SetsTypeProperty() { // Arrange var producesResponseTypeAttribute = new ProducesResponseTypeAttribute(typeof(Person), StatusCodes.Status200OK); // Act and Assert Assert.NotNull(producesResponseTypeAttribute.Type); Assert.Same(typeof(Person), producesResponseTypeAttribute.Type); }
public void ProducesResponseTypeAttribute_SetsContentType() { // Arrange var mediaType1 = new StringSegment("application/json"); var mediaType2 = new StringSegment("text/json;charset=utf-8"); var producesContentAttribute = new ProducesResponseTypeAttribute(typeof(void), StatusCodes.Status200OK, "application/json", "text/json;charset=utf-8"); // Assert Assert.Equal(2, producesContentAttribute.ContentTypes.Count); MediaTypeAssert.Equal(mediaType1, producesContentAttribute.ContentTypes[0]); MediaTypeAssert.Equal(mediaType2, producesContentAttribute.ContentTypes[1]); }