private BocBooleanValueResourceSet CreateDefaultResourceSet(IBocBooleanValue control) { IResourceManager resourceManager = control.GetResourceManager(); BocBooleanValueResourceSet resourceSet = new BocBooleanValueResourceSet( c_defaultResourceGroup, GetResourceUrl(c_trueIcon), GetResourceUrl(c_falseIcon), GetResourceUrl(c_nullIcon), resourceManager.GetString(BocBooleanValue.ResourceIdentifier.TrueDescription), resourceManager.GetString(BocBooleanValue.ResourceIdentifier.FalseDescription), resourceManager.GetString(BocBooleanValue.ResourceIdentifier.NullDescription) ); return(resourceSet); }
public void SetUp() { Initialize(); _resourceSet = new BocBooleanValueResourceSet( "ResourceKey", "TrueIconUrl", "FalseIconUrl", "NullIconUrl", "DefaultTrueDescription", "DefaultFalseDescription", "DefaultNullDescription" ); _booleanValue = MockRepository.GenerateMock <IBocBooleanValue>(); var clientScriptManagerMock = MockRepository.GenerateMock <IClientScriptManager>(); _booleanValue.Stub(mock => mock.ClientID).Return(c_clientID); _booleanValue.Stub(stub => stub.ControlType).Return("BocBooleanValue"); _booleanValue.Stub(mock => mock.GetValueName()).Return(c_keyValueName); _booleanValue.Stub(mock => mock.GetDisplayValueName()).Return(c_displayValueName); string startupScriptKey = typeof(BocBooleanValueRenderer).FullName + "_Startup_" + _resourceSet.ResourceKey; _startupScript = string.Format( "BocBooleanValue_InitializeGlobals ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}');", _resourceSet.ResourceKey, "true", "false", "null", ScriptUtility.EscapeClientScript(_resourceSet.DefaultTrueDescription), ScriptUtility.EscapeClientScript(_resourceSet.DefaultFalseDescription), ScriptUtility.EscapeClientScript(_resourceSet.DefaultNullDescription), _resourceSet.TrueIconUrl, _resourceSet.FalseIconUrl, _resourceSet.NullIconUrl); clientScriptManagerMock.Expect(mock => mock.RegisterStartupScriptBlock(_booleanValue, typeof(BocBooleanValueRenderer), startupScriptKey, _startupScript)); clientScriptManagerMock.Stub(mock => mock.IsStartupScriptRegistered(Arg <Type> .Is.NotNull, Arg <string> .Is.NotNull)).Return(false); clientScriptManagerMock.Stub(mock => mock.GetPostBackEventReference(_booleanValue, string.Empty)).Return(c_postbackEventReference); _clickScript = "BocBooleanValue_SelectNextCheckboxValue ('ResourceKey', $(this).parent().children('a').children('img').first()[0], " + "$(this).parent().children('span').first()[0], $(this).parent().children('input').first()[0], false, " + "'" + c_trueDescription + "', '" + c_falseDescription + "', '" + c_nullDescription + "');return false;"; _keyDownScript = "BocBooleanValue_OnKeyDown (this);"; var pageStub = MockRepository.GenerateStub <IPage>(); pageStub.Stub(stub => stub.ClientScript).Return(clientScriptManagerMock); _booleanValue.Stub(mock => mock.Value).PropertyBehavior(); _booleanValue.Stub(mock => mock.IsDesignMode).Return(false); _booleanValue.Stub(mock => mock.ShowDescription).Return(true); _booleanValue.Stub(mock => mock.Page).Return(pageStub); _booleanValue.Stub(mock => mock.TrueDescription).Return(c_trueDescription); _booleanValue.Stub(mock => mock.FalseDescription).Return(c_falseDescription); _booleanValue.Stub(mock => mock.NullDescription).Return(c_nullDescription); _booleanValue.Stub(mock => mock.CssClass).PropertyBehavior(); StateBag stateBag = new StateBag(); _booleanValue.Stub(mock => mock.Attributes).Return(new AttributeCollection(stateBag)); _booleanValue.Stub(mock => mock.Style).Return(_booleanValue.Attributes.CssStyle); _booleanValue.Stub(mock => mock.LabelStyle).Return(new Style(stateBag)); _booleanValue.Stub(mock => mock.ControlStyle).Return(new Style(stateBag)); _booleanValue.Stub(stub => stub.CreateResourceSet()).Return(_resourceSet); }
public BocBooleanValueResourceSet CreateResourceSet(IBocBooleanValue control) { ArgumentUtility.CheckNotNull("control", control); return(control.CreateResourceSet() ?? CreateDefaultResourceSet(control)); }