public void ToNextBlockNumber_ExecuteThisMethodOutOfIndex_CatchOutOfRangeException() { //Assign ViewModel = new BlockConditionsWindowViewModel(); //Act var actual = Assert.Catch <IndexOutOfRangeException>(() => ViewModel.ToNextBlockNumber()).Message; //Assert StringAssert.Contains("add new BlockCondition", actual); }
public void ToNextBlockNumber_OutOfIndexThenAddItem_AddedNewItemAndCurrentBlockMoveToNewItem() { //Assign ViewModel = new BlockConditionsWindowViewModel(); ViewModel._dialogService = new StubDialogServiceAlwaysYes(); string actualIndex; string expectIndex; //Act ViewModel.ToNextBlockNumber(); actualIndex = ViewModel.CurrentblockConditionModel.BlockNo; expectIndex = Convert.ToString(ViewModel.BlockConditionModelList.Count - 1); //Assert Assert.AreEqual(expectIndex, actualIndex); }
public void ToNextBlockNumber_OutOfIndexAndNoAddNewBlock_NoNewItemAndKeepCurrentBlock() { //Assign ViewModel = new BlockConditionsWindowViewModel(); ViewModel._dialogService = new StubDialogServiceAlwaysNo(); string actualIndex; string expectedIndex; //Act ViewModel.ToNextBlockNumber(); actualIndex = ViewModel.CurrentblockConditionModel.BlockNo; expectedIndex = Convert.ToString(ViewModel.BlockConditionModelList.Count - 1); //Assert Assert.AreEqual(expectedIndex, actualIndex); }
public void ToNextBlockNumber_InIndexOfList_CurrentBlockMoveToNextOneInList() { //Assign ViewModel = new BlockConditionsWindowViewModel(); string actual; string expect; //Act expect = Convert.ToString(int.Parse(ViewModel.CurrentblockConditionModel.BlockNo) + 1); ViewModel.AddNewBlockConditionInList(); ViewModel.ToNextBlockNumber(); actual = ViewModel.CurrentblockConditionModel.BlockNo; //Assert Assert.AreEqual(expect, actual); }
public void ToNextBlockNumber_OutOfIndexThenAddItem_AddedNewItemWhichHasTheSameProgramNo() { //Assign ViewModel = new BlockConditionsWindowViewModel(); ViewModel._dialogService = new StubDialogServiceAlwaysYes(); string actual; string expect; //Act ViewModel.CurrentblockConditionModel.ProgramNo = "0010"; ViewModel.ToNextBlockNumber(); actual = ViewModel.CurrentblockConditionModel.ProgramNo; expect = "0010"; //Assert Assert.AreEqual(expect, actual); }