English 中文(简体)
创建乌克兰国家免疫联盟测试守则中的本组织组成部分
原标题:Creating iOS UI components from NUnit test code

我试图写一下某些法典的单位测试,这些守则在方案上制造了UIButtons,但在我从测试中称之为该守则时,我收到了一个<代码>NullReferenceException。 在挖尸房时,它看上去的是<条码>。

这里的方法是:

    public UIButton makeButton (String title, Action<IWelcomeController> action)
    {
        UIButton button = UIButton.FromType (UIButtonType.RoundedRect);
        // button is null here
        button.SetTitle(title, UIControlState.Normal);
        button.TouchUpInside += (sender, e) => {
            action(controller);
        };
        return button;
    }

这里使用的是试验方法:

    [Test()]
    public void TestMakeButtonTitle ()
    {
        String title = "Elvis";
        UIButton button = GetFactory().makeButton(title, delegate(IWelcomeController w) {});
        Assert.AreEqual(title, button.Title(UIControlState.Normal));
    }

我在那里进行猜测,我需要做一些魔术,以便获得莫托万。 TUKit在实际应用之外工作。 任何方面? (如果没有可能,建议采取替代做法?)

最佳回答

在这一点上,基本问题是,如果你不上Pi或Pisimulator,那么根本问题就是说,没有必要的本地人转播该部件。

也许有一天的人将编辑Unit用于Monotouch,并撰写一个SOS探测器。

问题回答

我会假定你会把联尼特项目增列到你独一无二的解决方案中,并提及单一项目。

似乎不知道在什么地方用莫托什.来补充这些信,以提及你们的尼特。 可见:

~/Developer/Monotouch/usr/lib/mono/<version>

这应当解决你的问题。

也许有一天的人将编辑Unit用于Monotouch,并撰写一个SOS探测器。

如今已有这种runner,甚至有最新的Mono Touch 5.1.x(beta)排放的船舶。





相关问题
How do I ignore a test based on another test in NUnit?

I m writing some NUnit tests for database operations. Obviously, if Add() fails, then Get() will fail as well. However, it looks deceiving when both Add() and Get() fail because it looks like there s ...

result.viewname is always string.empty

I cannot seem to return the result.ViewName for use in Nunit tests as it always returns string.empty. I have explicitly set the name of the view inside my controller and would expect the test to pick ...

C#: How to test a basic threaded worker class

I m dipping my toes in how to test multi-threaded stuff, but not quite sure how to get started. I m sure I will figure more stuff out easier if I could just get stuff going, so I was wondering if ...

Selenium Grid with parallel testing using C#/NUnit

I ve got several unit tests written with NUnit that are calling selenium commands. I ve got 2 win2k3 server boxes setup, one is running selenium grid hub along with 2 selenium rc s. The other box is ...

Code coverage with nUnit? [closed]

Is there a way to see the code coverage when using nUnit? I know there s such a feature in Visual Studio, but can you use it with nUnit or only with the built-in vs unit tests?

Unit testing database-dependent Window services

We have a set of services in .NET 3.5C# and WCF. The NUnit tests need the services to be running and listening for requests. The services need an updated SQL database to be ready for connection. ...

TeamCity NUnit test result visualisation

Is there any way to produce visual results of NUnit tests from within TeamCity s "Tests" tab, currently my NAnt script outputs an .xml file of the results using the following task: <nunit2 ...

热门标签