示例#1
0
        public Result PresentationCommand(PresentationAction action)
        {
            switch (action.Command)
            {
                case PresentationAction.NEXT: NextSlide();
                    break;
                case PresentationAction.PREVIOUS: PreviousSlide();
                    break;
                case PresentationAction.CLOSE: ClosePresentation();
                    break;
                case PresentationAction.GOTOSLIDE: GoToSlideNumber(action.Arg);
                    break;
                default:
                    if (WebOperationContext.Current != null)
                        WebOperationContext.Current.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.BadRequest;
                    return new Result("wrong command argument option");
            }

            //WarnSlidePresentationListeners();
            return new Result("Command Executed");
        }
        public void PresentationPreviousCommand()
        {
            Service target = CommonTest.CreateAMockedService();

            var presentationControlMock = new Mock<IPowerPointControl>();
            var kinectControlMock = new Mock<IKinectService>();
            var fileManagerMock = new Mock<IServiceFileManager>();

            Service.PresentationControl = presentationControlMock.Object;
            Service.KinectWindow = kinectControlMock.Object;
            Service.fileManager = fileManagerMock.Object;

            ClassService.PresentationAction action = new ClassService.PresentationAction(ClassService.PresentationAction.PREVIOUS);
            target.PresentationCommand(action);

            presentationControlMock.Verify(x => x.GoToPreviousSlide(), Times.Exactly(1));
        }