nunit / testdriven.net矛盾する結果
-
02-10-2019 - |
質問
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);
}
ただし、Testdriven.netを使用してVisual Studio内からこのテストを実行すると、合格します(コンソールアプリから実行するとも問題ありません)。
nunitで失敗すると、PropertyChangedがnullであるため、SubjectVMは基本クラスからプロパティチェンジを継承するビューモデルクラスです。
私は責任がありますか、それともヌニットのバグを見ていますか?
解決
異なるテストハーネスは、異なる注文でテストを実行します:このテストがフィクスチャーの実行順序に暗黙の依存性を持っている場合、この問題を引き起こす可能性があります(私はこれにより以前に焼かれました)。
私の最善の推測は、別のテストが怪しい何かをしているということです subjectVM
(またはの1つ これは メンバー)。
所属していません StackOverflow