public void GetDisplayName_WithGlobalizationSerivce() { var mockglobalizationService = _mockRepository.StrictMock <IGlobalizationService>(); IBusinessObjectBooleanProperty property = CreateProperty( "Scalar", bindableObjectGlobalizationService: new BindableObjectGlobalizationService( mockglobalizationService, MockRepository.GenerateStub <IMemberInformationGlobalizationService>(), MockRepository.GenerateStub <IEnumerationGlobalizationService>(), MockRepository.GenerateStub <IExtensibleEnumGlobalizationService>())); var resourceIdentifierType = typeof(BindableObjectGlobalizationService).GetNestedType("ResourceIdentifier", BindingFlags.NonPublic); var mockResourceManager = _mockRepository.StrictMock <IResourceManager>(); Expect.Call( mockglobalizationService.GetResourceManager(TypeAdapter.Create(resourceIdentifierType))) .Return(mockResourceManager); Expect.Call( mockResourceManager.TryGetString( Arg.Is("Remotion.ObjectBinding.BindableObject.BindableObjectGlobalizationService.True"), out Arg <string> .Out("MockTrue").Dummy)) .Return(true); _mockRepository.ReplayAll(); string actual = property.GetDisplayName(true); _mockRepository.VerifyAll(); Assert.That(actual, Is.EqualTo("MockTrue")); }
public void SetUp() { _stringFormatterService = new BusinessObjectStringFormatterService(); _mockRepository = new MockRepository(); _mockBusinessObject = _mockRepository.StrictMock <IBusinessObject> (); _mockProperty = _mockRepository.StrictMock <IBusinessObjectBooleanProperty> (); }
private string GetStringValueForBooleanProperty(object value, IBusinessObjectBooleanProperty property) { if (value is bool) { return(property.GetDisplayName((bool)value)); } else { return(string.Empty); } }
public override void SetUp() { base.SetUp(); _bocCheckBox = new BocCheckBoxMock(); _bocCheckBox.ID = "BocCheckBox"; NamingContainer.Controls.Add(_bocCheckBox); _businessObject = TypeWithBoolean.Create(); _propertyBooleanValue = (IBusinessObjectBooleanProperty)((IBusinessObject)_businessObject).BusinessObjectClass.GetPropertyDefinition("BooleanValue"); _propertyNullableBooleanValue = (IBusinessObjectBooleanProperty)((IBusinessObject)_businessObject).BusinessObjectClass.GetPropertyDefinition("NullableBooleanValue"); _dataSource = new StubDataSource(((IBusinessObject)_businessObject).BusinessObjectClass); _dataSource.BusinessObject = (IBusinessObject)_businessObject; }
public void GetDefaultValue_NullableScalar() { IBusinessObjectBooleanProperty property = CreateProperty("NullableScalar"); Assert.That(property.GetDefaultValue(_businessObjectClass), Is.Null); }
public BooleanToEnumPropertyConverter(IBusinessObjectBooleanProperty property) { _enumInfoTrue = new BooleanEnumerationValueInfo(true, property); _enumInfoFalse = new BooleanEnumerationValueInfo(false, property); }
public BooleanEnumerationValueInfo(bool value, IBusinessObjectBooleanProperty property) { _value = value; _property = property; }