public void GetValue_WithIndexerProperty_OneParameter_IndexParameterArrayLengthMismatch() { var instanceStub = MockRepository.GenerateStub <IInterfaceWithReferenceType <SimpleReferenceType> >(); var interfaceDeclarationProperty = typeof(IInterfaceWithReferenceType <SimpleReferenceType>).GetProperty("Item", new[] { typeof(int) }); _implicitInterfaceAdapter = PropertyInfoAdapter.Create(interfaceDeclarationProperty); _implicitInterfaceAdapter.GetValue(instanceStub, new object[0]); }
public void GetValue_WithIndexerProperty_TwoParameters_IndexParameterArrayNull() { var instanceStub = MockRepository.GenerateStub <IInterfaceWithReferenceType <SimpleReferenceType> >(); var interfaceDeclarationProperty = typeof(IInterfaceWithReferenceType <SimpleReferenceType>) .GetProperty("Item", new[] { typeof(int), typeof(DateTime) }); _implicitInterfaceAdapter = PropertyInfoAdapter.Create(interfaceDeclarationProperty); _implicitInterfaceAdapter.GetValue(instanceStub, null); }
public void GetValue_WithIndexerProperty_OneParameter() { var scalar = new SimpleReferenceType(); var instanceMock = MockRepository.GenerateMock <IInterfaceWithReferenceType <SimpleReferenceType> >(); instanceMock.Expect(mock => mock[10]).Return(scalar); instanceMock.Replay(); var interfaceDeclarationProperty = typeof(IInterfaceWithReferenceType <SimpleReferenceType>).GetProperty("Item", new[] { typeof(int) }); _implicitInterfaceAdapter = PropertyInfoAdapter.Create(interfaceDeclarationProperty); object actualScalar = _implicitInterfaceAdapter.GetValue(instanceMock, new object[] { 10 }); Assert.That(actualScalar, Is.SameAs(scalar)); instanceMock.VerifyAllExpectations(); }
private void AssertCanSet(PropertyInfoAdapter adapter, object instance, SimpleReferenceType value) { adapter.SetValue(instance, value, null); Assert.That(adapter.GetValue(instance, null), Is.SameAs(value)); }