Example #1
0
        public void BasicGridCreation()
        {
            IGridConfiguration conf = CreateTestConfig();
            IGrid grid = new SquareGrid(conf);

            Assert.AreEqual(conf.ColumnCount, grid.Columns.Count);
            Assert.AreEqual(conf.RowCount, grid.Rows.Count);

            foreach (CellCollection column in grid.Columns)
            {
                for (int i = 0; i < column.Count; i++)
                {
                    Assert.IsNotNull(column[i]);
                    Assert.AreEqual(i, column[i].Row);
                }
            }

            foreach (CellCollection row in grid.Rows)
            {
                for (int i = 0; i < row.Count; i++)
                {
                    Assert.IsNotNull(row[i]);
                    Assert.AreEqual(i, row[i].Column);
                }
            }
        }
Example #2
0
        public void ShiftColumnDown()
        {
            IGridConfiguration conf = CreateTestConfig();
            IGrid grid = new SquareGrid(conf);

            List <ICellContent> contents = new List <ICellContent>(conf.ColumnCount * conf.RowCount);

            FillColumnContents(grid, contents);

            Assert.AreSame(contents[0], grid.Columns[0][0].Content);
            Assert.AreSame(contents[1], grid.Columns[0][1].Content);
            ICellContent firstRowContent = grid.Columns[0][0].Content;

            grid.Accept(new ColumnDownShifter(0, 3));

            Assert.AreSame(firstRowContent, grid.Columns[0][3].Content);

            grid.Accept(new ColumnDownShifter(0, 10));

            Assert.AreSame(firstRowContent, grid.Columns[0][3].Content);

            grid.Accept(new ColumnDownShifter(0, 13));

            Assert.AreSame(firstRowContent, grid.Columns[0][1].Content);
        }
Example #3
0
 public ProductService(IProductRepository productRepository,
                       IUnitOfWork unitOfWork,
                       IGridConfiguration gridConfiguration)
     : base(productRepository, unitOfWork)
 {
     _gridConfiguration = gridConfiguration;
 }
Example #4
0
        IGridConfiguration CreateTestConfig()
        {
            IGridConfiguration conf = Substitute.For <IGridConfiguration>();

            conf.ColumnCount.Returns(5);
            conf.RowCount.Returns(5);
            return(conf);
        }
Example #5
0
        public SquareGrid(IGridConfiguration config)
        {
            columnCount = config.ColumnCount;

            CreateCells(config.ColumnCount, config.RowCount);
            BuildColumns(config.ColumnCount, config.RowCount);
            BuildRows(config.ColumnCount, config.RowCount);
        }
Example #6
0
        public void SetGridCellContent()
        {
            IGridConfiguration conf = CreateTestConfig();
            IGrid grid = new SquareGrid(conf);

            ICellContent content = Substitute.For <ICellContent>();

            Cell.Cell cell = grid.GetCell(0, 0);
            cell.Content = content;

            Assert.AreEqual(content, grid.GetCell(0, 0).Content);
        }
Example #7
0
 public AccountService(IAccountRepository accountRepository,
                       UserManager <AppUser> userManager,
                       RoleManager <IdentityRole> roleManager,
                       SignInManager <AppUser> signInManager,
                       IGridConfiguration gridConfiguration,
                       IHttpContextAccessor contextAccessor)
 {
     _accountRepository = accountRepository;
     _userManager       = userManager;
     _roleManager       = roleManager;
     _signInManager     = signInManager;
     _gridConfiguration = gridConfiguration;
     _contextAccessor   = contextAccessor;
 }
 public SquareGridWithRandomContent(IRandomContentProvider randomContentProvider, IGridConfiguration gridConfig)
 {
     this.randomContentProvider = randomContentProvider;
     this.gridConfig            = gridConfig;
 }
Example #9
0
 public SquareGridWithGridVisualContent(IInstantiatableCellContent visualContent, IGridConfiguration gridConfig)
 {
     this.visualContent = visualContent;
     this.gridConfig    = gridConfig;
 }