public void Test() { IWebUserSettings iwsm = Substitute.For<IWebUserSettings>(); MuzicBrainzFinder mbf = new MuzicBrainzFinder(iwsm); ICDInfoHandler icd = Substitute.For<ICDInfoHandler>(); icd.IsReady.Returns(true); IDiscIDs iIDiscIDs = Substitute.For<IDiscIDs>(); iIDiscIDs.MusicBrainzCDId.Returns("XzPS7vW.HPHsYemQh0HBUGr8vuU-"); icd.IDs.Returns(iIDiscIDs); CDInfoQuery cdiq = new CDInfoQuery(icd); cdiq.NeedCoverArt=false; IEnumerable<Match<AlbumDescriptor>> res = mbf.Search(cdiq, new CancellationToken()); res.Should().NotBeNull(); List<Match<AlbumDescriptor>> resl = res.ToList(); resl.Should().HaveCount(2); resl[1].FindItem.HasImage().Should().BeTrue(); mbf.Dispose(); }
public void WebQueryBaseTest_CD() { ICDInfoHandler icdh = Substitute.For<ICDInfoHandler>(); CDInfoQuery target = new CDInfoQuery(icdh); target.CDInfo.Should().Be(icdh); target.MaxResult = 0; target.MaxResult.Should().Be(-1); target.MaxResult = -2; target.MaxResult.Should().Be(-1); target.MaxResult = 10; target.MaxResult.Should().Be(10); target.AlbumDescriptor.Should().BeNull(); }
public void Failed_Test_CDIsNull() { IWebUserSettings iwsm = Substitute.For<IWebUserSettings>(); MuzicBrainzFinder mbf = new MuzicBrainzFinder(iwsm); CDInfoQuery cdiq = new CDInfoQuery(null); IEnumerable<Match<AlbumDescriptor>> res = mbf.Search(cdiq, new CancellationToken()); res.Should().NotBeNull(); res.Should().BeEmpty(); mbf.Dispose(); }
public void Failed_Test_CDNotReady() { IWebUserSettings iwsm = Substitute.For<IWebUserSettings>(); MuzicBrainzFinder mbf = new MuzicBrainzFinder(iwsm); ICDInfoHandler icd = Substitute.For<ICDInfoHandler>(); icd.IsReady.Returns(false); CDInfoQuery cdiq = new CDInfoQuery(icd); IEnumerable<Match<AlbumDescriptor>> res = mbf.Search(cdiq, new CancellationToken()); res.Should().NotBeNull(); res.Should().BeEmpty(); mbf.Dispose(); }