public void ShouldComplainIfOperableIsNotAlsoOfTypeIDeclaration() { var operableOnly = mocks.DynamicMock <IOperable <MyClass> >(); Assert.Throws <ArgumentException>(() => { OperableExtensions.With(operableOnly, x => x.StringOne = "test"); }); }
public void ShouldComplainIfOperableIsNotAlsoOfTypeIDeclaration() { var operableOnly = Substitute.For <IOperable <MyClass> >(); Should.Throw <ArgumentException>(() => { OperableExtensions.With(operableOnly, x => x.StringOne = "test"); }); }
public void ShouldBeAbleToUseWithToSetPrivateProperties() { using (mocks.Record()) { operable.Expect(x => x.ObjectBuilder).Return(new ObjectBuilder <MyClass>(null)); objectBuilder.Expect(x => x.With(propertyExpression, 100)); } OperableExtensions.With((IOperable <MyClass>)operable, propertyExpression, 100); }
public void ShouldBeAbleToUseAnd() { using (mocks.Record()) { operable.Expect(x => x.ObjectBuilder).Return(new ObjectBuilder <MyClass>(null)); objectBuilder.Expect(x => x.With(func)); } OperableExtensions.And((IOperable <MyClass>)operable, func); }
public void ShouldBeAbleToUseWith() { var builderSetup = new BuilderSettings(); { operable.ObjectBuilder.Returns(new ObjectBuilder <MyClass>(null, builderSetup)); objectBuilder.With(func); } OperableExtensions.With((IOperable <MyClass>)operable, func); }
public void ShouldBeAbleToUseAndToSetPrivateProperties() { var builderSetup = new BuilderSettings(); { operable.ObjectBuilder.Returns(new ObjectBuilder <MyClass>(null, builderSetup)); objectBuilder.With(propertyExpression, 100); } OperableExtensions.And((IOperable <MyClass>)operable, propertyExpression, 100); }
public void ShouldBeAbleToUseAndToAddAnAction() { Action <MyClass> action = x => x.DoSomething(); { operable.ObjectBuilder.Returns(objectBuilder); objectBuilder.Do(action).Returns(objectBuilder); } OperableExtensions.And((IOperable <MyClass>)operable, action); }
public void ShouldBeAbleToUseHasDoneToIt() { Action <MyClass, int> action = (x, y) => x.DoSomething(); using (mocks.Record()) { operable.Expect(x => x.ObjectBuilder).Return(objectBuilder); objectBuilder.Expect(x => x.Do(action)).Return(objectBuilder); } OperableExtensions.With((IOperable <MyClass>)operable, action); }
public void ShouldBeAbleToUseAndWithAnIndex() { Action <MyClass, int> funcWithIndex = (x, idx) => x.StringOne = "String" + (idx + 5); using (mocks.Record()) { operable.Expect(x => x.ObjectBuilder).Return(new ObjectBuilder <MyClass>(null)); objectBuilder.Expect(x => x.With(funcWithIndex)); } OperableExtensions.And((IOperable <MyClass>)operable, funcWithIndex); }
public void ShouldBeAbleToUseHasDoneToIt() { Action <MyClass, int> action = (x, y) => x.DoSomething(); { operable.ObjectBuilder.Returns(objectBuilder); objectBuilder.Do(action).Returns(objectBuilder); } OperableExtensions.With((IOperable <MyClass>)operable, action); }
public void ShouldBeAbleToUseHas() { var builderSetup = new BuilderSetup(); using (mocks.Record()) { operable.Expect(x => x.ObjectBuilder).Return(new ObjectBuilder <MyClass>(null, builderSetup)); objectBuilder.Expect(x => x.With(func)); } OperableExtensions.Has((IOperable <MyClass>)operable, func); }
public void ShouldBeAbleToUseAndToSetPrivateProperties() { var builderSetup = new BuilderSettings(); using (mocks.Record()) { operable.Expect(x => x.ObjectBuilder).Return(new ObjectBuilder <MyClass>(null, builderSetup)); objectBuilder.Expect(x => x.With(propertyExpression, 100)); } OperableExtensions.And((IOperable <MyClass>)operable, propertyExpression, 100); }
public void ShouldBeAbleToUseAndToAddAnAction() { Action <MyClass> action = x => x.DoSomething(); using (mocks.Record()) { operable.Expect(x => x.ObjectBuilder).Return(objectBuilder); objectBuilder.Expect(x => x.Do(action)).Return(objectBuilder); } OperableExtensions.And((IOperable <MyClass>)operable, action); }
public void ShouldBeAbleToUseWith_WithAnIndex() { var builderSetup = new BuilderSettings(); Action <MyClass, int> funcWithIndex = (x, idx) => x.StringOne = "String" + (idx + 5); { operable.ObjectBuilder.Returns(new ObjectBuilder <MyClass>(null, builderSetup)); objectBuilder.With(funcWithIndex); } OperableExtensions.With((IOperable <MyClass>)operable, funcWithIndex); }
public void ShouldBeAbleToUseHasDoneToItForAll() { var simpleClasses = new List <SimpleClass>(); Action <MyClass, SimpleClass> action = (x, y) => x.Add(y); using (mocks.Record()) { operable.Expect(x => x.ObjectBuilder).Return(objectBuilder); objectBuilder.Expect(x => x.DoMultiple(action, simpleClasses)).Return(objectBuilder); } OperableExtensions.HasDoneToItForAll((IOperable <MyClass>)operable, action, simpleClasses); }
public void ShouldBeAbleToUseHasDoneToItForAll() { var simpleClasses = new List <SimpleClass>(); Action <MyClass, SimpleClass> action = (x, y) => x.Add(y); { operable.ObjectBuilder.Returns(objectBuilder); objectBuilder.DoMultiple(action, simpleClasses).Returns(objectBuilder); } OperableExtensions.DoForEach((IOperable <MyClass>)operable, action, simpleClasses); }
public void ShouldComplainIfOperableIsNotAlsoOfTypeIDeclaration() { var operableOnly = mocks.DynamicMock <IOperable <MyClass> >(); OperableExtensions.With(operableOnly, x => x.StringOne = "test"); }