示例#1
0
        public void execute_async_throws_if_context_is_null()
        {
            var sut = new AudioActionBuilder()
                      .Build();

            Assert.Throws <ArgumentNullException>(() => sut.ExecuteAsync(null));
        }
示例#2
0
        public void duration_returns_zero()
        {
            var sut = new AudioActionBuilder()
                      .Build();

            Assert.Equal(TimeSpan.Zero, sut.Duration);
        }
        public void execute_async_cancels_if_context_is_cancelled()
        {
            var sut = new AudioActionBuilder()
                .Build();

            using (var context = new ExecutionContext())
            {
                context.Cancel();

                Assert.Throws<OperationCanceledException>(() => sut.ExecuteAsync(context));
            }
        }
示例#4
0
        public void execute_async_cancels_if_context_is_cancelled()
        {
            var sut = new AudioActionBuilder()
                      .Build();

            using (var context = new ExecutionContext())
            {
                context.Cancel();

                Assert.Throws <OperationCanceledException>(() => sut.ExecuteAsync(context));
            }
        }
        public void execute_passes_the_audio_name_onto_the_audio_service(string audioName)
        {
            var audioService = new AudioServiceMock(MockBehavior.Loose);
            var sut = new AudioActionBuilder()
                .WithAudioService(audioService)
                .WithAudioName(audioName)
                .Build();

            sut.Execute(new ExecutionContext()).Subscribe();

            audioService
                .Verify(x => x.Play(audioName))
                .WasCalledExactlyOnce();
        }
示例#6
0
        public void execute_passes_the_audio_name_onto_the_audio_service(string audioName)
        {
            var audioService = new AudioServiceMock(MockBehavior.Loose);
            var sut          = new AudioActionBuilder()
                               .WithAudioService(audioService)
                               .WithAudioName(audioName)
                               .Build();

            sut.Execute(new ExecutionContext()).Subscribe();

            audioService
            .Verify(x => x.Play(audioName))
            .WasCalledExactlyOnce();
        }
示例#7
0
        public void execute_pauses_if_context_is_paused()
        {
            var audioService = new AudioServiceMock(MockBehavior.Loose);
            var sut          = new AudioActionBuilder()
                               .WithAudioService(audioService)
                               .Build();
            var context = new ExecutionContext();

            context.IsPaused = true;

            sut
            .Execute(context)
            .Subscribe();

            audioService
            .Verify(x => x.Play(It.IsAny <string>()))
            .WasNotCalled();
        }
        public void execute_pauses_if_context_is_paused()
        {
            var audioService = new AudioServiceMock(MockBehavior.Loose);
            var sut = new AudioActionBuilder()
                .WithAudioService(audioService)
                .Build();

            using (var context = new ExecutionContext())
            {
                context.IsPaused = true;

                sut.Execute(context).Subscribe();

                audioService
                    .Verify(x => x.Play(It.IsAny<string>()))
                    .WasNotCalled();
            }
        }
 public void duration_returns_zero()
 {
     var sut = new AudioActionBuilder()
         .Build();
     Assert.Equal(TimeSpan.Zero, sut.Duration);
 }
 public void execute_async_throws_if_context_is_null()
 {
     var sut = new AudioActionBuilder()
         .Build();
     Assert.Throws<ArgumentNullException>(() => sut.ExecuteAsync(null));
 }