在xamarin ios上运行单元测试" NOT"在平行下

时间:2017-07-11 12:25:14

标签: c# unit-testing xamarin xamarin.ios nunit

我的xamarin.ios应用程序上有一个单元测试项目。有没有办法强制单元测试按顺序运行而不是并行运行。

,我不需要任何建议,例如"您应该以独立的方式编写单元测试。"或类似的东西。 我需要的是,"是否可以使用nUnitlite并行运行测试 NOT 。"

[TestFixture]
public class ExpenseTests
{
    string _dbPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "expensemanager.db3");

    public void DbSetup()
    {
        if (File.Exists(_dbPath))
            File.Delete(_dbPath);

        var db = new SQLiteConnection(new SQLitePlatformIOS(), _dbPath);
        db.CreateTable<Category>();
        db.CreateTable<Expense>();

        var category = new Category()
        {
            Name = "category",
            Plan = 20
        };
        category.Upsert();
    }

    [Test]
    [ExpectedException(typeof(InvalidOperationException))]
    public void Create_NegativeValue()
    {
        DbSetup();
        var expense = new Expense()
        {
            CategoryId = _categoryId,
            Description = string.Empty,
            Value = -10
        };
        expense.Upsert();
    }

    [Test]
    [ExpectedException(typeof(InvalidOperationException))]
    public void Create_LongDescription()
    {
        DbSetup();
        string description = string.Empty;
        for (int i = 0; i < 201; i++)
        {
            description += i;
        }
        var expense = new Expense()
        {
            CategoryId = _categoryId,
            Description = description,
            Value = 10
        };
        expense.Upsert();
    }

0 个答案:

没有答案