Example #1
0
        public TrayMenu()
        {
            this._dataSourceMock = new Mock<ITrayMenuDataSource>();

            this._dataSourceMock.Setup(d => d.NumberOfToolStripItems(It.IsAny<Model.TrayMenu>()))
                .Returns(2)
                .Verifiable();

            this._dataSourceMock.Setup(d => d.ToolStripItemForIndex(It.IsAny<Model.TrayMenu>(), It.IsInRange<int>(0, 1, Range.Inclusive)))
                .Returns<Model.TrayMenu, int>((inst, index) =>
                {
                    return new ToolStripMenuItem("Item " + index.ToString());
                }).Verifiable();

            this._subject = new Model.TrayMenu(this._dataSourceMock.Object);
        }
Example #2
0
        public TrayMenu()
        {
            this._dataSourceMock = new Mock <ITrayMenuDataSource>();

            this._dataSourceMock.Setup(d => d.NumberOfToolStripItems(It.IsAny <Model.TrayMenu>()))
            .Returns(2)
            .Verifiable();

            this._dataSourceMock.Setup(d => d.ToolStripItemForIndex(It.IsAny <Model.TrayMenu>(), It.IsInRange <int>(0, 1, Range.Inclusive)))
            .Returns <Model.TrayMenu, int>((inst, index) =>
            {
                return(new ToolStripMenuItem("Item " + index.ToString()));
            }).Verifiable();

            this._subject = new Model.TrayMenu(this._dataSourceMock.Object);
        }