public void GetSupportedContentTypes_ThrowsInvalidOperationException_IfMediaTypesListIsEmpty() { // Arrange var formatter = new BadConfigurationFormatter(); // Act & Assert Assert.Throws <InvalidOperationException>( () => formatter.GetSupportedContentTypes("application/json", typeof(object))); }
public void CanRead_ThrowsInvalidOperationException_IfMediaTypesListIsEmpty() { // Arrange var formatter = new BadConfigurationFormatter(); var context = new InputFormatterContext( new DefaultHttpContext(), string.Empty, new ModelStateDictionary(), new EmptyModelMetadataProvider().GetMetadataForType(typeof(object)), (s, e) => new StreamReader(s, e)); // Act & Assert Assert.Throws <InvalidOperationException>(() => formatter.CanRead(context)); }