Skip to content
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

Open
BenjaminCharlton opened this issue Jan 2, 2025 · 0 comments

Comments

@BenjaminCharlton
Copy link

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 the DistributedApplicationTestingBuilder to get a mock distributed application

var distributedApplicationBuilder = await DistributedApplicationTestingBuilder.CreateAsync<BlazorFluentUI_AppHost>();

It 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 of T, including TestingAppHost1_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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant