public void GivenCollectionWithUnwantedItemWhenOnlyCalledThenShouldFail() { var exception = false; try { var test = new[] { "abc", "def", "gh" }; AssertIt.That(test, Has.Only <string[], string>(str => str.Length.IsEqualTo(3))); } catch (AssertFailedException) { exception = true; } Assert.IsTrue(exception, "Test failed: an exception should have been thrown."); }
public void GivenIsSymmetricFilterSelectedWhenAlgorithmListRequestedThenOnlyContainsSymmetricAlgorithms() { this.target.Symmetric = true; AssertIt.That(this.target.Algorithms.Count(), Is.GreaterThan(0), "Test failed: the filter should return some algorithms."); AssertIt.That(this.target.Algorithms, Has.Only <IEnumerable <ICryptoAlgorithm>, ICryptoAlgorithm>(crypto => crypto.IsSymmetric)); }
public void GivenCollectionWithNoUnwantedItemsWhenOnlyCalledThenShouldSucceed() { var test = new[] { "abc", "def", "ghi" }; AssertIt.That(test, Has.Only <string[], string>(str => str.Length.IsEqualTo(3))); }