Testing if a collection contains objects based on a particular property

You could use LINQ: Assert.That(people.Any(p => p.Name == “joe”)); or, if you want to be explicit about there being exactly one person with each name: Assert.That(people.Count(p => p.Name == “joe”), Is.EqualTo(1)); If you want a better error message than “Assertion failed, expected true, was false”, you could create your own assert method. For several collection-related … Read more

NUnit – cleanup after test failure

Since version 2.5.7, NUnit allows Teardown to detect if last test failed. A new TestContext class allows tests to access information about themselves including the TestStauts. For more details, please refer to http://nunit.org/?p=releaseNotes&r=2.5.7 [TearDown] public void TearDown() { if (TestContext.CurrentContext.Result.Status == TestStatus.Failed) { PerformCleanUpFromTest(); } }

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)