public void ContextualHandler_Throws_InvalidCastException_If_No_Result_Assigned() { // Arrange ValueExtractor extractor = ValueExtractor.Create(config => { config.UseHandler <string>( (obj, ctx) => { }); }); // Act TestDelegate test = () => extractor.Extract <string>(""); // Assert Assert.That(test, Throws.TypeOf <InvalidCastException>()); }