Exemple #1
0
        public void SaveDataCommandExecute_AreSoundBoardsChangedReturnsTrue_QuestionDialogIsCalled()
        {
            //Arrange
            ISoundBoardRepository stub = MockRepository.GenerateStub <ISoundBoardRepository>();

            stub.Stub(repository => repository.AreSoundBoardsDifferent(null)).IgnoreArguments().Return(true);

            IDialogService mock = MockRepository.GenerateMock <IDialogService>();

            mock.Expect(service => service.QuestionDialog(null, null, null))
            .IgnoreArguments()
            .Return(false);

            Target = CreateTarget(dialogService: mock, soundBoardRepository: stub);

            //Act
            Target.Commands.ShutdownAppCommand.Execute(null);

            //Assert
            mock.VerifyAllExpectations();
        }
Exemple #2
0
        public void SaveDataCommandExecute_QuestionDialogResultIsTrue_DoesNotCallSaveSoundBoards()
        {
            //Arrange
            IDialogService stub = MockRepository.GenerateStub <IDialogService>();

            stub.Stub(service => service.QuestionDialog(null, null, null)).IgnoreArguments().Return(true);

            ISoundBoardRepository mock = MockRepository.GenerateMock <ISoundBoardRepository>();

            mock.Stub(repository => repository.AreSoundBoardsDifferent(null)).IgnoreArguments().Return(true);
            mock.Expect(repository => repository.SetSoundBoards(null)).IgnoreArguments()
            .Repeat.Once();

            Target = CreateTarget(dialogService: stub, soundBoardRepository: mock);

            //Act
            Target.Commands.ShutdownAppCommand.Execute(null);

            //Assert
            mock.VerifyAllExpectations();
        }