コード例 #1
0
        public void When_AddAudio_is_called_and_no_OAuthAccessToken_has_been_stored_then_an_InvalidOperationException_is_thrown_and_UploadAudio_on_the_AudioAdapter_is_never_called()
        {
            var          photo    = new MemoryStream();
            const string fileName = "photo.jpg";
            var          entity   = AdapterSettingsCreator.CreateSingle();

            entity.OAuthAccessToken = null;

            BandRepository
            .Expect(repository =>
                    repository.GetAdapterSettings(Arg <string> .Is.Anything))
            .Return(entity)
            .Repeat.Once();
            BandRepository.Replay();

            AudioAdapter
            .Expect(adapter =>
                    adapter.UploadItem(null, null, null, null))
            .IgnoreArguments()
            .Return("")
            .Repeat.Never();
            AudioAdapter.Replay();

            Process.AddAudio(photo, fileName);

            AudioAdapter.VerifyAllExpectations();
        }
コード例 #2
0
        public void When_AddAudio_is_called_with_a_new_Audio_then_UploadAudio_on_the_AudioAdapter_is_called_with_that_Audio_and_the_stored_AudioAdapterSettings()
        {
            var          photo    = new MemoryStream();
            const string fileName = "photo.jpg";
            const string photoId  = "http://www.photos.com/myphoto";
            var          entity   = AdapterSettingsCreator.CreateSingle();

            BandRepository
            .Expect(repository =>
                    repository.GetAdapterSettings(Arg <string> .Is.Anything))
            .Return(entity)
            .Repeat.Once();
            BandRepository.Replay();

            AudioAdapter
            .Expect(adapter =>
                    adapter.UploadItem(photo, entity.SetName, fileName, entity.OAuthAccessToken))
            .Return(photoId)
            .Repeat.Once();
            AudioAdapter.Replay();

            var result = Process.AddAudio(photo, fileName);

            Assert.AreEqual(photoId, result);

            AudioAdapter.VerifyAllExpectations();
        }
コード例 #3
0
        public void When_AddAudio_is_called_with_an_Empty_string_value_for_fileName_then_an_ArgumentNullException_is_thrown()
        {
            var photo = new MemoryStream();

            Process.AddAudio(photo, string.Empty);
        }
コード例 #4
0
        public void When_AddAudio_is_called_with_a_null_value_for_Audio_then_an_ArgumentNullException_is_thrown()
        {
            const string fileName = "photo.jpg";

            Process.AddAudio(null, fileName);
        }