public void CreateWithEvaluation() { var expectation = new ArgumentExpectation<int>(_ => _ % 2 == 0); Assert.IsFalse(expectation.IsAny, nameof(expectation.IsAny)); Assert.IsTrue(expectation.IsEvaluation, nameof(expectation.IsEvaluation)); Assert.IsFalse(expectation.IsExpression, nameof(expectation.IsExpression)); Assert.IsFalse(expectation.IsValue, nameof(expectation.IsValue)); Assert.IsNotNull(expectation.Evaluation, nameof(expectation.Evaluation)); Assert.IsNull(expectation.Expression, nameof(expectation.Expression)); Assert.AreEqual(default(int), expectation.Value, nameof(expectation.Value)); }
public void CreateWithValue() { var expectation = new ArgumentExpectation<string>("a"); Assert.IsFalse(expectation.IsAny, nameof(expectation.IsAny)); Assert.IsFalse(expectation.IsEvaluation, nameof(expectation.IsEvaluation)); Assert.IsFalse(expectation.IsExpression, nameof(expectation.IsExpression)); Assert.IsTrue(expectation.IsValue, nameof(expectation.IsValue)); Assert.IsNull(expectation.Evaluation, nameof(expectation.Evaluation)); Assert.IsNull(expectation.Expression, nameof(expectation.Expression)); Assert.AreEqual("a", expectation.Value, nameof(expectation.Value)); }
public void Create() { var expectation = new ArgumentExpectation<int>(); Assert.IsTrue(expectation.IsAny, nameof(expectation.IsAny)); Assert.IsFalse(expectation.IsEvaluation, nameof(expectation.IsEvaluation)); Assert.IsFalse(expectation.IsExpression, nameof(expectation.IsExpression)); Assert.IsFalse(expectation.IsValue, nameof(expectation.IsValue)); Assert.IsNull(expectation.Evaluation, nameof(expectation.Evaluation)); Assert.IsNull(expectation.Expression, nameof(expectation.Expression)); Assert.AreEqual(default(int), expectation.Value, nameof(expectation.Value)); Assert.IsTrue(expectation.IsValid(1, "a"), nameof(expectation.IsValid)); }
public void CreateWithValidValue() { var expectation = new ArgumentExpectation<string>("a"); Assert.IsTrue(expectation.IsValid("a", "a"), nameof(expectation.IsValid)); }
public void CreateWithInvalidNullValue() { var expectation = new ArgumentExpectation<string>("a"); Assert.IsFalse(expectation.IsValid(null, "a"), nameof(expectation.IsValid)); }
public void CreateWithNullValueAndComparedToNotNull() { var expectation = new ArgumentExpectation<string>(null as string); Assert.IsFalse(expectation.IsValid("a", "a"), nameof(expectation.IsValid)); }
public void CreateWithValidEvaluation() { var expectation = new ArgumentExpectation<int>(_ => _ % 2 == 0); expectation.IsValid(2, "a"); }
public void CreateWithInvalidEvaluation() { var expectation = new ArgumentExpectation<int>(_ => _ % 2 == 0); Assert.IsFalse(expectation.IsValid(1, "a"), nameof(expectation.IsValid)); }
public void CreateWithValidValueFromExpression() { var expression = Expression.Call(this.GetType().GetMethod(nameof(ArgumentExpectationOfTTests.GetValue))); var expectation = new ArgumentExpectation<string>(expression); Assert.IsTrue(expectation.IsValid("a", "a"), nameof(expectation.IsValid)); }
public void CreateWithExpression() { var expression = Expression.Call(this.GetType().GetMethod(nameof(ArgumentExpectationOfTTests.GetValue))); var expectation = new ArgumentExpectation<string>(expression); Assert.IsFalse(expectation.IsAny, nameof(expectation.IsAny)); Assert.IsFalse(expectation.IsEvaluation, nameof(expectation.IsEvaluation)); Assert.IsTrue(expectation.IsExpression, nameof(expectation.IsExpression)); Assert.IsFalse(expectation.IsValue, nameof(expectation.IsValue)); Assert.IsNull(expectation.Evaluation, nameof(expectation.Evaluation)); Assert.IsNotNull(expectation.Expression, nameof(expectation.Expression)); Assert.AreEqual(default(string), expectation.Value, nameof(expectation.Value)); }
public void CreateWithValidArrayValue() { var expectation = new ArgumentExpectation<string[]>(new[] { "a" }); Assert.IsTrue(expectation.IsValid(new[] { "a" }, "a"), nameof(expectation.IsValid)); }
public void CreateWithInvalidArrayValueDueToDifferentValues() { var expectation = new ArgumentExpectation<string[]>(new[] { "a" }); Assert.IsFalse(expectation.IsValid(new[] { "b" }, "a"), nameof(expectation.IsValid)); }