public async void TestGetAlbumByIdAsync()
        {
            var data = await _albumsController.GetAlbumByIdAsync(Guid.Parse("0f078d0e-6602-4375-a088-ab8d00facdd1"));

            Assert.IsAssignableFrom <AlbumDto>(data);
            bool IsValid = data.ErrorMessage == null ? true : false;

            Assert.True(IsValid);
        }
Ejemplo n.º 2
0
        public async void TestGetAlbumByIdAsync()
        {
            // 2. Act: Run the SUT (software under test - the actual testing code)
            var data = await _controller.GetAlbumByIdAsync(Guid.Parse("0f078d0e-6602-4375-a088-ab8d00facdd1"));

            // 3. Assert: Check and verify the result.
            Assert.IsAssignableFrom <IActionResult>(data);

            bool IsValid = (int)data.GetType().GetProperty("StatusCode").GetValue(data, null) == 200;

            Assert.True(IsValid);

            var album = (AlbumViewModel)data.GetType().GetProperty("Value").GetValue(data);

            IsValid = album.ErrorMessage?.FirstOrDefault() == null;
            Assert.True(IsValid);
        }