simplcommerce / SimplCommerce

A simple, cross platform, modulith ecommerce system built on .NET
http://www.simplcommerce.com
Apache License 2.0
4.2k stars 1.59k forks source link

#1093: Update stock quantity bug #1094

Closed s04v closed 6 months ago

s04v commented 6 months ago

Fix #1093

hishamco commented 6 months ago

A unit test will be useful to ensure nothing broken in this case

s04v commented 6 months ago

Hello, @hishamco, there is a fully commented out StockServiceTests.cs file . Should I create a new file for the tests?

hishamco commented 6 months ago

Seems it's commented :) you can uncomment the class and add your test cases, leave everything as it was

hishamco commented 6 months ago

Why you are using MockQueryable.Moq

s04v commented 6 months ago

Because the FirstOrDefaultAsync method is used in UpdateStock. Calling FirstOrDefaultAsync with Moq throws an exception that this method works only with IAsyncQueryProvider. MockQueryable.Moq helps to solve it

hishamco commented 6 months ago

I see, let me do a quick check today then merge

Thanks

s04v commented 6 months ago

Any updates?

hishamco commented 6 months ago

Sorry I was sick last few days, that's why I didn't give you an update

s04v commented 6 months ago

It's okay, take care of yourself.