Example #1
0
        public async Task Create()
        {
            var result = await _queries.Create(_newAlbumContract);

            result.Should().NotBeNull("result");
            result.Name.Should().Be("Another Dimensions", "Name");

            _album = _repository.HandleQuery(q => q.Query().FirstOrDefault(a => a.DefaultName == "Another Dimensions"));

            _album.Should().NotBeNull("Album was saved to repository");
            _album.DefaultName.Should().Be("Another Dimensions", "Name");
            _album.Names.SortNames.DefaultLanguage.Should().Be(ContentLanguageSelection.English, "Default language should be English");
            _album.AllArtists.Count.Should().Be(2, "Artists count");
            VocaDbAssert.ContainsArtists(_album.AllArtists, "Tripshots", "Hatsune Miku");
            _album.ArtistString.Default.Should().Be("Tripshots feat. Hatsune Miku", "ArtistString");

            var archivedVersion = _repository.List <ArchivedAlbumVersion>().FirstOrDefault();

            archivedVersion.Should().NotBeNull("Archived version was created");
            archivedVersion.Album.Should().Be(_album, "Archived version album");
            archivedVersion.Reason.Should().Be(AlbumArchiveReason.Created, "Archived version reason");

            var activityEntry = _repository.List <ActivityEntry>().FirstOrDefault();

            activityEntry.Should().NotBeNull("Activity entry was created");
            activityEntry.EntryBase.Should().Be(_album, "Activity entry's entry");
            activityEntry.EditEvent.Should().Be(EntryEditEvent.Created, "Activity entry event type");
        }
Example #2
0
        public void Create()
        {
            var result = queries.Create(newAlbumContract);

            Assert.IsNotNull(result, "result");
            Assert.AreEqual("Another Dimensions", result.Name, "Name");

            album = repository.HandleQuery(q => q.Query().FirstOrDefault(a => a.DefaultName == "Another Dimensions"));

            Assert.IsNotNull(album, "Album was saved to repository");
            Assert.AreEqual("Another Dimensions", album.DefaultName, "Name");
            Assert.AreEqual(ContentLanguageSelection.English, album.Names.SortNames.DefaultLanguage, "Default language should be English");
            Assert.AreEqual(2, album.AllArtists.Count, "Artists count");
            VocaDbAssert.ContainsArtists(album.AllArtists, "Tripshots", "Hatsune Miku");
            Assert.AreEqual("Tripshots feat. Hatsune Miku", album.ArtistString.Default, "ArtistString");

            var archivedVersion = repository.List <ArchivedAlbumVersion>().FirstOrDefault();

            Assert.IsNotNull(archivedVersion, "Archived version was created");
            Assert.AreEqual(album, archivedVersion.Album, "Archived version album");
            Assert.AreEqual(AlbumArchiveReason.Created, archivedVersion.Reason, "Archived version reason");

            var activityEntry = repository.List <ActivityEntry>().FirstOrDefault();

            Assert.IsNotNull(activityEntry, "Activity entry was created");
            Assert.AreEqual(album, activityEntry.EntryBase, "Activity entry's entry");
            Assert.AreEqual(EntryEditEvent.Created, activityEntry.EditEvent, "Activity entry event type");
        }