hey everyone so anyone who follows me or the podcast will know that I'm a huge fan of Jack Prince Rider it's such an awesome amazing. net ID I used to use visual studio for many many years and heavily embraced with sharper which is an extension also by jet brand but for quite a few years now I've fully lived in Ryder it's got all the resharper goodness and it's just an awesome IDE too and it's cross-platform and whilst Rider is new-ish I think six years old it's actually much more mature than that as it's built on top of the IntelliJ platform leveraging and sharing many many years of common ID functionality and experience and shared plugins too so it's very very mature and because of that common shared core idea you can do much more than just. net with it I've got a project I work on which uses angular for the front end I still use writer for that too I also write Powershell in it you can do C sharp F sharp vb.
net CPL plus SQL and more so let's dive into Rider and I'll show you why I love it so much so I'm going to show you the UI with some tips and tricks then we'll dig into how to Leverage The Sharper engine and keyboard shortcuts to make you a lot more productive and we're looking to how to run unit tests and continuously run your tests as you code then lastly we'll have a quick look at git integration okay let's do this so this is Rider and it's an ID so if you're a developer and you're used to any form of ID you'd be used to the concept of a solution Explorer it's got various pins along the the left the bottom the right hand side we've got the run and debug stuff and choosing your configuration so it's all pretty standard stuff but one thing I really like about Rider is it's very very keyboard shortcut driven so for example each of these the solution Explorer is alt one you get is alt seven if I cover of the mouse over alt 8 for unit tests L7 for unit um for nuget out nine forget and by doing that so if I do alt one I can go quickly toggle I think in Visual Studio it might have changed if you do I think it's Ctrl alt L that gets Absolution Explorer but you can't just toggle it away you can't just press it and keep on toggling boxing forward like this is just for all of the different ones you want it's just really fast another shortcut I really love with this is and I can't remember whether I set this myself if I look in the settings Control Alt s for settings by the way team up and search for resize then these ones for resizing Windows Control Alt shift and left and curse keys and things so that allows me to very quickly just resize so if I get up um you get or whatever's funnels I can resize that and it's so much faster than just oven to find the mouse find that edge where you can capture that and doing that you can just go to glue move resize stuff around it's very very nice there's there's other ones like control shift F12 just gets rid of all the pins temporarily and you can press it again to get them all back again you've got whatever your last selected pane was shift Escape gets rid of it oh okay maybe not the last selected then the last one I out one two or one that's that one yeah so let's have it whichever one you press the keyboard shortcut to get to shift Escape seem to get rid of it and then you can bring them all back uh yeah so let's talk about some other keyboard shots you can use all the time in Rider if you used to be sharper you're probably used to control t which brings up search everything you can do shift shift as well which does the same and it allows you to literally search everything so you can search for files you can search for symbols you can search for settings actions so if I type weather forecast I can very quickly go to that if I let's go for summary if I close this down if I did shift shift summary I can very quickly find that property if I search for come on like commit I can document I can also see settings and if if there were toggles you can get stuff in line as well so you can change them without going to that settings dialog so you can see they've really thought about keyboard first but as far as coding because it's a code editor let's look at some very useful commands that we can use for coding one I use a lot is alt insert so for example if I'm in let's go to a class alt insert [Music] so from the class I'll alt insert I can choose a Constructor or instead of property if I'm over here in the solution I can do it alt insert and choose create a new project from in a class I can do alt insert go to new directory or file so Alton so changes a lot depending on your context so let's actually create a new directory call it handlers then again alt insert again on a class and call it my handle so alt insert again Constructor so I'm just I'll insert into actually create the initial things if I do I logger for example so as well as alt insert another keyboard shortcut you can use a lot is Alt Enter so and again this depends on context to what it does I'll tend to here I can say introduce a read-only field logger so that's created the backing field here and it's assigned it if I now say I want to use this let's go to shift shift weather forecast controller so I want to inject my Handler Alt Enter again introduce readon field and then I can start using it and say I call a method called Edge key which doesn't exist again I'll tend to create method so that's crazy for me now I've realized I made a mistake I wanted to actually use an interface here so let's do uh my Angela Alt Enter so again I'll tend to all the time create interface I want this to be in its own file Alt Enter move to its own file then go over to the forecast controller I actually want to be using the interface instead I I've got this error this red squigglers Alt Enter change type of fields to the interface so very quickly allowing Alt Enter to just fix things for me so our interface hasn't actually got the execute so another very good shortcut here is Ctrl shift R does refactor this so again it depends on context to where you are so I'm here I can do Ctrl shift R I can change the signature which actually gives me a drop down so it'll pop up which allows me to change parameters and various things which is very powerful which will be changing a signature that's used throughout a large code base you can this can do a lot of the work for you but that control shift R you've also got pull methods up which is going to pull methods up into the interface or the Base Class of whatever um it's parent in the hierarchies so execute that's fine and now that's pulled that if I F12 on the on my Handler it's pulled it up so if I go back to the weather forecast controller that's fix the compiler so you can see how I'm really leveraging alt insert Alt Enter and just the ID is doing a lot of just the good work for me so one thing you might notice on the right hand side we've got a bunch of yellow here now I always try for to make sure I've got good code quality to make sure that's green so you can see there's a few things here that are grayed out but I can do alt Page open page down to jump between them so this is saying log is not being used okay let's use it I could delete it I can use it it's a demo I don't mind what it says and we've got some more so alt Pedro and it's saying that all is using direct directives aren't being used I'll enter I can remove using directings in the file I can press write and say fix this up in the entire folder project or solution other things like here we can see that new it's grayed out slightly so I'll tend to again so again this is like by far the most common keyboard shortcut you can be using all the time in Rider and it's saying it can use an array initializer so it simplifies your code and with a lot of the new c-sharp language features why just how I learn about them because it makes recommendations and suggestions and now we can see that we've got green at the top no problems found so let's have a look at some tests now we want to look how tests work so again going over to I mentioned before if we're on the solution if we do alt insert then you can create a new project so I'm going to create next unit project call it by the demo dot tests and this is going to use web application Factory which is the sp. net way of doing integration test against web API so I'm just going to say bar web app web application Factory there's new web application Factory now I've not got the new nuget package that does this so again I'll punter I can say find this type on nuget. org it's found it's this this is the one I want I can add it and that's now install the nuget package so it's still it's still red I'll tend to again import missing references so it's just adding the using I also need to add a reference from my test project to the main project I'll do that here and then so then I can do program which is how you do web application Factory and then I can say web application factory.
createclient which is going to create an HTTP client again Alt Enter introduce variable and it's giving me a name so that's fine I'll take that either I want to say HTTP client a get request to what do we call it weather forecast so this is an AC method so if I say await we've got we've had squigglys again have a guess I'll tend to and it's gonna So currently it's public void on this one it's now async tasks so that now compiles Alt Enter gun introduced variable a tab I don't like that I'm just going to click response enter response dots so now I want to assert this I quite like a nuget package called fluent assertion so alt F7 for you get packages and I'm going to type through and fluent assertions I'm going to click add this one and then I should be able to do status code should so fluent assertions does this should be it's just a nice clean syntax or HP or HTTP status code okay and even little things like that my cursor was here but I pressed semicolon and it it knew to put it at the end not in front of the brush or the parenthesis so we now want to run this because I'm going to bring the construct to here you can see where this I click here and say run debug or have a guess what you're going to press now I'll enter and I can run it from here and then our test has failed so I can probably guess what this is is probably because we're injecting my Handler but not registering it so if we go up to here and just register this um our transient by my Handler my Handler and again we've got some warnings so here I can do Alt Enter and this time I'm going to do it across the entire solution just to clean up so that would have removed all of them across the entire solution and tidy things up a bit and close that if I run this again now I've got a pass so if you've got lots of tests running you might want to run the test continuously so there's this button here and you can say cover new and outdated tests because I've not done coverage before I just run them I'm just going to click yes it's going to ask if it wants to start off by doing them all so it's covering my entire project it gives me code coverage it also gives me these good items here so this tells me whether a screen it means that this code is passing so obviously this is in the test but it would also do the same in your like code as well and in the controller if it's white it means that the code you're looking at isn't being covered At All by tests if it's red it's covered by a failing test so for example if I go to the controller and then let's say let's change this to I action results and let's return Bud request and then run the test again so Ctrl uu oh it did it automatically anyway I was going to say control uu will run your last test executions for the same test again but I'd forgotten I'd turned on continuous running so it did it for me anyway and you can see it fell straight away and you can see that the test said so but literally as I was coding um it came up and run my test for me and failed and it said that it was 200 but it actually got 400.