Тёмный

The refactoring test (1) - Dependency Inversion & Unit tests | Cracking the .NET interview 

Nick Chapsas
Подписаться 306 тыс.
Просмотров 114 тыс.
50% 1

Опубликовано:

 

28 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 217   
@nickchapsas
@nickchapsas 2 года назад
Are you looking for more training? Check out my "From Zero to Hero: Unit testing in C#" course: nickchapsas.com/p/from-zero-to-hero-unit-testing-in-c
@Timlaare
@Timlaare 3 года назад
My wish for more refactoring content has been granted! :D
@vivekshukla2480
@vivekshukla2480 3 месяца назад
God Bless you - I did get a job(it's been a couple of years now) watching this particular video and practising again and again. You rock sir.
@meJevin
@meJevin 3 года назад
Nick!!! This is really cool! Exactly what I wanted for a couple of months now, but couldn't find anything similar on youtube. Thanks for amazing content! Looking forward to new episodes on these series!
@edbutler3
@edbutler3 3 года назад
As someone who (I'm embarrassed to admit) has not done unit testing since the early days of NUnit, I was blown away when you typed Substitute.For and things started automatically happening... I've already Googled and found that comes from NSubstitute, so I'll look into it -- but hoping I'll find more on your channel about how to use this mocking library. I'm an older developer who got stuck supporting legacy apps in a conservative organization for years, but finally we have an initiative to rewrite in Dot Net Core, so it's time to get up to date!
@nickchapsas
@nickchapsas 3 года назад
NSubstitude is pure gold. I already have a video on it so you might wanna check it out to get started.
@rhw14
@rhw14 3 года назад
Great video. Hitting that proxy problem myself at the moment, nice clean solution!
@szaaary
@szaaary 3 года назад
Man, you just open my eyes not only on tests, but also entire dependency inversion and practical use of refactoring. Long time i did not have that big of "Aha" moment ; D Just... Thanks!
@dmc_xenon2411
@dmc_xenon2411 3 года назад
I don't usually comment in any video but this one is really cool! looking forward to the next episodes! Thank you for the amazing content.
@belugaaa6649
@belugaaa6649 3 года назад
He is luring everyone to comment actually. awesom content and we cant resist in applauding him :)
@vasiliioleinic
@vasiliioleinic 3 года назад
Great video, was looking for something like this over the net.
@bezimienny5
@bezimienny5 3 года назад
you mean over dot net? ha, haha, hahaha, ha.
@Lolitalein
@Lolitalein 2 года назад
I can't believe this content is for free. Thank you so much for sharing your knowledge!
@rustamhajiyev
@rustamhajiyev 3 года назад
So amazing! Excited to see the second part. 😍
@Kupferhans
@Kupferhans 3 года назад
I'm rather a C++-Guy then C#, but I really enjoy your explanations, because it's also a good collection of examples of clean code principles! Thank you!
@shooreshgolzari3885
@shooreshgolzari3885 3 года назад
Not just for potential interviewees. A great refresher for all on how to safely refactor 5*.
@RohitSharma-vq2gn
@RohitSharma-vq2gn 3 года назад
Nick, this is sheer gold. Thanks!!
@stuzyx906
@stuzyx906 3 года назад
This is great content. Would love to see more refactoring videos like this one! :)
@DiddleDangle
@DiddleDangle Год назад
Just wanted to add that this video is great and kind of a rare find on youtube and I appreciate it. That said, if a company asked me to refactor their shitty code on an interview, I'd ask for an hourly rate lol. I've had this happen a few times where they were asking how to fix their architecture and it was way too specific for an interview. If a company asks you to do something that takes hours and you're not an employee, that's consulting for free. This specific kind of exercise is borderline and I'd ask for compensation. If they're small problems around 30 mins to an hour and are not business-specific, it's probably okay but don't let companies take advantage of you for free. An exercise like this one would be a massive redflag for me.
@nickchapsas
@nickchapsas Год назад
In todays market, if you don’t do it, someone else will, so companies (at least in London) don’t care. It is pretty much part of the hiring process for every company around here
@taifunov
@taifunov 3 года назад
Perfect video, thanks! Also can you create video with testings of Command Line Interfaces?
@ovinophile
@ovinophile 3 года назад
Great video! I’ll usually also break the test to make sure I wrote it correctly and will fail when it’s supposed to.
@ernestmfakudze
@ernestmfakudze 3 года назад
Wow just brilliant! I learnt so much because you are such a great teacher Nick!
@irelandfpv
@irelandfpv 3 года назад
Hi Nick! Can you please drop the original project in gitlab? Or may be it is already there and I didn't find it. In this case can you please add a link in the header of the video. I think a lot of people would like to play with the test. And I am definitely looking forward next your videos. The channel is awesome! Well done!
@shuvo9131
@shuvo9131 3 года назад
Thank u very much Nick, I'm learning lot of things from u. Thanks for creating such quality content. waiting for next one.
@dorlugasigal
@dorlugasigal 3 года назад
Hyped for the next part!
@asingb
@asingb 3 года назад
Thanks a lot Nick. Very well explained.
@shaikhshadab6763
@shaikhshadab6763 3 года назад
Hi, Can you please create video on how memory management work, and how we can check it at runtime, and also how memory management work for generics?
@mosukiton
@mosukiton 3 года назад
Great video, I'm looking forward to the next one
@tofu1687
@tofu1687 3 года назад
Great video - but please tell you're going to rename the "firname" parameter - I just can't focus on anything else. Personnaly I would have moved the UserService class in the Services directory without changing it's namespace - it's seems one step closer to the target.
@nickchapsas
@nickchapsas 3 года назад
Yeah the firname rename will come in the 2nd video. Yeah that's another way to go about UserService but I personally hate it when the namespace doesn't reflect the folder structure so I left it there. I will address it in the 2nd video as well.
@ryan-heath
@ryan-heath 3 года назад
Actually, regarding being backwards compat., method signature of public method includes the name of the parameters. It is a bit far fetched, but reflection legacy code that depends on firname would break.
@nickchapsas
@nickchapsas 3 года назад
@@ryan-heath You are completely right and it would definately be a problem if the harness project was using named arguments but since it doesn't we can change it safely. That being said, thanks for the awesome comment because it allows me to address it in the part 2. It could 100% be a question that the interviewer asked. Sort of like, "You renamed the parameter but now you might have broken a consumer using named arguments" which is a fair point.
@xlerb2286
@xlerb2286 2 года назад
I'm glad I wasn't the only one getting itchy about 'firname' :)
@RichardONeil
@RichardONeil 3 года назад
Fantastic as always
@ferooref7614
@ferooref7614 3 года назад
Incredibly useful stuff, THANKS
@lahcencodery
@lahcencodery 3 года назад
Now am waiting for part 2 more the Attack on titan episode 11!! You are the best
@brandon_.
@brandon_. 2 года назад
Great video Nick, thanks!
@cnuauk
@cnuauk Год назад
This is what pair coding delivers when interactive and this is how you'd sound and come across when you have the Experience too easily missed that that he's doing is from a developed skillset that comes with practice. you'd think you're taht good because you can follow it until put upon to do the same and explain what in your mind is the obvious. explaining the obvious the the real work, to explain what you already know well, not neccessarily to crack a problem you are encountering for the first time. yeah?
3 года назад
More videos like this please!
@cas4425
@cas4425 3 года назад
Great vid, thanks!
@zalew94
@zalew94 3 года назад
I would initialize mocks inside test methods - then you have more control what is going on, independent and avoiding situation where one setup can override another.
@nickchapsas
@nickchapsas 3 года назад
You never run in this issue with xUnit. They will always run individually and isolated unless specified differently, and NSubstitude will retroactively update the proxy classes.
@zalew94
@zalew94 3 года назад
@@nickchapsas I used to play with NUnit. This is what I missed. Thanks for clarification.
@roko567
@roko567 2 года назад
Amazing content
@codingwithtien
@codingwithtien 3 года назад
Great content, i learned a lot from this.
@Esgarpen
@Esgarpen 2 года назад
I spent weeks in uni trying to understand the whys and hows of unit test(ing).... they should just use this video as their lecture :rofl:
@shaunwhyte6686
@shaunwhyte6686 3 года назад
that was really good thanks!
@egorolenburg7900
@egorolenburg7900 3 года назад
Wow, cool very much appreciate your work, keep going bro!, Would be great you you could make some videos on garbage collector 😉
@ZintomV1
@ZintomV1 3 года назад
Really good video.
@crisu85
@crisu85 3 года назад
awesome vid !
@jr.BoarOfGold
@jr.BoarOfGold 3 года назад
This is brutal, LLLLIIIIIIKKKEEEEE
@EngineOfDarkness
@EngineOfDarkness 3 года назад
32:08 I don't code in .NET but I assume that "" and null are handled different for the "Theory" Testcases, as such aren't you missing the "Theory" InlineData for the null checks on firname and surname? Perhaps I'm a bit nitpicky though.
@diegoclemente2022
@diegoclemente2022 2 года назад
Hi Nick! Do you have the code before and after the refactoring? I found it very interesting to apply as test. Thanks.
@nickchapsas
@nickchapsas 2 года назад
I do have it available for my Patreons
@maggieliu8966
@maggieliu8966 2 года назад
Hi I wonder why you don't create repository each time in the service class? Is each repository opening a new connection to db and has its own context? Thank you! Another question is when you are writing test, is each time you run the test it is going to actually writing to db?
@mikkailmontgomery6175
@mikkailmontgomery6175 2 года назад
Is there a senior or junior level interview project?
@compscilaw
@compscilaw 3 года назад
Extract Interface, my friend.
@FP5i
@FP5i 3 года назад
Great video! Sorry if I'm mistaken but haven't you just introduced a memory leak? Removing the using statements locally without implementing IDisposable in UserService is should be it. Of course you cannot implement it, because of the constraints regarding to the Program.cs.
@nickchapsas
@nickchapsas 3 года назад
This is a misconception. We actually made it better. By keeping it as a singleton and not disposing, but instead reusing it and subsequently the HttpClient, not only there won't be a memory leak but performance will be better.
@FP5i
@FP5i 3 года назад
@@nickchapsas I see you point but only inside AddUser. In Program.cs, after calling it you still haven't disposed the HttpClient even if you won't use it afterwards. Isn't that a problem?
@nickchapsas
@nickchapsas 3 года назад
No not at all. The client will remain alive for as long as the UserService will which is what we want. This is a case of using the using statement for the wrong reasons at least with what we know today. What I didn't mention is that this is a .NET Framework 4.0 project originally. You would be right btw if this was a memory stream instead of a http client.
@FP5i
@FP5i 3 года назад
@@nickchapsas Yeah, I see, you're right. Thanks for the explanation! Looking forward to the next video 🙂
@Devinfrbs
@Devinfrbs Год назад
My only concern with this is that you're refactoring is changing things specifically for testing purposes. With this, every single class will always implement an interface. That seems excessive.
@alexXove
@alexXove 2 года назад
Too much boiler plate code from my point of view, maybe it works if it's a small project
@BaffourKTonto
@BaffourKTonto 3 года назад
Implementing the Dependency Injection part is where am having a problem, have a webforms project (.net framework 4.8) that I want to do that for. It's layered and am thinking if I can do that just in the application layer. It'll help a lot with testing. Following this, it appears not to resolve. Can you help with another video?
@DanteDeRuwe
@DanteDeRuwe 3 года назад
In school we actually learned to name the test methods `Method_When_Should()`... This way you have the result of the operation at the end. What to you should be the standard and why? Is it arbitrary or does it have any advantages I'm missing? Thanks!
@nickchapsas
@nickchapsas 3 года назад
I don’t like When Should and I’ve never seen it in the real world either. I use Method should when because it reads like a sentence that a human would write. Try to read what you wrote. It just doesn’t read like English
@DanteDeRuwe
@DanteDeRuwe 3 года назад
​@@nickchapsas ​ Example from own code I wrote once for a unit test for the LoginController: `Login_ValidationSuccess_ShouldReturnToken()`. (This was using fluent validators) This seems pretty readable to me. I feel like this way it's more like "given A the system should do B". Of course, it's a preference, but feel free to provide your opinion. Convention is important after all.
@nickchapsas
@nickchapsas 3 года назад
@@DanteDeRuwe I would prefer something that reads like this: The token should be returned when the validation was successful. This would be written as Login_ShouldReturnAToken_WhenValidationWasSuccessful. I find that this reads better than Login_ValidationSuccess_ShouldReturnToken
@superhussein
@superhussein 3 года назад
should this be understandable for a newbie who has programmed only one month?
@nickchapsas
@nickchapsas 3 года назад
Absolutely not. For someone who has been programming for only a month, just focus on baby steps and take it easy. Topics like the one in the video will come later
@BigMaaaaaaan
@BigMaaaaaaan 3 года назад
Why didn't you use ISystemClock instead of custom IDateTimeProvider?
@nickchapsas
@nickchapsas 3 года назад
Isn't ISystemClock an interface in Microsoft.AspNetCore.Authentication? This is a .NET Framework 4.0 legacy project (migrated to 5.0). Even if it wasn't, it has a DateTimeOffset and it is only providing UtcNow, but this project is using DateTime.Now, not Utc so it wouldn't make sense, logicwise.
@johndoe-cd9vt
@johndoe-cd9vt 3 года назад
in the UserServiceTests class, in the constructor, you use "new UserValidator(_dateTimeProvider)", can you use an instance generated with Substitute.For() instead ?
@nickchapsas
@nickchapsas 3 года назад
_dateTimeProvider is created using Substitute.For()
@janoslaszlo9096
@janoslaszlo9096 3 года назад
Great video, quality content!
@jacjac1383
@jacjac1383 3 года назад
when is the next part?
@nickchapsas
@nickchapsas 3 года назад
Scheduled for the 22/2
@jacjac1383
@jacjac1383 3 года назад
​@@nickchapsas cool! I guess it will be Template Method and Validator with chain of responsibility )
@nickchapsas
@nickchapsas 3 года назад
@@jacjac1383 It's Validation separation and fixign the single responsibility violation
@jacjac1383
@jacjac1383 3 года назад
@@nickchapsas exactly! I mean that single responsibility for this code could be implementation with template method pattern
@nickchapsas
@nickchapsas 3 года назад
@@jacjac1383 Ah I see. Nah, not a fan of template method or anything that involved inheritance. We will solve it in a more elegant way
@BL0NSKY
@BL0NSKY 3 года назад
liked and subscribed.
@LuigiZambetti
@LuigiZambetti 3 года назад
How did you learn C# so well Nick? Books, videos or other?
@nickchapsas
@nickchapsas 3 года назад
Haven't ever read any books for C#. It's mostly by googling to get problems solved and for the most advanced stuff it's usually a Jon Skeet blog or a MS doc.
@LuigiZambetti
@LuigiZambetti 3 года назад
@@nickchapsas Ever read any book?
@nickchapsas
@nickchapsas 3 года назад
@@LuigiZambetti Yes but non-C# ones. Clean code, clean coder, head first, design patterns etc
@LuigiZambetti
@LuigiZambetti 3 года назад
@@nickchapsas Why don't you make some video reviews of the book you have read?
@nickchapsas
@nickchapsas 3 года назад
I already have a video about books in the channel
@carlosl8832
@carlosl8832 2 года назад
👍👍
@farzinfaghirnavaz1027
@farzinfaghirnavaz1027 3 года назад
Hi Nick , i am a Patreon , but i am not able to find the source code , can you send me the link please
@nickchapsas
@nickchapsas 3 года назад
Please message me in Patreon
@aniketkhot6023
@aniketkhot6023 3 года назад
10:55 here u might want correct what you are saying, i dont understand passing date of now and subtracting it from now will eventually fail rather it wud give same result everytime ...
@nickchapsas
@nickchapsas 3 года назад
Let's say that you don't mock it and you leave it as it is so DateTime.Now. Now you write a test that uses 19/02/2021 as the date of the user. This test validates that if you are 21 or less then you can't use the service. The test will pass if run today because you are 21 and you are checking for a failure. Now let's say that you run the test in 1 year's time. Now the test will fail because since a year passed the check will give you an age of 22 and the test will fail because you are over 21 and creation will succeed.
@55941ana
@55941ana 3 года назад
Shit this looks scary for noob programmer like me. Started my first job for 6 month as junior backand developer C# .net framework and sql database. Just doing CRUD operation most of mine time and writing sql store procedure and table.
@nickchapsas
@nickchapsas 3 года назад
Don't worry. Tests like this are designed to see how far you can go and there are different expectations from different engineer levels. What I'm showing here is what would be expected by a senior engineer. A junior engineer would pass this test with way less requirements. Keep in mind that in junior engineers we are looking for potential not skill.
@moose43h
@moose43h 3 года назад
Οκ το thumbnail με έπεισε
@nickchapsas
@nickchapsas 3 года назад
HAHAHAHAHAHAHA
@gameglitcher
@gameglitcher 3 года назад
So far 10% of your sub count have watched this video. 10% of the people who have watched the video have liked the video 20% of the people who liked the video commented. It smells of Fibonacci..Until you realise I fudged the numbers because they were all pretty close.
@nickchapsas
@nickchapsas 3 года назад
And only 30% of the people who watch my videos are actually subscribed 😂
@gameglitcher
@gameglitcher 3 года назад
@@nickchapsas 50% chance that is true lol
@nickchapsas
@nickchapsas 3 года назад
If you have an interview coding test and you want me to create a video solving it, please message me on social media or add me as a collaborator in the GitHub repo that has the code and the test description. Make sure you didn’t sign confidentiality or an NDA.
@mohamedelhakim5966
@mohamedelhakim5966 3 года назад
How can I thank you ❤️ I had an interview a week ago which I failed , was focused on unit testing , I knew why was rejected
@_Bence
@_Bence 3 года назад
Thank you Nick! Very informative!
@Nobonex
@Nobonex 3 года назад
You've been pushing out a lot of quality content, thanks!
@johnhapsas1
@johnhapsas1 3 года назад
Excellent !!!
@nickchapsas
@nickchapsas 3 года назад
Thanks dad ❤
@belugaaa6649
@belugaaa6649 3 года назад
Zero dislike tells everything, absolutely loved it :) please do more of these . I would love to see if we can do a 30 day challenge ( spend 30 mins everyday youtube Live and build a solution from requirements all the way to production ready). Hit like to convince nick in doing this.
@HuntsWorkshop
@HuntsWorkshop 3 года назад
Excellent video! I hope the KISS folks that always roll their eyes at creating Interfaces and Proxy Classes now understand why we do it!
@StephenOwen
@StephenOwen 2 года назад
SUT = System Under Testing, in case you are wondering! It's an olddd term that comes from old ITSQB (International Software Testing Qualifications Board) specs.
@krccmsitp2884
@krccmsitp2884 2 года назад
We have therefore named it "Subject" to make it clear that you test something of arbitrary granularity, and need not be an actual "System" in the original meaning.
@marcosdeaguiar6168
@marcosdeaguiar6168 3 года назад
This is the best .net channel ever! Congratulations!
@qaerdogan
@qaerdogan 3 года назад
love it! barabing barabong :))))
@JackLyons00
@JackLyons00 3 года назад
Great seeing how someone else approaches refactoring, especially when it's so clearly explained. Look forward to your future videos.
@joaonadais923
@joaonadais923 3 года назад
This is great Nick! Looking forward to the second part!
@rafalrocks
@rafalrocks 2 года назад
Tremendous content. About 3 hours worth of info crammed into a half hour. Had a lot of aha moments watching this. Thank you
@DevMeloy
@DevMeloy 2 года назад
Your first question before refactoring any code is why are we touching code that is "sound" and is not causing any issues. The easiest way to introduce bugs is to modify something that is working to "make it better". Normally I would reject a PR which has unnecessary changes unless the developer can justify the change.
@yUnG_LeaN_
@yUnG_LeaN_ Год назад
Nearly a week ago i got that as a test task from 'X' IT company for junior c# dev position. I failed cause of not using DI....If i watched ur video before, bruh i think i would have a job with x2 higher salary than i have at the moment But big thank you for showing what DI is really being used for
@jlecordier
@jlecordier 4 месяца назад
So to summarize, before you can modify the code, you need to test it. But before you can test the code, you need to modify it. Guess I'm fucked then.. 😂
@krccmsitp2884
@krccmsitp2884 2 года назад
Great video as always, even for advanced developers. What bothered me the whole time, however, was that "firname" typo. My inner Monk was thinking the whole time, "please correct that first". 😉
@StephenOwen
@StephenOwen 2 года назад
Ok guys, understand that if this seems easy to you and obvious...then you're qualified for the job. Everyone makes the sins he is fixing in this code when they're self-taught and don't know any better, or have awareness of best practices.
@piotrsidor33
@piotrsidor33 Год назад
I have a question what to do if in your task you also can't edit clientRepository so you can add to it an interface, also a proxy class with interface is a solution?
@TheNorthRemember
@TheNorthRemember Год назад
can you please explaine what you did with the default constructor 19:10 , why the new instantiation?
@davidlundquist
@davidlundquist 3 года назад
I don't know if you want to do.net then I think your biggest problem is not cracking the interview
@babayaga4329
@babayaga4329 2 года назад
really fukin good man. respect
@keenkidash7616
@keenkidash7616 3 года назад
This is amazing. Thanks for covering that, Nick
@nikogj9495
@nikogj9495 3 года назад
Is the legacy project is available somewhere to be downloaded ? I'd be curious to send to try the refactoring exercice myself and even send it to my collegues :)
@nickchapsas
@nickchapsas 3 года назад
This version of the test is is available to my Patreons but if you do some snooping around on GitHub you will find other versions of this test as well.
@Codestud
@Codestud 3 года назад
Your UserService class is about 100 lines but the code to test it all is over 130 lines. This means you’re writing more code in the test class than the functionality it is testing. In my 20 year career of being in the real world of deadlines and having to deliver software in companies, I have found there is never the time to write the code itself as well as a huge battery of tests to go with it. Don’t get me wrong, it’s a nice ideal to be able to test every single combination as well as the happy path but in my experience there is just never the time I’m afraid.
@nickchapsas
@nickchapsas 3 года назад
My experience differs significantly. In a world where product quality, stability, scalability and performance makes or brakes a company, investing the time to write tests just saves you time that you will spend debuging later. If a company can't see that then you should probably find a better company to work for.
@noemi.farkas
@noemi.farkas Год назад
So good! Thank you, Nick!
@GuidoSmeets385
@GuidoSmeets385 2 года назад
One suggestion I would make is to not group your stuff by "what it is", but by what belongs together for a set of features. That way you open up your folder, and everything you're working on and that might change together is stuck in the same folder.
@nickchapsas
@nickchapsas 2 года назад
This only works if your domain is wide enough. I only work with microservices which only focus on one feature, so my vertical slice is my microservice itself. This doesn't apply in this video since this is more of a wider scope service, so I COULD split by feature, but I almost always find it convoluted unless your domain is wide enough
@GuidoSmeets385
@GuidoSmeets385 2 года назад
@@nickchapsas fair enough. Our services are sliced vertically as well, but still large enough to want to group beyond that.
@GiovanniOrlandoi7
@GiovanniOrlandoi7 3 года назад
This is a really good video
@matthewkeenum
@matthewkeenum 3 года назад
Excellent video! Thanks so much! I do have a question about the IDateTimeProvider. Rather than creating an interface to provide a "current date time" couldn't you just have the birthdate always be 27 (or a variable to modify the age) years earlier? It seems to be more complicated adding an interface when you could just make the birthdate as DateTime.Now and add -27 to the years.
@nickchapsas
@nickchapsas 3 года назад
Actually the need for the interface is universal and it isn't specific to this problem. It is a must for unit testing and it's so common that ASP.NET Core now has this built in as the ISystemClock interface. You really should be doing that if you want consistent unit testing.
@mesh475
@mesh475 2 года назад
@@nickchapsas I'm going to make 6 figures some day because of you.
@HoleyMoleyAlex
@HoleyMoleyAlex 3 года назад
It's interesting that you write a unit test for the legacy code, because in most situations a refactor of legacy code is required because it's simply not possible or at least very difficult to unit test it without the refactor, so I makes a logical sense to make it testable first as part of the refactor. I guess you just have to be careful you don't break it in the initial refactor to make it testable.
@MatteoGariglio
@MatteoGariglio 3 года назад
Why not mocking the DataAccess? Your Proxy (in the unit test) is actually calling the "real" static class, isn't it?
@nickchapsas
@nickchapsas 3 года назад
Because you can’t. The rules of the test say your can’t modify that class at all
@jmbrjmbr2397
@jmbrjmbr2397 2 года назад
I like you.
@mohamedelhakim5966
@mohamedelhakim5966 3 года назад
You can move your files in rider faster Ctrl + shift + r ---- move to other folders
@portlyoldman
@portlyoldman 3 года назад
Having a parameter driven DateTime.Now is useful in many way other than just testing. Often a large system will need to be able to act as if it is at another time (month end is a poor example) and this approach to environmental ‘constants’ can save your bacon ( or religiously permissible alternative).
@Ruisrd
@Ruisrd 3 года назад
Hi Nick, excellent content, very helpfull, thank you so much Can you share the initial project? I want to follow your refactoring
@basickSkywalker
@basickSkywalker Год назад
Thank you, it is interesting how you manage to setup testing for static class via a proxy. nice one
Далее
What is Span in C# and why you should be using it
15:15
Thoughts About Unit Testing | Prime Reacts
11:21
Просмотров 225 тыс.
Microservices are Technical Debt
31:59
Просмотров 327 тыс.
Testing in .NET is About to Change
12:54
Просмотров 65 тыс.
How Senior Programmers ACTUALLY Write Code
13:37
Просмотров 1,5 млн
Brutally honest advice for new .NET Web Developers
7:19