Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Unit test verify excution path if (product.Owner != email)

$
0
0

Hi, I have the following code

 public async Task UpdateAsync(int productId, string email)
        {
            var product = await GetAsync(productId);

            if (product.Owner != email)
            {
                throw new AuthenticationException($"You are not authorized to update product");
            }
        }

I would like to verify that if product.Owner != email  then AuthenticationException is throwen

Regards


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>