Beispiel #1
0
        protected ViewModelBase()
        {
            PropertyChangeRecorder = new PropertyChangeRecorder(this);
            CmdStateChangeRecorder = new CommandStateChangeRecorder(this);

            instanceKernel.Bind(this.GetType()).ToConstant(this);
            globalKernel.Bind(this.GetType()).ToConstant(this);
        }
Beispiel #2
0
        public void Setup()
        {
            repositoryMock = new Mock<IRepository<DomainModel.TeamPicture.TeamPicture>>();
            repositoryMock.Setup(r => r.Get(It.IsAny<Specification<DomainModel.TeamPicture.TeamPicture>>())).Returns(
                new List<DomainModel.TeamPicture.TeamPicture>());
            persisterMock = new Mock<IPersistDomainModelsAsync<DomainModel.TeamPicture.TeamPicture>>();
            timerMock = new Mock<ITimer>();
            logggerMock = new Mock<ILog>();
            progressbarMock = new Mock<IProgressbar>();

            logggerMock.Setup(l => l.WriteEntry(It.IsAny<LogEntry>())).Callback((LogEntry entry) =>
                {
                    errorLog.Add(entry);
                });

			webcamServiceMock = new Mock<IWebcamService>();
        	webcamServiceMock.Setup(s => s.StartCapture(It.IsAny<VideoBrush>())).Callback(
        		(VideoBrush videoBrush) =>
        		{
        			webcamServiceMock.Setup(s => s.CaptureState).Returns(CaptureState.Started);
        		});
        	webcamServiceMock.Setup(s => s.CaptureImageAsync()).Callback(
        		() =>
        		{
					newPicture = new WriteableBitmap(100, 100);
					webcamServiceMock.Raise(m => m.CaptureImageCompleted += null, new CaptureImageCompletedEventArgs(newPicture));
        		});
        	webcamServiceMock.Setup(s => s.StopCapture()).Callback(
        		() =>
        		{
        			webcamServiceMock.Setup(s => s.CaptureState).Returns(CaptureState.Stopped);
        		});

            viewModel = new TeamPictureViewModel(
				repositoryMock.Object, 
				persisterMock.Object, 
				timerMock.Object,
				new NoBackgroundWorkerInvocation<IEnumerable<DomainModel.TeamPicture.TeamPicture>>(), 
				logggerMock.Object,
				webcamServiceMock.Object, 
                progressbarMock.Object);
			
			CommandStateChangeRecorder = new CommandStateChangeRecorder(viewModel);
        	CommandStateChangeRecorder.Start();

			Before();	
		}
            public override void Context()
            {
                base.Context();

                Given_EditSlideshowDialog_is_created();
                cmdStateChangeRecorder = new CommandStateChangeRecorder(viewModel);
                cmdStateChangeRecorder.Start();

                And_Slideshow_has_Slides();

                When("Slide is Selected", () =>
                    viewModel.Slideshow.CurrentSlide = viewModel.Slideshow.Slides.First());
            }