示例#1
0
        public async Task GetAudioAsync_ForNoAudios_ReturnsNull()
        {
            var repo = Substitute.For <IAudioEntriesRepository>();
            var sut  = new AudioServiceBuilder().WithAudioEntriesRepo(repo).Build();

            var actual = await sut.GetAudioAsync(Guid.Empty, CancellationToken.None);

            actual.Should().BeNull();
        }
示例#2
0
        public async Task GetAudioAsync_ForExistingAudio_ReturnsNonNull()
        {
            var audio = new Audio {
                AudioId = Guid.NewGuid()
            };
            var repo = Substitute.For <IAudioEntriesRepository>();

            repo.GetAudioIncludingMetaAsync(audio.AudioId, Arg.Any <CancellationToken>())
            .Returns(audio);

            var sut = new AudioServiceBuilder()
                      .WithAudioEntriesRepo(repo)
                      .Build();

            var actual = await sut.GetAudioAsync(audio.AudioId, CancellationToken.None);

            actual.Should().NotBeNull();
        }