public void ShouldInitializeModelsCorrectly()
 {
     Chair chairModel = new Chair();
     Table tableModel = new Table();
     ArrangementPageViewModel vm = new ArrangementPageViewModel(Layout, chairModel, tableModel);
     Assert.AreEqual(chairModel, vm.ChairModel);
     Assert.AreEqual(tableModel, vm.TableModel);
 }
            public void ShouldInitializeDimensionsCorrectly()
            {
                Chair chairModel = new Chair();
                Table tableModel = new Table();
                ArrangementPageViewModel vm = new ArrangementPageViewModel(Layout, chairModel, tableModel);

                Assert.AreEqual(2, vm.Rows);
                Assert.AreEqual(3, vm.Columns);
            }
            public void ShouldInitializeNonFunitureCorrectly()
            {
                Chair chairModel = new Chair();
                Table tableModel = new Table();
                ArrangementPageViewModel vm = new ArrangementPageViewModel(Layout, chairModel, tableModel);

                Assert.IsTrue(vm.Arrangement
                    .Where(arrangement => !((arrangement.PlaceHolder is FurnitureField) || (arrangement.PlaceHolder is EmptySpaceField)))
                    .All(arrangement => arrangement.ArrangedItems.Any()));
            }
            public void ShouldClearArrangedModels()
            {
                Chair chairModel = new Chair();
                Table tableModel = new Table();
                ArrangementPageViewModel vm = new ArrangementPageViewModel(Layout, chairModel, tableModel);
                vm.Arrangement[0].ArrangeObjectCommand.Execute(chairModel);
                vm.Arrangement[1].ArrangeObjectCommand.Execute(tableModel);

                Assert.IsTrue(vm.ClearAllCommand.CanExecute(null));
                vm.ClearAllCommand.Execute(null);
                Assert.AreEqual(null, vm.Arrangement[0].ArrangedItems.FirstOrDefault());
                Assert.AreEqual(null, vm.Arrangement[1].ArrangedItems.FirstOrDefault());
            }
 public override IStateViewModel GetNextState()
 {
     ArrangementPageViewModel result = new ArrangementPageViewModel(this.layout, new Chair(this.SelectedBrand), new Table(this.SelectedBrand));
     return result;
 }
            public void ShouldFillAllEmptyFields1()
            {
                Chair chairModel = new Chair();
                Table tableModel = new Table();
                ArrangementPageViewModel vm = new ArrangementPageViewModel(Layout, chairModel, tableModel);

                Assert.AreEqual(null, vm.Arrangement[0].ArrangedItems.FirstOrDefault());
                Assert.AreEqual(null, vm.Arrangement[1].ArrangedItems.FirstOrDefault());

                Assert.IsTrue(vm.FillAllCommand.CanExecute(null));
                vm.FillAllCommand.Execute(null);

                Assert.IsTrue(vm.Arrangement[0].ArrangedItems.First() is Chair);
                Assert.IsTrue(vm.Arrangement[1].ArrangedItems.First() is Table);
            }
            public void ShouldBeDisabledForNonFurniture2()
            {
                Chair chairModel = new Chair();
                Table tableModel = new Table();
                ArrangementPageViewModel vm = new ArrangementPageViewModel(Layout, chairModel, tableModel);

                ArrangedFieldViewModel field = new ArrangedFieldViewModel(new FlowerField());
                field.ArrangeObjectCommand.Execute(new Pathway());
                Assert.IsFalse(vm.RemoveObjectCommand.CanExecute(field));
            }
            public void ShouldNotReplaceFilledFields()
            {
                Chair chairModel = new Chair();
                Table tableModel = new Table();
                ArrangementPageViewModel vm = new ArrangementPageViewModel(Layout, chairModel, tableModel);

                vm.Arrangement[0].ArrangeObjectCommand.Execute(chairModel);
                vm.FillAllCommand.Execute(null);

                Assert.AreEqual(chairModel, vm.Arrangement[0].ArrangedItems.First());
                Assert.IsTrue(vm.Arrangement[1].ArrangedItems.First() is Table);
                Assert.IsFalse(vm.Arrangement[1].ArrangedItems.First() == tableModel);
            }
            public void ShouldFillAllEmptyFields2()
            {
                Chair chairModel = new Chair();
                Table tableModel = new Table();
                ArrangementPageViewModel vm = new ArrangementPageViewModel(Layout, chairModel, tableModel);

                Assert.AreEqual(null, vm.Arrangement[0].ArrangedItems.FirstOrDefault());
                Assert.AreEqual(null, vm.Arrangement[1].ArrangedItems.FirstOrDefault());

                Assert.IsTrue(vm.FillAllCommand.CanExecute(null));
                vm.FillAllCommand.Execute(null);

                Assert.IsTrue(vm.Arrangement[0].ArrangedItems.First() is Chair);
                Assert.IsTrue(vm.Arrangement[1].ArrangedItems.First() is Table);

                Assert.IsFalse(vm.Arrangement.Any(a => !(a.PlaceHolder is FurnitureField) && a.ArrangedItems.Any(item => item is FurnitureItem)));
            }