Integration testing | ASP.NET Core 5 REST API Tutorial 15

  Рет қаралды 111,530

Nick Chapsas

Nick Chapsas

Күн бұрын

Пікірлер: 152
5 жыл бұрын
Man you have the most useful tutorials on KZbin and your explanation is one of the best.I learned a tons from your video.Thank you very,very and very much.
@michaelm5278
@michaelm5278 5 жыл бұрын
A more detailed video about both integration tests and unit tests would be highly appreciated! Really nice tutorial series so far :)
@dloperab
@dloperab 3 жыл бұрын
Thanks for this fantastic series!!! I'm doing the series with .NET 5. If the integration test failed because a 404 error could be because the test is using the real database and not the database configured in memory. You have to change this in the IntegrationTest constructor: var appFactory = new WebApplicationFactory() .WithWebHostBuilder(builder => { builder.ConfigureServices(services => { services.RemoveAll(typeof(DbContextOptions)); services.AddDbContext(options => { options.UseInMemoryDatabase("TestDb"); }); }); }); I'm using the following Nugets for .NET 5: - FluentAssertions - Microsoft.AspNet.WebApi.Client - Microsoft.AspNetCore.Mvc.Testing - Microsoft.EntityFrameworkCore.InMemory
@camcommute
@camcommute 2 жыл бұрын
How would u go about this if u are writing tests for a controller that calls a 3rd party?
@PaameRafa
@PaameRafa 2 жыл бұрын
2022 and I still learning from this series! Amazing!
@alokanat
@alokanat 5 жыл бұрын
Great videos. Please make a full session just on writing various tests. Would be very useful. Thank you for putting this all together.
@neil3304
@neil3304 5 жыл бұрын
Thank you for putting the time and effort for creating such amazing content. Feedback: 1.Most advanced level programmers are going to love the speed at which you teach. It might be a good idea to go a little slow to attract more intermediate and novice level programmers. 2. Screen resolution and the focus on the screen can be better. There is no other way other than full sizing your content to view them. Keep up the good work Nick!
@nickchapsas
@nickchapsas 5 жыл бұрын
Thank you so much for the feedback. I am trying to increase the font size more but then it’s hard for me to work in the project so I have to find a balance.
@in-the-sky-
@in-the-sky- 2 жыл бұрын
fortunately, theres features to rewind pause and slow the video
@quentincouissinier8533
@quentincouissinier8533 3 жыл бұрын
Hey Nick ! You are doing a real great work here. I'm having so much fun learning those new concepts. Thanks a lot, you are making a difference!
@TheJessejunior
@TheJessejunior 3 жыл бұрын
hey, I like so much your tutorials, they´re the most clean, direct and yet easy ones in the youtube
@bernardoreva
@bernardoreva 2 жыл бұрын
This is beautiful. Thanks for taking the time and effort to make such an amazing content Nick. Really appreciated.
@babakabbasi5466
@babakabbasi5466 2 жыл бұрын
The whole video was clear and precise. Thanks for sharing this.
@ericwalter6285
@ericwalter6285 4 жыл бұрын
Fantastic! This was so informative and exactly what I was looking for to get caught up on Core 3 new integration testing features. I'm now subscribed and will check out more of Nick's videos.
@Iliyas505
@Iliyas505 4 жыл бұрын
I think I just found my favorite .Net KZbinr :)
@kuldeepadhikari3849
@kuldeepadhikari3849 4 жыл бұрын
I would love to have an indepth integration test video, especially with real database with docker container spin up !! THanks a lot for this video !
@taraspelenio8259
@taraspelenio8259 4 жыл бұрын
Just checked your video, it was interesting. Will make base class for my integration tests. Other ideas I already used. Thanks.
@kwilderful
@kwilderful 3 жыл бұрын
Excellent! In Integration testing, another video you can make is how to emulate model binding validation for Web Api's since the testing frameworks don't have that capability.
@Wildxmo
@Wildxmo 4 жыл бұрын
So thankful for this video. This was exactly what I was looking for!
@FlippieCoetser
@FlippieCoetser 5 жыл бұрын
Super Helpful! The explanation is clear and to the point!
@juliusreischauer345
@juliusreischauer345 4 жыл бұрын
Amazing! Exactly what I need right now. Well presented too.
@facundo91
@facundo91 4 жыл бұрын
I usually use Refit to create an SDK for my API. That way I can share it, or I can use it in my other services that consume the API. But the cool think about it, is that I also test against my SDK Project (no my API project) so I force myself to update my SDK to do integration tests. I also use an Odata client to do integration test against my Odata endpoints. Sharing just in case it helps someone.
@bayobizzle
@bayobizzle 4 жыл бұрын
Can you share an open source example?
@alkishadjinicolaou5831
@alkishadjinicolaou5831 2 жыл бұрын
Εξαιρετική δουλειά φίλε
@thisisboxingproductions6894
@thisisboxingproductions6894 4 жыл бұрын
Hey Nick! I know this vid is pretty old but maybe you'll se the comment :). I was wondering how would you go about faking httpContext? Lets say the controller need to access HttpContext.User and get some info from it. Would it be possible to add httpcontext as a service or configure it to be part of a controller?
@christophneuland2140
@christophneuland2140 Жыл бұрын
Love this video. One question though: Wouldn't it make more sense to create the value which we expect by calling the Get endpoint directly on the database instead of using the CreatePostAsync endpoint to create our test data? If we'd break CreatePostAsync somehow, test cases for Get would fail aswell wich could cause confusion.
@jamsshhayd
@jamsshhayd 5 жыл бұрын
I would like to see how you integrate Single Sign On in a .NET Core application. Anyways, Perfect series of videos! ❤
@martintaylor8924
@martintaylor8924 4 жыл бұрын
Great tutorial, and filled some gaps in my knowledge perfectly. Thank you so much!
@nove1398
@nove1398 Жыл бұрын
In depth integration!
@laurakolcavova8493
@laurakolcavova8493 3 жыл бұрын
My HttpClient was still connected with local DB. I used "services.RemoveAll(typeof(DbContextOptions));" instead of "services.RemoveAll(typeof(DataContext));" and this fixed the problem.
@unbekannt6111
@unbekannt6111 3 жыл бұрын
Bro ty for this comment. I always received a 500 error code and know I fixed that thanks ur comment.
@haydarsamawe9150
@haydarsamawe9150 3 жыл бұрын
thanks you really help me
@TheFeljoy
@TheFeljoy 2 жыл бұрын
Cheers, had the same problem and this worked :)
@HoleyMoleyAlex
@HoleyMoleyAlex 4 жыл бұрын
Sorry another one. As each test is meant to be independent of each other 18:56, can you or anyone think why when I add a 3rd test, the authorisation method fails, because the user we are registering is now already in the database. I thought each test was not meant to affect each other. Is this because the method is in the base class? But why then does this only happen when I create 3 tests, it's fine with 2, I would have expected it to fail on the second authorisation call as the user was created. The hack would be to delete the user once each test is done, but I should not have to do that surely? It's behaving weird with a capital W. Each test works fine if I run them individually so it's definitely being left over from the previous tests.
@expertreviews1112
@expertreviews1112 3 жыл бұрын
Super useful video!!! Learnt so much
@ViragDesai
@ViragDesai 3 жыл бұрын
Hi Nick. This is great! Thank you. Can you also create videos about clean architecture also? You're amazing!
@gichamba
@gichamba 3 жыл бұрын
Thanks! Great video. The follow up unit test video, was it ever posted? Please post link. I can't find it under your videos.
@reezah7135
@reezah7135 4 жыл бұрын
Maybe a new tutorial about Integration testing in ASP.NET Core 3.1? Because it doesn't work this way anymore.
@johnnguyen1655
@johnnguyen1655 4 жыл бұрын
Yes, the Microsoft.AspNetCore.App was using in the video has only .NetCore 2.2 as dependency. I am trying to in stall it on netcore3.1 and getting "Version conflict..." error. Please let me know if you have solution for that.
@andrewsadavoy388
@andrewsadavoy388 4 жыл бұрын
I didn't install the Microsoft.AspNetCore.App package. Instead I only installed: System.Net.Http.Json, Fluent.Assertions, and EF.InMemory. This worked for me. There are other issues in the video but I was able to struggle through without too much trouble.
@rahulsbhatt
@rahulsbhatt Жыл бұрын
What would you recommend if I have multiple microservices responsible for one feature which requires to be integrated testing. Will this appoarch hold true/efficient in that case or do you have any other suggestions? Besides great video 👍🙏
@HoleyMoleyAlex
@HoleyMoleyAlex 4 жыл бұрын
Great tutorial, but I have one question. When we move to an in memory database rather than the SQL database, is it meant to copy the data from my SQL database? I thought the whole point was to start with a blank testing in-memory database (except any data created in OnModelCreating), or have I got the wrong end of the stick, or done something wrong? The problem with copying the data of course is that the development data changes, and therefore could invalidate the tests further down the line. Note: I am using AppDbContext not DbContext. My test fails because it keeps finding data that was in my development database,
@HoleyMoleyAlex
@HoleyMoleyAlex 4 жыл бұрын
Oh and here's the relevant code: protected BaseIntergrationTests() { var appFactory = new WebApplicationFactory() .WithWebHostBuilder(builder => { builder.ConfigureServices(services => { // Remove the current DB context, so we can then make a new one for an in-memory database. services.RemoveAll(typeof(AppDBContext)); services.AddDbContext(options => { options.UseInMemoryDatabase("TestDB2"); }); }); }); _TestClient = appFactory.CreateClient(); }
@HoleyMoleyAlex
@HoleyMoleyAlex 4 жыл бұрын
Okay, it turns it was still using the SQL database, not just copying the data. I did a bit of research and it's yet another case of used to work in EF 2, but don't work in 3 thing. Here's the code that works: protected BaseIntergrationTests() { var appFactory = new WebApplicationFactory() .WithWebHostBuilder(builder => { builder.ConfigureServices(services => { // Remove the current DB context, so we can then make a new one for an in-memory database. // This does not work with e.f. 3.*. // services.RemoveAll(typeof(AppDbContext)); var descriptor = services.SingleOrDefault(d => d.ServiceType == typeof(DbContextOptions)); if (descriptor != null) { services.Remove(descriptor); } services.AddDbContext(options => { options.UseInMemoryDatabase("TestDB2"); }); }); }); _TestClient = appFactory.CreateClient(); }
@HoleyMoleyAlex
@HoleyMoleyAlex 4 жыл бұрын
Okay Nick has fixed it on his next video where he upgrades from .net core to 3.0, for anyone else who comes across this. kzbin.info/www/bejne/nYrcZouAh6-ehdE
@sachinjangir166
@sachinjangir166 2 жыл бұрын
Really nice and informative video, thanks :)
@omarkallel7785
@omarkallel7785 4 жыл бұрын
Thank you. Very helpful. If you can do other videos on testing and integration testing with docker. Thank you again!
@kuriangrg
@kuriangrg 4 жыл бұрын
In .net core 3.1 "Microsoft.EntityFrameworkCore.InMemory" package can be used to resolve other dependencies caused by "Microsoft.AspNetCore.App". (Microsoft.AspNetCore.App is not supported by .net core 3.1)
@christoph6055
@christoph6055 3 жыл бұрын
Thanks! I was searching for the solution/alternative to that package ^^
@majed5006
@majed5006 11 ай бұрын
Very helpful, Thanks so much!!
@sulton-max
@sulton-max Жыл бұрын
Great work. Thank you
@noorhajhussin712
@noorhajhussin712 5 жыл бұрын
Thank u Nick,very helpful tutorial :) The video title is Integration test and the code is about unit Test!!
@nickchapsas
@nickchapsas 5 жыл бұрын
It’s actually integration testing through a unit testing framework. It is just using an in memory database for demo purposes. You can simply change that with an actual dB and I would still work as an integration test.
@leandrolagoa
@leandrolagoa 5 жыл бұрын
Perfect explanation! You helped me a lot! Thank you so much!
@AshaD2345
@AshaD2345 2 жыл бұрын
Older video I know, but how does this work in .NET 6 where you don't necessarily have a startup class anymore?
@mryildiz702
@mryildiz702 2 жыл бұрын
Add the partial class to the end of Program.cs like this: ... app.Run(); public partial class Program { } now you can it like this: WebApplicationFactory
@kehindeadewale2731
@kehindeadewale2731 4 жыл бұрын
really good. thank you. is there any difference between calling this approach integration test or a unit test of my controller methods
@nickchapsas
@nickchapsas 4 жыл бұрын
There sure is. A unit test is isolating a unit and it's testing just the unit. Not it's dependencies. This approach will actually test the whole flow including middleware because the application is technically running.
@whoami0333
@whoami0333 3 жыл бұрын
​@@nickchapsas Thanks for your video and response! Actually, I have the similar question of Kehinde above. The API endpoints test for the Controller methods is a kind of integration test, instead of an unit test, although we implement that API endpoints test basing on the xUnit framework as well. When implementing such integration test(API test), we were coached to AVOID mocking or faking its dependencies (i.e. in-memory DB) because the goal of integration test is just testing all components' integration-working, which is not like the unit test for testing a function() self only. However, the Microsoft.AspNetCore.Mvc.Testing you introduced in this video, which is absolutely an integration test skill too, recommends in-memory SUT that is using an in-memory database, which is different from the above description we were coached. /so, could you please introduce its reason? In other words, I assume Kehinde's question is "is there any difference between using the Microsoft.AspNetCore.Mvc.Testing you introduced and sending System.Net.Http.HttpClient to the action-methods of controllers, which are both integration tests"? If any mistake above, please correct as well. Thanks!
@tyeasir
@tyeasir 2 жыл бұрын
It would be nice to be able to access the project solution that you have in this video. The github link is partial code which is tough to work with.
@RyanTuller
@RyanTuller 5 жыл бұрын
Great video man! Keep'em coming
@joenishanth7310
@joenishanth7310 4 жыл бұрын
Short and useful video :)
@daveventura8343
@daveventura8343 4 жыл бұрын
amazing tutorial again. Best man :)
@turbosega
@turbosega 3 жыл бұрын
Good and nice explanation. Thanks.
@Pentatonic_Hardcore
@Pentatonic_Hardcore 2 жыл бұрын
Thanks a lot, please do a integration test for .net 6 and grpc, thanks !
@anassalloul6515
@anassalloul6515 4 жыл бұрын
Great Videos! You helped me a lot, I have a question about how can we initialize automapper with Xunit for Integration Test. Thank You Nick
@Zhovten
@Zhovten 5 жыл бұрын
wondering what would be the problem here Tweetbook.IntegrationTests.PostsControllerTests.GetAll_WithoutAnyPosts_ReturnsEmptyResponse Source: PostsControllerTests.cs line 18 Duration: 11 sec Message: System.Net.Http.UnsupportedMediaTypeException : No MediaTypeFormatter is available to read an object of type 'AuthSuccessResponse' from content with media type 'text/plain'. Stack Trace: HttpContentExtensions.ReadAsAsync[T](HttpContent content, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger, CancellationToken cancellationToken) HttpContentExtensions.ReadAsAsync[T](HttpContent content, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger) HttpContentExtensions.ReadAsAsync[T](HttpContent content, IEnumerable`1 formatters) HttpContentExtensions.ReadAsAsync[T](HttpContent content) IntegrationTest.GetJwtAsync() line 56 IntegrationTest.AuthenticateAsync() line 39 PostsControllerTests.GetAll_WithoutAnyPosts_ReturnsEmptyResponse() line 21 --- End of stack trace from previous location where exception was thrown ---
@nickchapsas
@nickchapsas 5 жыл бұрын
Which .NET Core version are you using?
@Zhovten
@Zhovten 5 жыл бұрын
@@nickchapsas Tweetbook is 3.1 Tweetbook.IntegrationTest is 3.1 too
@kaiobk88
@kaiobk88 4 жыл бұрын
The problem is ReadAsAsync in the GetJwtAsync method, one way is to change it to ReadAsStringAsync and deserialize json like this: var registrationResponseString = await response.Content.ReadAsStringAsync(); var registrationResponse = JsonSerializer.Deserialize(registrationResponseString, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); return registrationResponse.Token;
@tmati7860
@tmati7860 2 жыл бұрын
Does in-memory database compatible with relational databases? for example can we use .Include() ?
@FabioGomesCG
@FabioGomesCG 4 жыл бұрын
Nice videos man... Ty so much !
@MolaMolaSunnyfish
@MolaMolaSunnyfish 3 жыл бұрын
Guess my only complaint is that the text was a bit hard to read, especially where (I think) it says "requestUri" at about 4:50. I can't tell what puncuation you are using there. I know this is a nearly 2 year old video at this point, but hopefully this still is useful feedback.
@manuelguerrero9917
@manuelguerrero9917 3 жыл бұрын
Amazing tutorial.
@sravlca2147
@sravlca2147 3 жыл бұрын
very useful video, thanks!
@vinr
@vinr 4 жыл бұрын
If anyone has a problem of not getting inmemory database instead still connecting to the production database, follow this thread and first answer worked for me (i.e. getting the descriptor and removing the descriptor) - I'm using core 3.1 - stackoverflow.com/questions/58375527/override-ef-core-dbcontext-in-asp-net-core-webapplicationfactory
@MohamedAliC
@MohamedAliC 2 жыл бұрын
Thanks! that part confused me
@AdolfoGCH
@AdolfoGCH 4 жыл бұрын
Hi Nick, do you know if is possible to use the Inmemory Option with PostgreSQL database? By the way, as many others I have learned a lot with your videos! thanks in tons!
@maciej_s
@maciej_s 5 жыл бұрын
I'm enjoying these series, very helpful and since I'm completely new to .NET Core I'm learning a ton! I have, however encountered a problem that I can't seem to be able to overcome. 16:02 my test is failing because the HttpStatusCode is 404. When I set a breakpoint in the PostsControllerTests.cs on line 24, I can see that the RequestUri is set to "localhost/api/v1/posts". I am pretty sure I followed everything you did 1 to 1 yet this is the first time something does not work for me. Would appreciate if you could perhaps suggest what I may be doing wrong.
@michaelskydt6952
@michaelskydt6952 5 жыл бұрын
I also seem to get a 404 when trying to call the WebApi from the IntegrationTest project. Everything works as expected when running the code localhost or in Docker. What i can see is, that there might be some kind of bug in .net core 3.0 when trying to load assemblies, especially trying to get the Controllers in the Tweetbook project. stackoverflow.com/questions/43669633/why-is-testserver-not-able-to-find-controllers-when-controller-is-in-separate-as/58946016#58946016 Unfortunately neither of these solutions work for me :( If any of you guys have a solution for this, please share. And Nick Chapsas this is a very cool tutorial series! Keep up the good work.
@paulmouatib9999
@paulmouatib9999 3 жыл бұрын
Is this work with MSQL Server or PostGres? How does it create a in memory version of a database??
@vamsi8669
@vamsi8669 4 жыл бұрын
Hi Nick I am doing all this in an uint test with out using the client factory. But I am still using the in memory database. Do my test still be unit test or will they qualify as integration tests? Thanks for the super helpful tutorials.
@tmati7860
@tmati7860 2 жыл бұрын
Hey Nick, Thank for your great video. Please make a video concerning authorized user create a post that has userId in it and create a integration test for that. Tnaks is advance.
@andrewsadavoy388
@andrewsadavoy388 4 жыл бұрын
First, your videos are excellent. Please keep it up! Second, there's an issue with AspNetCore 3.1: the integration tests seem to use the non-in-memory database using the instructions in the video. This fix worked for me: At 11:58 (kzbin.info/www/bejne/baPSoqebjLGqatU) change the line from: services.RemoveAll(); to: services.RemoveAll(); EDIT: I'm not sure this fix actually works. It fixed the issue with the Identity but I'm still having problems with creating posts.
@gordonfreimann
@gordonfreimann 2 жыл бұрын
Hi Nick, is this still valid approach as of today? I need something like this in my project.
@nickchapsas
@nickchapsas 2 жыл бұрын
It sure is
@gordonfreimann
@gordonfreimann 2 жыл бұрын
@@nickchapsas thanks :)
@kenank7053
@kenank7053 2 жыл бұрын
You need to consider that the in memory database returns object by reference. This said changes to your domain take place directly even before you call SaveAsync etc.
@gordonfreimann
@gordonfreimann 2 жыл бұрын
@@kenank7053 yes i dealt with that and bunch of other problems as well. In the video he says each test resets the in memory db but it didn't. I had to configure more to clean it for each test. Furthermore, creating a second class for other controller caused another issue. They run in parallel which was a problem with the db context. But luckily there's Collection attribute of xunit that solved the issue.
@kenank7053
@kenank7053 2 жыл бұрын
@@gordonfreimann Did you find a feasible way? With this behaviour it is nearly useless
@MrSigmaSharp
@MrSigmaSharp 5 жыл бұрын
A good video you can improve it if you increase the dpi on your machine so that the texts are visible in smaller screens and lower resolution caused by adaptive resolution of you tube
@frankhaugen
@frankhaugen 5 жыл бұрын
This is OK when you are issuing a token from the same microservice. However, what if I have a separate microservice to handle identies, and I need to "fool" it into letting me access the endpoint??
@nickchapsas
@nickchapsas 5 жыл бұрын
All the other microservice has to do is either verify the token signature to prove that it is authentic using a secret or a certificate depending on the token signature encryption type or call the identity microservice to do the signature auth check on its behalf
@edwinparejas3176
@edwinparejas3176 4 жыл бұрын
Hi, How can you customize Visual Studio that way? Can you learn me please ? for example that NUGET window at bottom ... Thanks a lot
@nickchapsas
@nickchapsas 4 жыл бұрын
Hey Edwin, this is not visual studio. This is a different IDE called Rider. It’s made by JetBrains the same guys that made resharper
@edwinparejas3176
@edwinparejas3176 4 жыл бұрын
Nick Chapsas Interesting... Thanks Nick!!
@romanhrytskiv5598
@romanhrytskiv5598 4 жыл бұрын
How'd you configure that triple-'a' shortcut?
@nickchapsas
@nickchapsas 4 жыл бұрын
I used Rider's templating feature. I think there is a similar one in Visual Studio as well
@halivudestevez2
@halivudestevez2 4 жыл бұрын
now is it Unit or Integration testing?
@halivudestevez2
@halivudestevez2 4 жыл бұрын
cant get the difference
@tisurmaster
@tisurmaster 4 жыл бұрын
What about using swagger api testing as a unit test and integration test?
@nickchapsas
@nickchapsas 4 жыл бұрын
Swagger API Testing cannot be considered unit testing in any way. It could technically be used for integration testing but where I think it really shines is end to end testing.
@tisurmaster
@tisurmaster 4 жыл бұрын
@@nickchapsas thanks! Will definitely consider that.
@swaroopshivanna3025
@swaroopshivanna3025 3 жыл бұрын
I am trying to integration test my .NET 5 project using similar setup to what has been described in the video. The unit test run fine when I run them individually but when I run them all at once first to be executed passes and rest fail, when I debugged it was because the user already existed. I think the context is being shared among the tests but I do not know how to not share it. Any help please?
@pagorbunov
@pagorbunov 2 жыл бұрын
The same issue...
@yltope
@yltope 2 жыл бұрын
Ran into the same issue using Core 6.0. Maybe the behavior of the in-memory database has been changed between major versions as its documentation states now that: "The in-memory database is shared anywhere the same name is used" This sharing causes the second call for registering a user to fail as the user already exists. I made a dirty hack that seems to work: options.UseInMemoryDatabase("TestDb" + this.GetHashCode()); I.e. append the current test instance's hashcode into the name as a new instance is created per test run (and no, Guids do not work for some reason). There most likely is a better way of accomplishing a reset to the in-memory database, but can't be bothered to spend more time investigating.
@abhijithsugunan6768
@abhijithsugunan6768 4 жыл бұрын
Nick an updated video for .net core 3.1 might he helpful
@serhiihorun6298
@serhiihorun6298 4 жыл бұрын
Thank you!!
@jessecalato4677
@jessecalato4677 6 ай бұрын
Is all of this still valid, or are there better ways to do this now?
@michelchaghoury9629
@michelchaghoury9629 2 жыл бұрын
Hello nick i need your help i want to have a sql server docker instance for testing i have stored orocedures that i want to test can you please help me or nake a vid about that ropic please
@zohashobbar118
@zohashobbar118 2 жыл бұрын
its grate thank you
@sushantutub
@sushantutub 3 жыл бұрын
Hi nick could you please share git link
@MartinBonafede
@MartinBonafede 3 жыл бұрын
I don't get it you say in the title ASP.NET Core 5, but the app is in net core 2.2
@nickchapsas
@nickchapsas 3 жыл бұрын
It was originally made in 2.2 times, but the structure and code is still the same in 5. The only things that need updating are in the upvoted comments
@mimimi_everywhere
@mimimi_everywhere 5 жыл бұрын
unfortunately my service is still connected with my local DB and writes the data in there. My problem is also described here: stackoverflow.com/questions/58375527/override-ef-core-dbcontext-in-asp-net-core-webapplicationfactory do you have any solution for that problem? thank you
@vinr
@vinr 4 жыл бұрын
I have the same issue, it doesn't connect to the inmemory db, did you find any solution?
@vinr
@vinr 4 жыл бұрын
Your thread has a solution and it works
@pharaujo2409
@pharaujo2409 5 жыл бұрын
Excellent content. Could you please share the code?
@nickchapsas
@nickchapsas 5 жыл бұрын
Hello and thanks for your kind words. Unfortunately the code is always out of sync with the videos since I prerecord most of them, so you will never find the code to be accurate to that specific video. I could potentially reupload the code and use snapshots for each video but those videos are meant to be mostly follow along and not a place to grab a piece of code and roll with it.
@nickchapsas
@nickchapsas 5 жыл бұрын
I added the IntegrationTest project in the description if you still need it
@nickchapsas
@nickchapsas 5 жыл бұрын
Hello Pontus, thanks for the feedback. All the videos after part 17 had a snapshot of the code in the description. Sorry I didn't do that earlier.
@kpkeerthi117
@kpkeerthi117 4 жыл бұрын
can u share this project
@nickchapsas
@nickchapsas 4 жыл бұрын
You can find all the code in the description down below.
@michaelkopljan578
@michaelkopljan578 4 жыл бұрын
#JetBrainsRider, very good video
@СвятославСамойленко-ц1ы
@СвятославСамойленко-ц1ы 3 жыл бұрын
I'm not sure that it's good approach in integration test to test controllers. I'm prefer to test services (business layer) which are injected to controllers and should be connected to DB. In this case you can interact only with interfaces instead of having route files (do you really use something like this in production?).
@nickchapsas
@nickchapsas 3 жыл бұрын
You are not testing controllers. You are testing endpoints via a special httpclient. You don’t need to mock the databases and in fact you shouldn’t, if you are doing proper integration testing.
@СвятославСамойленко-ц1ы
@СвятославСамойленко-ц1ы 3 жыл бұрын
​ @Nick Chapsas I mean that usage of controller endpoints don't looks like good idea and prefer to have start testing point of service or another entity which methods are based on interface not on route file. DB state (mock or real) is not important here.
@carlosgarcialalicata
@carlosgarcialalicata 3 жыл бұрын
@@СвятославСамойленко-ц1ы are you talking about unit testing or integration testing? Two different things
@nitchiecanceran6907
@nitchiecanceran6907 5 жыл бұрын
Can you share the codes?
@nickchapsas
@nickchapsas 5 жыл бұрын
gist.github.com/Elfocrash/101ffc29947832545cdaebcb259c2f44
@teddysmith7939
@teddysmith7939 4 жыл бұрын
VScode users: Make sure to restart OmniSharp or package references won't be found.
@Rajeshsingh-ws5th
@Rajeshsingh-ws5th 3 жыл бұрын
good, but your display is very small.
@PavanGarigipati
@PavanGarigipati 3 жыл бұрын
Increase the font otherwise how good you are in teaching that would not reflects.
@gabrielvargas7586
@gabrielvargas7586 3 жыл бұрын
up
@DBankx1
@DBankx1 4 жыл бұрын
good video but bro you have to slow down. youre explaining this to people who do not understand the concept. Please take the time to explain to people. it seems you are just reading from a script quickly and typing. No explanation is being done. This video should be named "Asp.net core web api tutorial for intermediate". And also please increase the font!!!!
@contactdrc9240
@contactdrc9240 2 жыл бұрын
This was supposed to be a good tutorial, but the image is blur, I can not see anyrhing... Too bad!
@hasanen9
@hasanen9 5 жыл бұрын
can you share source code
@nickchapsas
@nickchapsas 5 жыл бұрын
gist.github.com/Elfocrash/101ffc29947832545cdaebcb259c2f44
Path of Exile 2 Ice Strike Invoker Monk Endgame Guide
28:32
Raxxanterax
Рет қаралды 118 М.
小丑女COCO的审判。#天使 #小丑 #超人不会飞
00:53
超人不会飞
Рет қаралды 16 МЛН
Мен атып көрмегенмін ! | Qalam | 5 серия
25:41
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН
Clean Architecture with ASP.NET Core 3.0  - Jason Taylor - NDC Sydney 2019
1:02:30
Writing robust integration tests in .NET with WireMock.NET
17:54
Nick Chapsas
Рет қаралды 37 М.
8 await async mistakes that you SHOULD avoid in .NET
21:13
Nick Chapsas
Рет қаралды 316 М.
How to make a Project Template using NuGet
4:30
GameDev Quickie
Рет қаралды 757
C# Integration Testing Tutorial
40:25
Raw Coding
Рет қаралды 36 М.
Why is Microsoft Harming .NET Open-Source?
9:37
Nick Chapsas
Рет қаралды 29 М.
End-to-End Testing ASP.NET Core APIs
44:56
Hassan Habib
Рет қаралды 20 М.
The cleanest way to use Docker for testing in .NET
13:36
Nick Chapsas
Рет қаралды 91 М.