public void InvokeNull_NotRaiseException() { var left = MockComplexSpecification.True(); var right = MockComplexSpecification.True(); var sut = new AndSpecification <object>(left, right); var exception = Record.Exception(() => sut.GetExpression().Compile().Invoke(null)); Assert.Null(exception); }
public void InvokeIncorrectData_ReturnFalse(bool leftResult, bool rightResult) { var left = MockComplexSpecification.Create(leftResult); var right = MockComplexSpecification.Create(rightResult); var sut = new AndSpecification <object>(left, right); var result = sut.GetExpression().Compile().Invoke(new object()); Assert.False(result); }
public void NonGenericILinqSpecification_ReturnExpressionAsAbstractExpression() { var left = MockSpecification.True(); var right = MockSpecification.True(); var sut = new AndSpecification <object>(left, right); var expected = sut.GetExpression(); var result = ((ILinqSpecification)sut).GetExpression(); Assert.Equal(expected, result); }
public void CastCorrectSpecification_ReturnAndExpression() { var left = MockSpecification.True(); var right = MockSpecification.True(); var sut = new AndSpecification <object>(left, right); var expected = sut.GetExpression(); var result = (Expression)sut; Assert.Equal(expected, result); }
public void CorrectSpecifications_ReturnAndExpression() { var left = MockSpecification.True(); var right = MockSpecification.True(); var sut = new AndSpecification <object>(left, right); var expression = sut.GetExpression(); var result = expression.ToString(); Assert.Matches(@"candidate => \(.*\.IsSatisfiedBy\(candidate\) AndAlso .*.IsSatisfiedBy\(candidate\)\)", result); }
public void DifferentTypesSpecifications_ReplaceCandidateParameterToObjInExpression() { var left = MockComplexSpecification.True(); var right = MockSpecification.True(); var sut = new AndSpecification <object>(left, right); var expression = sut.GetExpression(); var result = expression.ToString(); Assert.Matches( @"obj => \(value\(FluentSpecification.Core.Tests.Mocks.TrueMockComplexSpecification\).IsSatisfiedBy\(obj\) AndAlso .*\.IsSatisfiedBy\(obj\)\)", result); }
public void InvokeRelatedTypes_NoException() { var left = MockSpecification <IEnumerable <char> > .True(); var right = MockSpecification <ChildFakeType> .True(); var exception = Record.Exception(() => { var sut = new AndSpecification <ChildFakeType>(left, right); sut.GetExpression().Compile().Invoke(new ChildFakeType()); }); Assert.Null(exception); }