Giter Site home page Giter Site logo

mmacneil / apiintegrationtestsamples Goto Github PK

View Code? Open in Web Editor NEW
65.0 9.0 28.0 27 KB

Demo project containing end-to-end, in-memory integration tests in ASP.NET Core 2.1

Home Page: https://fullstackmark.com/post/20/painless-integration-testing-with-aspnet-core-web-api

License: MIT License

C# 100.00%
asp-net-core aspnet-web-api integration-testing entity-framework-core

apiintegrationtestsamples's Introduction

ApiIntegrationTestSamples

Samples of end-to-end, in-memory integration tests using ASP.NET Core 2.1 with Entity Framework Core.

Based on this blog post.

Contact

[email protected]

apiintegrationtestsamples's People

Contributors

mmacneil avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

apiintegrationtestsamples's Issues

System.InvalidOperationException.

I am trying to use this sample for my own project but when running the tests I get this error

System.InvalidOperationException : No method 'public static IWebHostBuilder CreateWebHostBuilder(string[] args)' found on 'AutoGeneratedProgram'. Alternatively, WebApplicationFactory1 can be extended and 'protected virtual IWebHostBuilder CreateWebHostBuilder()' can be overridden to provide your own IWebHostBuilder instance.

Updated to .NET Core 2.2.0 and DB not found

The code works perfectly - thank you. However, when upgrading to .NET Core 2.2.0 the SQLite DB cannot be found:

SqliteException: SQLite Error 14: 'unable to open database file'.
Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(int rc, sqlite3 db)

In addition to compiling I had to set some specific info in the *.csproj files in order to work around compile issues:

<RuntimeFrameworkVersion>2.2.0</RuntimeFrameworkVersion>
<PlatformTarget>AnyCPU</PlatformTarget>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>

I also deleted the migrations folder and run the following just to reset the database:

dotnet ef migrations add InitialCreate
dotnet ef database update

The unit tests work - as they are using the in memory DB, but the web site cannot find the players.db file - even though it was created by EF.

Any thoughts?

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.