Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jul 08 19:22
    dependabot[bot] labeled #113
  • Jul 08 19:22
    dependabot[bot] labeled #113
  • Jul 08 19:22
    dependabot[bot] opened #113
  • Jul 08 19:22

    dependabot[bot] on nuget

    Bump Microsoft.AspNetCore.Mvc.C… (compare)

  • Jul 07 23:09
    dependabot[bot] labeled #112
  • Jul 07 23:09
    dependabot[bot] labeled #112
  • Jul 07 23:09
    dependabot[bot] opened #112
  • Jul 07 23:09

    dependabot[bot] on nuget

    Bump Microsoft.AspNetCore.Http … (compare)

  • Jun 28 09:48
    dionfoster commented #77
  • Jun 28 02:04
    rochitsen commented #77
  • Jun 24 13:02
    dependabot[bot] labeled #111
  • Jun 24 13:02
    dependabot[bot] labeled #111
  • Jun 24 13:02
    dependabot[bot] opened #111
  • Jun 24 13:02

    dependabot[bot] on npm_and_yarn

    Bump shell-quote from 1.7.2 to … (compare)

  • Jun 22 15:32
    dependabot[bot] labeled #110
  • Jun 22 15:32
    dependabot[bot] labeled #110
  • Jun 22 15:32
    dependabot[bot] opened #110
  • Jun 22 15:32

    dependabot[bot] on nuget

    Bump Newtonsoft.Json from 9.0.1… (compare)

  • Jun 14 19:45
    satishviswanathan commented #84
  • Jun 14 18:14
    jeremydmiller commented #84
Jeremy D. Miller
@jeremydmiller
And there’s always the option of just stealing the code out of Alba, but adapting it to using HttpClient.
Hallstein Brøtan
@hallstein82_twitter
Thanks for adding support for ASP.Net Core 6 and WebApplicationBuilder! Is it possible to update the documentation with an example on how to share a test setup using xUnit (and TestFixtureCollection I presume) using the new functionality for WebApplicationBuilder?
Jeremy D. Miller
@jeremydmiller
@hallstein82_twitter Sounds like a good pull request
JT
@Hawxy
@hallstein82_twitter Added an example, JasperFx/alba#100
Jeremy D. Miller
@jeremydmiller
@Hawxy I'll try to cut some time tomorrow to update Alba w/ your last PR and re-publish the docs. Thanks for doing that.
JT
@Hawxy
v6.1.0 has been published, along with the relevant doc updates.
Jeremy D. Miller
@jeremydmiller
@Hawxy I tried to use Alba against a minimal API project today, and got hit with the compiler saying the implied Program class in the system under test being internal and inaccessible. Yet that works just fine in the Alba codebase itself. Do you have any idea why?
JT
@Hawxy
@jeremydmiller you gotta add:
  <ItemGroup>
    <InternalsVisibleTo Include="ProjectName.Tests" />
  </ItemGroup>
I did update the alba docs with that as I noticed it was missing
Jeremy D. Miller
@jeremydmiller
And that feels very obvious in retrospect, thank you!
dhaligas
@dhaligas
I am trying to use Host.Services.GetRequiredService in my tests but that is not resolving. Is there an extra setup or field to get those
dhaligas
@dhaligas
Looks like I was able to get it by creating a scope Host.Services.CreateScope().ServiceProvider.GetRequiredService<MyService>()
Jeremy D. Miller
@jeremydmiller
That shouldn’t be necessary, can you add more context to what went wrong?
nghhoese
@nghhoese
is it possible to do a https request instead of a http request with alba?
Jeremy D. Miller
@jeremydmiller
It’s not doing a real HTTP request. Alba is using TestServer under the covers, so there’s no Kestrel in there at all
Thomas Skovsende
@skovsende
Been searching for half an hour now and can't find anywhere that explains how to modify my autofac registrations in my tests. The problem is that builder.ConfigureServices in Alba.AlbaHost.For<Program>(...) runs before builder.Host.ConfigureContainer in Program, so all my test registrations is getting overwritten by my application registrations. If anyone can point me in the right direction it would be greatly appreciated.
Thomas Skovsende
@skovsende
I have tried using builder.ConfigureTestContainer, but it doesn't seem to get called
Thomas Skovsende
@skovsende
Ha! I think I got it. Apparently a bug was introduced in .net 3 that made ConfigureTestContainer not be called any more: dotnet/aspnetcore#14907 But the good guys at autofac came up with a way to work around that bug here: https://github.com/autofac/Autofac/issues/1207#issuecomment-701961371 - and with that and reading a little alba code, I came up with an IAlbaHostExtension that seems to work! https://gist.github.com/skovsende/bc4f3b3ccd6ea40e733020d63a58f121
I'll see if I can find some time over the weekend to do a short blog post about the solution.
rsen
@rsen:matrix.org
[m]
Has anyone tried creating a AlbaHost for a minimal API .net 6 app which only has a Program.cs and no Startup.cs. The examples for stubbing out security are only for .net 6 projects that have a Startup.cs. The below does not work when app only has Program.cs.
// This is calling your real web service's configuration var hostBuilder = WebAppSecuredWithJwt.Program .CreateHostBuilder(Array.Empty<string>());
JT
@Hawxy
@rsen:matrix.org yes it works fine, you can use the IAlbaExtensions param to pass in the stub:
Alba.AlbaHost.For<Program>(c =>
        {
           // etc
        }, new JwtSecurityStub())
rsen
@rsen:matrix.org
[m]
Thanks @Hawxy that worked. Did'nt look at the example thoroughly. I can pass the security stub while initialising the host.
rsen
@rsen:matrix.org
[m]
This is regarding building AlbaHost. My aspnet 6 project only has Program class and no Startup class. I am using underlying WebApplicationFactory to create the host. How do i specify to use the Testing specific appSettings json file when building the host?
AlbaHost = await Alba.AlbaHost.For<Program>(builder =>
            {

                builder.ConfigureServices(services =>
                {

                });
            });
JT
@Hawxy
builder.ConfigureAppConfiguration
rsen
@rsen:matrix.org
[m]
Thanks @Hawxy actually I realised I could use builder.UserEnvironment("test"); before the ConfigureServices. That works as well.
rsen237
@rsen237:matrix.org
[m]

Hi, as anyone successfully used the FormData to upload file to an endpoint. I am trying the following but doesnt seem to work.

_.Post.FormData(form).ToUrl(_basePath);
where form is MultipartFormDataContent containing the file.

Came across this issue which has been closed JasperFx/alba#77.

I tried the same setting custom context as in the link above it does not work. Any ideas what could be wrong?

Jeremy D. Miller
@jeremydmiller
@rsen237:matrix.org I honestly have never used that, and nothing was added to Alba itself. If you could make a reproduction of that somehow, I’d be happy to take a look and try to push through it in Alba itself.
rsen237
@rsen237:matrix.org
[m]
@jeremydmiller: thanks for getting back. I will provide details and log an issue.