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

CoconaApp.Run does not work in xunit/nunit #124

Open
Zayik opened this issue Feb 16, 2024 · 1 comment
Open

CoconaApp.Run does not work in xunit/nunit #124

Zayik opened this issue Feb 16, 2024 · 1 comment

Comments

@Zayik
Copy link

Zayik commented Feb 16, 2024

I created a .net 8.0 test project. Within that project, I included the latest Cocona package 2.2.0.

I then added the following test:

    public class UnitTest1
    {
        private readonly ITestOutputHelper output;

        public UnitTest1(ITestOutputHelper output)
        {
            this.output = output;
        }

        [Fact]
        public void RunCoconaApp()
        {
            output.WriteLine("Attempting to call CoconaApp.Run");
            CoconaApp.Run(
                () =>
                {
                    output.WriteLine("Hello World");
                });
        }
    }

Upon running this test, the only output seen is the initial line "Attempting to call CoconaApp.Run".
Breakpointing into this test, I can hit the call to CoconaApp.Run, but the code within the lambda expression is never executed.

Expected behavior: CoconaApp.Run should work and execute the lambda expression when tested using xunit/nunit
Actual behavior: CoconaApp.Run never executes the lambda expression when tested using xunit/nunit.

Had anyone successfully ran Cocona as part of their integration tests?

@Puchaczov
Copy link

Puchaczov commented Oct 12, 2024

This is something that is also pain for me, is there anybody who could share his reflections about what might be the problem here? My best guess for a quick look is that it runs with tests host and cocona might never be able to introduce itself properly to already configured host?

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

2 participants