public void CanRemoveProgram_ShouldReturnTrueIfProgramIsNotRunning() { var program = new Mock <IProgram>().Object; programServiceMock.Setup(x => x.GetProgram(program.Id)).Returns(program); programExecutionService.Setup(x => x.IsProgramRunning(program)).Returns(false); Assert.True(programService.CanRemoveProgram(program.Id)); }
private void onProgramItemRemoval(object sender, ProgramListItemEventArgs e) { if (programService.CanRemoveProgram(e.Item.Id) == false) { notificationService.ShowWarningMessageBox("Cannot remove the program. It is probably actively used by some robot."); return; } Programs.Remove(e.Item); programService.RemoveProgram(e.Item.Id); ProgramRemove?.Invoke(this, e); }