-
Notifications
You must be signed in to change notification settings - Fork 576
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: How to properly leverage the DistributedApplicationTestingBuilder.CreateAsync<TEntryPoint>() #7008
Comments
Can you share a sample? |
Hi @davidfowl! Happy New Year! Sure, how about this test in the file linked here. The method named The first line of that test is:
And it throws:
The type that I pass into the type argument Could you let me know if that's how |
No that's not correct. The entry point must be a type in the apphost's assembly (usually the Program type). The |
Thanks @davidfowl that got all those tests passing! Much appreciate the help. |
I'm working on a new Aspire feature that I hope will be accepted as a Pull Request by the Aspire team.
(See an explanation and my progress here, if interested: #4785)
However, I'm struggling with my unit tests. I'm trying to use the
CreateAsync
method of theDistributedApplicationTestingBuilder
to get a mock distributed applicationIt was working fine in my own test project in my own solution, where I was passing the type of a recently created AppHost project as the value of
T
. However, when I copied my unit tests into the Aspire solution (\tests\Aspire.Hosting.Tests) some of them started failing. I tried various values ofT
, includingTestingAppHost1_AppHost
(which is a distributed application host project already referenced by the Aspire.Hosting.Tests project.In all cases above, I got the message:
System.InvalidOperationException : The entry point exited without building a DistributedApplication.
Please could you tell me what class I can use to bootstrap
DistributedApplicationTestingBuilder
to use in my unit tests?Thanks for your help!
Benjamin
The text was updated successfully, but these errors were encountered: