コード例 #1
0
        public void ActivateSingleSoundCommand_ParameterIsNotNull_AddsCloneOfSoundToActiveSounds()
        {
            //Arrange
            ObservableCollection <ISound> activeSounds           = new ObservableCollection <ISound>();
            IObservableSoundService       observableSoundService = CommonStubsFactory.StubObservableSoundService(activeSounds);

            Target = CreateTarget(soundService: observableSoundService);
            ISound sound = CommonStubsFactory.StubClonableSoundWithRandomName();

            //Act
            Target.Commands.ActivateSingleSoundCommand.Execute(sound);

            //Assert
            activeSounds.Should().NotContain(s => ReferenceEquals(s, sound));
            activeSounds.Single().ShouldBeEquivalentTo(sound);
        }
コード例 #2
0
        private static MainWindowViewModel CreateTarget(ISoundBoardRepository soundBoardRepository = null,
                                                        IDialogService dialogService = null, IKernel container = null, IObservableSoundService soundService = null,
                                                        ISoundFactory soundFactory   = null)
        {
            if (container == null)
            {
                container = new StandardKernel();
                container.Bind <MainWindow>().ToMethod(context => new MainWindow());
            }

            return(new MainWindowViewModel(
                       soundBoardRepository ?? MockRepository.GenerateStub <ISoundBoardRepository>(),
                       dialogService ?? MockRepository.GenerateStub <IDialogService>(),
                       soundService ?? CommonStubsFactory.StubObservableSoundService(),
                       container,
                       soundFactory ?? CommonStubsFactory.StubSoundFactory(new string[] { "*.a", "*.b" })));
        }