p.armytank
p.armytank
CC#
Created by Batuhan on 8/30/2024 in #help
✅ Event-Driven-Architecture Cons Issue
If the user is going to wait on the result of the action then using commands doesn't make sense. Just update the db and return the info in the response to the same request. The user will also then know if the order failed. Commands are useful when the user doesn't immediately care about the result - for example generating the tracking number for the order.
16 replies
CC#
Created by from I select q[0] on 7/17/2024 in #help
help understanding unit test and mocking, which of the two example are valid
I'm talking about the constructor for LocalServiceWraper. You would pass in the instance of IThirdPartyService to LocalServiceWraper's constructor, and then use that instance in TransformDoSomething.
10 replies
CC#
Created by from I select q[0] on 7/17/2024 in #help
help understanding unit test and mocking, which of the two example are valid
Yes because you are not injecting IThirdPartyService into LocalServiceWraper. You should be using constructor injection to create the instance of ThirdPartyService. Then in your test you would pass your thirdPservicemock into the constructor of LocalServiceWraper.
10 replies
CC#
Created by from I select q[0] on 7/17/2024 in #help
help understanding unit test and mocking, which of the two example are valid
Ok, now I understand better. So is LocalServiceWraper the class that you're trying to test? In that case method 2 is better - you want to use the concrete implementation. In method 1 you are just testing a mock, which is pointless.
10 replies
CC#
Created by from I select q[0] on 7/17/2024 in #help
help understanding unit test and mocking, which of the two example are valid
Both seem okay to me. In TestMethod2 I would call localServiceMock a test implementation or stub rather than a mock but it's still a valid way to unit test. Edit: I guess I'm assuming that LocalServiceWraperTest is created specifically for testing and is not your runtime implementation. It's hard to understand since all your classes have the word test/example in the name.
10 replies
CC#
Created by Daz on 7/15/2024 in #help
Docker - .NET 8.0 UTF-8 Problem
could there be a difference in the environment variables? Maybe compare all your local env vars with the defaults used by the image.
3 replies
CC#
Created by tri on 6/27/2024 in #help
what URL should Kestrel listen to in a docker container on Azure App Service
You need to give the app service an application setting for WEBSITES_PORT with the value of whatever port your container is listening on (8080 probably). You will also need to expose 8080 from the container. https://stackoverflow.com/questions/48693878/how-do-you-expose-port-3000-using-an-azure-web-app-container
2 replies
CC#
Created by kmanjt on 6/22/2024 in #help
Azure DevOps Pipelines: Environment Variables Not Available in dotnet test Command
are you sure you're passing in tenantId correctly? maybe try printing it out in the script.
3 replies