[Test] public void NonImplementingWrapper() { IClass c = _emmiter.Class("NonImplemening").In(_namespace).Public; { CreateClassMembers(c); } var t = _emmiter.Generate(c); var sut = t.GetConstructor(new[] { _interface }).Invoke(new object[] { _mock }); var simpleMethod = t.GetMethod(_methodName, new[] { typeof(int) }); Assert.That(simpleMethod.Invoke(sut, new object[] { i }), Is.EqualTo(s)); _mock.AssertWasCalled(x => x.SimpleMethod(i)); }
public void NonImplementingWrapper() { IClass c = _emmiter.Class("NonImplemening").In(_namespace).Public; { CreateClassMembers(c); } var t = _emmiter.Generate(c); var sut = t.GetConstructor(new[] { _interface }).Invoke(new object[] { _mock }); var writeOnlyProperty = t.GetProperty(_propertyName); writeOnlyProperty.SetValue(sut, _expectedValue, null); _mock.AssertWasCalled(x => x.WriteOnlyProperty = _expectedValue); }
public void NonImplementingWrapper() { IClass c = _emmiter.Class("NonImplemening").In(_namespace).Public; { CreateClassMembers(c); } var t = _emmiter.Generate(c); var sut = t.GetConstructor(new[] { _interface }).Invoke(new object[] { _mock }); var readOnlyProperty = t.GetProperty(_propertyName); Assert.That(readOnlyProperty.GetValue(sut, null), Is.EqualTo(_expected)); _mock.AssertWasCalled(x => x.ReadOnlyProperty); }
public void NonImplementingWrapper() { IClass c = _emmiter.Class("NonImplemening").In(_namespace).Public; { CreateClassMembers(c, _emmiter); } var t = _emmiter.Generate(c); var sut = t.GetConstructor(new[] { _interface }).Invoke(new object[] { _mock }); var indexerProperty = t.GetProperty("Item"); Assert.That(indexerProperty.GetValue(sut, new object[] { _i, _s }), Is.EqualTo(_getValue)); _mock.AssertWasCalled(x => x[_i, _s]); indexerProperty.SetValue(sut, _setValue, new object[] { _i, _s }); _mock.AssertWasCalled(x => x[_i, _s] = _setValue); }
public void NonImplementingWrapper() { IClass c = _emmiter.Class("NonImplemening").In(_namespace).Public; { CreateClassMembers(c); } var t = _emmiter.Generate(c); var sut = t.GetConstructor(new[] { _interface }).Invoke(new object[] { _mock }); var simpleMethod = t.GetMethod(_methodName, new[] { typeof(long).MakeByRefType() }); object[] parameters = new object[] { _refParameter }; simpleMethod.Invoke(sut, parameters); _refParameter = (long)parameters[0]; Assert.That(_refParameter, Is.EqualTo(_expectedValue)); _mock.AssertWasCalled(x => x.RefParamMethod(ref _refParameter)); }