Exemplo n.º 1
0
        public async Task CreateArtistAsyncTest()
        {
            // Arrange
            var artistRepoMock = new Mock <IArtistRepository>();

            artistRepoMock.Setup(mock => mock.CreateArtistAsync(It.Is((NewArtistDataDto dataDto) => (
                                                                          dataDto.UserId == 1 &&
                                                                          dataDto.Name == "Test"
                                                                          ))))
            .ReturnsAsync(new ArtistDataDto
            {
                Id      = 1,
                Name    = "Test",
                Picture = "",
            })
            .Verifiable();

            var artistCollection = new ArtistCollection(artistRepoMock.Object, _dependencyMapper);

            // Act
            var artist = await artistCollection.CreateArtistAsync(1, "Test");

            // Assert
            artistRepoMock.Verify();
            Assert.AreEqual(1, artist.Id);
            Assert.AreEqual("Test", artist.Name);
            Assert.AreEqual("", artist.Picture);
        }