public async Task GetArtistByUserIdAsyncTest_ValidUserId_CorrectData() { // Arrange var artistRepoMock = new Mock <IArtistRepository>(); artistRepoMock.Setup(mock => mock.GetArtistByUserIdAsync(1)) .ReturnsAsync(new ArtistDataDto { Id = 1, Name = "Test", Picture = "", }) .Verifiable(); var artistCollection = new ArtistCollection(artistRepoMock.Object, _dependencyMapper); // Act var artist = await artistCollection.GetArtistByUserIdAsync(1); // Assert artistRepoMock.Verify(); Assert.AreEqual(1, artist.Id); Assert.AreEqual("Test", artist.Name); Assert.AreEqual("", artist.Picture); }
public async Task GetArtistByUserIdAsyncTest_InvalidUserId_Null() { // Arrange var artistRepoMock = new Mock <IArtistRepository>(); artistRepoMock.Setup(mock => mock.GetArtistByUserIdAsync(1)) .ReturnsAsync(null as ArtistDataDto) .Verifiable(); var artistCollection = new ArtistCollection(artistRepoMock.Object, _dependencyMapper); // Act var artist = await artistCollection.GetArtistByUserIdAsync(1); // Assert artistRepoMock.Verify(); Assert.AreEqual(null, artist); }