Coder Social home page Coder Social logo

Comments (4)

egil avatar egil commented on August 25, 2024

Those Add* methods are part of the Microsoft.Extensions.DependencyInjection namespace. Let me update the release notes to make it clear you need to add that now.

Import that in your .cs or .razor file and you are good to go:

using Microsoft.Extensions.DependencyInjection;

from bunit.

egil avatar egil commented on August 25, 2024

Please expose a property that will return the IServiceCollection.

I am not sure why there is a need for an explicit IServiceCollection to be exposed. Due to inheritance, the TestServiceProvider is one, so it should not be needed. See my coding example in the related issue (#38)

from bunit.

jpiell avatar jpiell commented on August 25, 2024

I am still getting:

Severity Code Description Project File Line Suppression State
Error CS1061 'TestServiceProvider' does not contain a definition for 'AddService' and no accessible extension method 'AddService'

from bunit.

egil avatar egil commented on August 25, 2024

Thats because there is no AddService any more. You need to call AddSingleton now, which is an extension method from Microsoft.Extensions.DependencyInjection.

Before beta-5, TestServiceProvider was not a true IServiceCollection, thus it implemented a bunch of AddServices methods. That is now changed, and we rely on the from extension method from Microsoft.Extensions.DependencyInjection.

I am sorry if that was not clear enough in the release notes

from bunit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.