private static IBusinessObject GetBOWithPropValueSet(IPropDef prop1, DateTime?prop1Value, IPropDef prop2, DateTime?prop2Value) { IBusinessObject bo = MockRepository.GenerateMock <IBusinessObject>(); bo.Stub(busObj => busObj.GetPropertyValue(prop1.PropertyName)).Return(prop1Value); bo.Stub(busObj => busObj.GetPropertyValue(prop2.PropertyName)).Return(prop2Value); return(bo); }
public void Scalar_WithBusinessObjectValue() { var valueStub = MockRepository.GenerateStub <IBusinessObject>(); // Cannot stub ToString() // valueStub.Stub (_=>_.ToString()).Return ("ExpectedStringValue"); _businessObjectStub.Stub(_ => _.GetProperty(_propertyStub)).Return(valueStub); string actual = _stringFormatterService.GetPropertyString(_businessObjectStub, _propertyStub, null); Assert.That(actual, Is.EqualTo(valueStub.ToString())); }
public void SetUp() { _dataSourceBusinessObjectClassStub = MockRepository.GenerateStub <IBusinessObjectClass>(); _dataSourceBusinessObjectClassStub.Stub(stub => stub.Identifier).Return("DataSourceBusinessObjectClass"); _dataSourceStub = MockRepository.GenerateStub <IBusinessObjectDataSource>(); _dataSourceStub.Stub(stub => stub.BusinessObjectClass).Return(_dataSourceBusinessObjectClassStub); _businessObjectBusinessObjectClassStub = MockRepository.GenerateStub <IBusinessObjectClass>(); _businessObjectBusinessObjectClassStub.Stub(stub => stub.Identifier).Return("BusinessObjectBusinessObjectClass"); _businessObjectStub = MockRepository.GenerateStub <IBusinessObject>(); _businessObjectStub.Stub(stub => stub.BusinessObjectClass).Return(_businessObjectBusinessObjectClassStub); _businessObjectWithIdentityStub = MockRepository.GenerateStub <IBusinessObjectWithIdentity>(); _businessObjectWithIdentityStub.Stub(stub => stub.UniqueIdentifier).Return("BusinessObjectIdentifier"); _propertyStub = MockRepository.GenerateStub <IBusinessObjectProperty>(); _propertyStub.Stub(stub => stub.Identifier).Return("BusinessObjectProperty"); }