Exemple #1
0
        public IEditableTextBox Build(string data, ITextBoxPropertiesStyle regularStyle, ITextBoxPropertiesStyle inEditStyle)
        {
            var textBox           = _textBoxWrapperFactory.Create();
            var swappableStrategy = _swappableStrategyFactory.Create(regularStyle, inEditStyle);

            textBox.Text        = data;
            textBox.Dock        = DockStyle.Fill;
            textBox.Anchor      = AnchorStyles.Left;
            textBox.BorderStyle = BorderStyle.None;
            var result = _editableTextBoxFactory.Create(textBox, swappableStrategy, EditableStatus.Regular);

            return(result);
        }
Exemple #2
0
        public void Build_CorrectCallsMade()
        {
            const string data              = "test";
            var          regularStyle      = A.Fake <ITextBoxPropertiesStyle>();
            var          inEditStyle       = A.Fake <ITextBoxPropertiesStyle>();
            var          swappableStrategy = A.Fake <ISwappableTextboxStrategy>();
            var          textBox           = A.Fake <ITextBoxWrapper>();

            A.CallTo(() => _swappableStrategyFactory.Create(regularStyle, inEditStyle)).Returns(swappableStrategy);
            A.CallTo(() => _textBoxWrapperFactory.Create()).Returns(textBox);

            _editableTextBoxBoxBuilder.Build(data, regularStyle, inEditStyle);

            A.CallToSet(() => textBox.Text).To(data).MustHaveHappened();
            A.CallToSet(() => textBox.Dock).To(DockStyle.Fill).MustHaveHappened();
            A.CallToSet(() => textBox.Anchor).To(AnchorStyles.Left).MustHaveHappened();
            A.CallToSet(() => textBox.BorderStyle).To(BorderStyle.None).MustHaveHappened();
            A.CallTo(() => _editableTextBoxFactory.Create(textBox, swappableStrategy, EditableStatus.Regular))
            .MustHaveHappened();
        }