示例#1
0
        public EditorToolStrip()
        {
            var dropDown = new ToolStripDropDownButton();
            dropDown.Text = "Style";
            dropDown.Alignment = ToolStripItemAlignment.Right;
            dropDown.DropDownItems.Add("Default");
            dropDown.DropDownItems.Add("GitHub");

            var items = new ToolStripItem[] {
                dropDown,
                new ToolStripMenuItem("Some Button")
            };

            this._dataSourceMock = new Mock<IEditorToolStripDataSource>();
            this._dataSourceMock.Setup(m => m.NumberOfEditorToolStripItems(It.IsAny<Model.EditorToolStrip>()))
                .Returns(items.Length)
                .Verifiable();

            this._dataSourceMock.Setup(m => m.EditorToolStripItemForIndex(It.IsAny<Model.EditorToolStrip>(), It.IsAny<int>()))
                .Returns<Model.EditorToolStrip, int>((inst, index) =>
                {
                    return items[index];
                })
                .Verifiable();

            this._subject = new Model.EditorToolStrip(this._dataSourceMock.Object, null);
        }
示例#2
0
        public EditorToolStrip()
        {
            var dropDown = new ToolStripDropDownButton();

            dropDown.Text      = "Style";
            dropDown.Alignment = ToolStripItemAlignment.Right;
            dropDown.DropDownItems.Add("Default");
            dropDown.DropDownItems.Add("GitHub");

            var items = new ToolStripItem[] {
                dropDown,
                new ToolStripMenuItem("Some Button")
            };

            this._dataSourceMock = new Mock <IEditorToolStripDataSource>();
            this._dataSourceMock.Setup(m => m.NumberOfEditorToolStripItems(It.IsAny <Model.EditorToolStrip>()))
            .Returns(items.Length)
            .Verifiable();

            this._dataSourceMock.Setup(m => m.EditorToolStripItemForIndex(It.IsAny <Model.EditorToolStrip>(), It.IsAny <int>()))
            .Returns <Model.EditorToolStrip, int>((inst, index) =>
            {
                return(items[index]);
            })
            .Verifiable();

            this._subject = new Model.EditorToolStrip(this._dataSourceMock.Object, null);
        }