Creating iOS UI components from NUnit test code
问题 I'm trying to write a unit test for some code that programmatically creates UIButtons, but when I call this code from the test, I get a NullReferenceException . Stepping through in the debugger, it looks like UIButton.FromType() returns null. Here's the method I'm testing: public UIButton makeButton (String title, Action<IWelcomeController> action) { UIButton button = UIButton.FromType (UIButtonType.RoundedRect); // button is null here button.SetTitle(title, UIControlState.Normal); button