public void GivenNoEncryptionInputWhenExecuteEncryptCalledThenShowsDialogAndReturns() { this.target.EncryptionInput = string.Empty; this.target.Execute("encrypt"); AssertIt.That( this.mockDialogService.DialogCount, Is.EqualTo(1), "Test failed: dialog should have been called exactly once."); }
public void GivenTrueWhenFalseCheckedThenShouldFail() { var exception = false; try { AssertIt.That(true, Is.False); } catch (AssertFailedException) { exception = true; } Assert.IsTrue(exception, "Test failed: an exception should have been thrown."); }
public void GivenAnIntegerWhenComparedGreatherThanToAGreaterIntegerThenShouldFail() { var exception = false; try { AssertIt.That(2, Is.GreaterThan(3)); } catch (AssertFailedException) { exception = true; } Assert.IsTrue(exception, "Test failed: an exception should have been thrown."); }
public void GivenNullObjectWhenCheckedForNotNullThenShouldFail() { var exception = false; try { AssertIt.That(null, Is.NotNull <object>()); } catch (AssertFailedException) { exception = true; } Assert.IsTrue(exception, "Test failed: an exception should have been thrown."); }
public void GivenAnEmptyStringWhenCheckedForNotNullOrWhitespaceThenShouldFail() { var exception = false; try { AssertIt.That(string.Empty, Is.NotNullOrWhitespace()); } catch (AssertFailedException) { exception = true; } Assert.IsTrue(exception, "Test failed: an exception should have been thrown."); }
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 GivenViewModelWhenCreatedThenListOfAlgorithmsShouldNotBeEmpty() { AssertIt.That(this.target.Algorithms.Count(), Is.GreaterThan(0), "Test failed: list of algorithms should be initialized."); }
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 GivenNoAlgorithmSelectedWhenCanExecuteCalledThenShouldReturnFalse() { this.target.SelectedAlgorithm = null; AssertIt.That(this.target.CanExecute("sign"), Is.False, "Test failed: can execute should be false when no alogirthm is selected."); }
public void GivenTrueWhenTrueCheckedThenShouldSucceed() { AssertIt.That(true, Is.True); }
public void GivenNullParameterWhenCanExecuteCalledThenShouldReturnFalse() { AssertIt.That(this.target.CanExecute(null), Is.False, "Test failed: can execute should be false when parameter is null."); }
public void GivenAnIntegerWhenComparedGreaterThanToALesserIntegerThenShouldSucceed() { AssertIt.That(3, Is.GreaterThan(2)); }
public void GivenCollectionWithNoUnwantedItemsWhenOnlyCalledThenShouldSucceed() { var test = new[] { "abc", "def", "ghi" }; AssertIt.That(test, Has.Only <string[], string>(str => str.Length.IsEqualTo(3))); }
public void GivenAnIntegerWhenComparedEqualToTheSameIntegerThenShouldSucceed() { AssertIt.That(2, Is.EqualTo(2)); }
public void GivenNonNullObjectWhenCheckedForNotNullThenShouldSucceed() { AssertIt.That(new object(), Is.NotNull <object>()); }
public void GivenViewModelWhenCreatedThenDecryptPropertyShouldBePopulated() { AssertIt.That(this.target.DecryptionInput, Is.NotNullOrWhitespace(), "Test failed: decryption input should not be empty."); }
public void GivenViewModelWhenCreatedThenSelectedAlgorithmShouldBeSet() { AssertIt.That(this.target.SelectedAlgorithm, Is.NotNull <ICryptoAlgorithm>(), "Test failed: selected algorithm should not be null."); }
public void GivenANonEmptyStringWhenCheckedForNotNullOrWhitespaceThenShouldSucceed() { AssertIt.That("Test", Is.NotNullOrWhitespace()); }
public void GivenNonNullParameterWhenCanExecuteCalledThenShouldReturnTrue() { AssertIt.That(this.target.CanExecute("sign"), Is.True, "Test failed: can execute should be true when parameter is not whitespace."); }
public void GivenFalseWhenFalseCheckedThenShouldSucceed() { AssertIt.That(false, Is.False); }