Grokodile
Grokodile

Reputation: 3933

NUnit / Testdriven.Net conflicting results

When I run this test in NUnit = Red Bar.

    [Test]
    public void ChangingValueViaPropertyDescriptorRaisesPropertyChangedNotification()
    {
        PropertyChangedEventArgs pCEventArgs = null;
        subjectVM.PropertyChanged += (sender, e) => { pCEventArgs = e; };

        PropertyDescriptor descriptor = subjectVM.GetProperties().Find(schoolMeta.Name, false);

        descriptor.SetValue(null, "School's out for summer.");

        Assert.IsNotNull(pCEventArgs);
        Assert.AreEqual("School", pCEventArgs.PropertyName);
    }

However, when I run this test from within Visual Studio with Testdriven.Net it passes (it's also ok when run from a console app).

When it fails with NUnit it's because PropertyChanged is null, subjectVM is a View Model class that inherits PropertyChanged from a base class.

Am I to blame, or am I looking at a NUnit bug?

Upvotes: 0

Views: 168

Answers (1)

Jeff Sternal
Jeff Sternal

Reputation: 48583

Different test harnesses execute tests in different orders: if this test has an implicit dependency on the fixture's execution order, it could be causing this problem (I've been burned by this before).

My best guess is that another test is doing something fishy to subjectVM (or one of its members).

Upvotes: 2

Related Questions