Esempio n. 1
0
        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.");
        }
Esempio n. 2
0
 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));
 }
Esempio n. 3
0
        public void GivenCollectionWithNoUnwantedItemsWhenOnlyCalledThenShouldSucceed()
        {
            var test = new[] { "abc", "def", "ghi" };

            AssertIt.That(test, Has.Only <string[], string>(str => str.Length.IsEqualTo(3)));
        }