Example #1
0
        public void WhenLoadReferencesAreLoaded()
        {
            // Arrange
            var adaptersMock      = Mock.Create <IReferenceAdapters>();
            var albumAdapterMock  = Mock.Create <IDataAdapter <Album> >();
            var artistAdapterMock = Mock.Create <IDataAdapter <Artist> >();
            var titleAdapterMock  = Mock.Create <IDataAdapter <Title> >();
            var genreAdapterMock  = Mock.Create <IDataAdapter <Genre> >();
            var yearAdapterMock   = Mock.Create <IDataAdapter <Year> >();

            Mock.Arrange(() => adaptersMock.AlbumAdapter).Returns(albumAdapterMock);
            Mock.Arrange(() => adaptersMock.ArtistAdapter).Returns(artistAdapterMock);
            Mock.Arrange(() => adaptersMock.TitleAdapter).Returns(titleAdapterMock);
            Mock.Arrange(() => adaptersMock.GenreAdapter).Returns(genreAdapterMock);
            Mock.Arrange(() => adaptersMock.YearAdapter).Returns(yearAdapterMock);
            var target = new StorableTaggedFile();

            // Act
            target.LoadReferences(adaptersMock);

            // Assert(s)...
            Mock.Assert(() => albumAdapterMock.GetFirst(Arg.IsAny <Expression <Func <Album, bool> > >()));
            Mock.Assert(() => artistAdapterMock.GetFirst(Arg.IsAny <Expression <Func <Artist, bool> > >()));
            Mock.Assert(() => titleAdapterMock.GetFirst(Arg.IsAny <Expression <Func <Title, bool> > >()));
            Mock.Assert(() => genreAdapterMock.GetFirst(Arg.IsAny <Expression <Func <Genre, bool> > >()));
            Mock.Assert(() => yearAdapterMock.GetFirst(Arg.IsAny <Expression <Func <Year, bool> > >()));
        }
Example #2
0
 /// <summary>
 /// Adds the file.
 /// </summary>
 /// <param name="file">The file.</param>
 public void AddFile(StorableTaggedFile file)
 {
     file.LoadReferences(referenceAdapters);
     lock (files)
         files.Add(file);
     publicTransport.ApplicationEventBus.Publish(new PlaylistUpdatedEvent());
 }