VS Code Tutorial For C# Developers

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Visual Studio code is my favorite code Editor to build all sorts of applications and that is because it is free it is very lightweight you can use it in Windows Mac OS or Linux and it is really really fast so today I want to show you how you can start building your C applications using visual studio code to get started you're going to need to install two things in your box let me show you this page very quickly the first thing you want to install is the net SDK or software development kit so the SDK is what includes every single piece of tooling that you're going to need to build run and test your net and C applications right and to get to this page all you have to do is just go to net SL unload and this is going to offer you the latest version of the net SD which at the time that I'm recording this is version 8.0 it could be different for you and it's also going to offer the version for your OS right in my case that's windows xc4 but it may be different depending on the OS that you're running right and so I already have this installed I'm not going to start it again uh but installation process is really fast so that that's that's very simple and then the other thing is of course Visual Studio code right you can get Vis Studio code at code. studio.com and then all you have to do is just click one of these two buttons and that's going to take you into the download and installation super fast which is one of the things that what I like Vis code and you should be ready with Vis stud code open in just seconds right and so yeah that's what you need to get started and then you're going to land of course in the main UI of Vis Studio code so let me start by walking you through this UI very quickly right right so from the left side the first thing you're going to notice is that we have this section here which is known as the activity bar so the activity bar is the one that is going to take you into different um different sidebars of Vis Studio code so if you click for instance on this one here the Explorer that's going to open the Explorer sidebar right where you're going to we're going to see a bunch of files in a moment but there's also this search section over here to search across files we have integrated Source control also in Vis to code we have a view for running and debugging and also we have the extensions viewed over here right now let me close that for a moment now of course in the center over here we have the the main section where we're going to be working in in our code right we're going to take a look at that in a moment H at the top we also have our menus our menu bar with a bunch of menu options and then at the bottom and let me open that by doing you can either do uh view uh terminal right here that's going to open the the bottom the bottom panel over here or you can also use shortcuts I mean it's a good thing to start learning shortcuts for Vis 2od because you can do everything here using shortcuts so for instance to open and close the terminal you can either do control TI like I'm doing right now control TI or you can do contrl J which is my favorite shortcut to open and close that terminal right now since we have the terminal open over here one thing that you should do right away is to verify that your do installation has has completed successfully right and to do that all you have to do is just type net Das Das version for instance and that should pop up right away the version that you're using of net as you can see right now 80 100 that's the one that I have installed so that confirms that net has been installed properly if you wanted to you can also do ninfo and that's going to give you even more information about everything related to net that you have installed in your box but yeah net is ready so that's good right now the next thing before we start actually creating applications is that I want to show you a few small customizations that I like to do in Visual Studio code just so that the experience is is a little bit better right and so what you want to do is go into the settings of Studio which you can go to by going into file and you can do preferences and then you can do settings over here and so let me show you a few of the settings that I usually change here the first one is going to be this one called and you can just type here place open brace like this so this is going to show up a few options and the ones that I like to to enable are this these two ones over here let me show you these two ones over here so place open brace on new line for control blocks so this this so that the open brace opens just after your if else or switch it just opens after that so it renders nicely there and also the other one place open Rays on new line for functions is so that when you open a function a function block it also it throws the open Rays on the on the next line right so just some customizations that I like you don't have to use them but uh I find that very useful so that's the first one the next one is going to be a format on Save format on save so it's going to be this one over here right there and I like this one because that means that anytime I save file it automatically gets formatted right so that it gives you a good shape right away we don't you having to do all these formatting manually right and so that second one and the last one is this one if you go into file and then into out to save this one over here which I already have it ticked that's going to make it so that anytime you go ahead and write some code uh just after a second it's going to immediately save the file right so that way you'll never risk losing any of your code as you're writing it okay so now let's go ahead and close this and and close that and so but how do we actually get started creating C projects in Visio code so for that what you want to do is start taking advantage of extensions there's a massive set of extensions available for Vis code that adds all sorts of a improvements into the vs code experience and the one that you absolutely want to install here is the one that's called the C de kit so I'm going to just type here C de kit all right so that should show up right here so it is this first one over there dev kit right which is by Microsoft right and this is the one that not only enables the C features in Vis Studio code but also adds a bunch of improvements into the World experience in Vis Studio code so that you can manage your C projects in a much better way right so I'm going to go ahead and just click on install and this extension is by the way not going to install just one extension it's going to install a few extensions like the C extension and a couple others so so it's kind of a pack of extensions and it should just take a few seconds to get to get installed okay so it is installed now so let me show you if I just clear this let me show you what got installed if I open this section here what you're going to see is that now we have of course we have the C dev kit right there we also have the C extension which provides the base language support for C right for the intelligence and all these nice things on C we also have int code for the C the kit which adds a little bit of AI assisted development for C right so it kind of predicts a little bit a few things as you're writing code right and also we also have this that install tool which kind of manages what version of doet is being used by vs code itself to provide all these C inces right so those are the ones that you're going to get installed right away by doing this so now that we have that in place the next thing that I can recommend you do here is to actually set up your workspace right so what you want to do is just have one folder that is going to be the entry point for vs code to start creating all the projects right so let's go ahead and do that so to do that what you can do is just go into file open folder and in this case I'm going to use switch into my D projects directory there here I'm going to create just one folder I'm going to call this one BS code tutorial all right so BS tutorial I'll click on select folder and that's going to set out the workspace so that everything from here on is going to be focused specifically in that uh in that location right and in fact for instance if I just go I'm going to close this if I open my terminal contrl J once again notice that it right away starts in the vs tutorial directory right so everything is going to happen right there from here on right let's close that so how do we actually create a a c project here so what you can do is take advantage of the command plate the command plette is a is a key artifact of vs code that you really want to get used to because it's super super useful now to open the command plette what you can do is just go into view command plate click there that's going to open it right but a faster way to do it is just to the the control shift p combination control shift p is going to open this and this is going to show show you all sorts of commands that are contributed by multiple extensions into to vs code that is going to make your life relas right and the one that I want to use here is actually the one that I have right there which is remembering it it will remember the the layers us it want so net new project so if you don't see it just type net new project that's going to show up right there so click on that and that's going to go ahead and open up this kind of a wizard with a bunch of options for you to create your donet project right and so in this case let's say that we want to go ahead and create I mean we could create any type of application but let's go ahead and for our web API since that's what at least I am most used to to create so exp core web API let's click on that so in this case I'm just going to name this my web API so nothing fancy hit enter now you you want to pick what is going to be your directory so in which directory this going to be created as you can see it's it's defaulting to the name that I typed on under the vs tutorial directory so that works for me so I'll click on that okay and what you're going to see on the left side let me just collapse the terminal for a moment you're going to see that uh it pops up our brand new a folder my web API with all the typical FS you're going to find for a typical web API project right but not only that uh you have here what you have here is what is known as the file explorer view right but since we have the C Dev keit installed we also get another view which is actually down here notice this this is the solution Explorer so if we collapse this and expand that other one you're going to see that this is a kind of a virtual view of your files but it also enables a bunch of other features that are not enabled in a normal Explorer view now before we go ahead and start working with our project one thing that I like to do is to a little bit of U color if anything into our our views here because I mean they are okay but I think they could look much better right so one thing that you can do in BS code is actually add things of icons so these things look better so if you go into the extensions view once again um there are a few icon packs that you can add here uh but the one that I discovered recently which is actually very good is this one called material so just type material over here and this is going to show up I think it's the very first one so material icon theme it has 20 M downloads at the time that I'm recording this and so I'm going to just click on install this should be super fast right so I'll click on that all right and now that this is installed what you're going to see is that the icons look uh much nicer right so notice this these colors here looks much nicer both in the file explorer View and also in the solution Explorer right so it's a nice way to be able to quickly identify your your files that you have in your project and so one of the things that you expect to be able to do right away as soon as you create your project is of course to be able to start running it right by doing like like an F5 experience and so that's exactly what you can do with Vis Studio code so here's my project and even before we look at the code what we can do is just uh hit F5 so I'm going to hit a five in my box and this is going to prompt you to select what is going to be the debugger right for your application in this case of course it's going to be C so I'm going to click on C and later it's going to ask you what is going to be your your default configuration right so let's not just spend too much time on this let's just pick the default configuration right there and this is going to go ahead and build your project and then it's going to kick off a debugging session of your project is starting in BS code right so our API is now starting and you're going to see yeah all the debugging symbols load in there all right and of course this is going to open up and let me just move this into another tab right there yeah right there okay so this is opening right away the Swagger page that describes the default API that comes with our web API project right and so if you wanted to we can even go ahead and expand this click on try it out click on execute and that already executed our API we can see results over here right now uh if you're wondering uh if you can debug this project Vis Studio code so that's totally true and in fact we are in a debugging session so what we can do now is just go back here and let's go back into our solution Explorer Program CS let me collapse this for a moment and this is the typical startup code for a web API as you create a we.net uh what we can do is just place a break point so I'm going to place a breakpoint over here and you're going to see that we can easily hit that breakpoint and explore what's going on there so if I go back into our swager UI over here let me go ahead and click on execute once again and right away here in BS code we have our breakpoint it has been hit and I can go over forecast over here for instance and we can see the full list of weather forecast objects that have been created uh right there randomly in our API right as you can see all the details over there you can also see the locals on the left side look notice that we have variables we have the summaries we have the forecast we could even add a watch so I can right click on forecast and I can say add watch and that's going to show the watch right there on the left side right so there is first class support for debugging in your C application any sort of C application you will be able to start debugging just normally as in any other ID like visual studio for instance now since this is a web API project one thing that that I like is to not be opening the browser every single time that I'm going to debug it right because that that just serves no purpose I mean it's nice to have this this way of documenting our API but this is not right the main way that you want to be uh testing your apis all the time right so let me go back here let me just remove the break point and finish this and stop this so one thing that you can do to not have to open the browser every single time is to just make a small change into this file under your API properties launch S adjacent over here what you can do is just go into your HTTP profile right so this is the profile over here and just switch this setting here launch brow browser Sange it from True into false right and just by doing that if I just hit F5 once again we're going to notice is that the browser is not going to open anymore so the session starts uh but it's not going to open anymore right uh so which is great but if that is the case well what is going to be the the right way to start um testing or debugging my API right so what what would be that so if you notice let me open up here and let me collapse this over here there is a a file that comes by default I think it's sted with a 8 which is the HTTP file right which is right here this HTTP file so if you click on that one what you're going to see is that there is um there is already a few sentences here that allow you to go ahead and H directly from vs code you can hit your API so to exercise it and see what kind of results you can get from it now unfortunately by default in vs code you're going to see a you're going to have any kind of a coloring or a way to actually execute these lines that you can see here here right uh so for that what you want to do is just to install one more extension that will enable that functionality over here so just go back into the extensions pan over here and look for rest right and this is going to pop out the the very first one that you can you should see here this this one called rest line by waa Mao right so this is one that I've been using for for a lot of time and it works pretty well so I'm going to click on install on this one and you should startall really quick so yeah it is installed now so I close that and let's go back into the file explor into solution Explorer let's open web api. HTTP and notice that this time we do have coloring right and not just that uh we also have the ability to click this H this kind of a link over there to execute a request right so notice that this is the actual address of my API Local Host 5084 and this is the weather forecast endpoint that we can look at very quickly in pram CS notice that that is the AO that is right here right so want to do is just execute that directly with with with Vis Studio code so if I go back here what I can do is just well go ahead and click on send request right there and that immediately goes ahead and quer is the API and you can see the results right there uh in V so there's no need to get out into a browser and then switch screens no need for that so it's right here and if you wanted to I mean we can reenable that breakpoint right so I can go back into my breakpoint let me put that over here so we can see better close that I'm going to put put my break point over here right and so if I go back into my web API and let me collapse this I click on send request you're going to see that the breakpoint is hit just like before right but there's no browser this time it's right there and then I click play and then I get my results on the right side right there all right so that's how I usually do any sort of web API development uh in my BX there's no need to get it out of this all right and so okay now I'm going to stop this this debugging session and I'm going to close uh close a few screens over here now the next thing is that uh you probably don't want to be debugging your application every single time right sometimes you just want to run it and start exercising it to see how it works so you don't have to be debugging all the time and so another way to run your application is by just using directly the net CI which is one of my favorite ways to do this so to do that let me show you this so let me collapse this and let me just do contrl J once again to open the terminal let's go into the terminal tab over here so terminal right now the the console and I'm going to um I'm going to just delete one of these there's going to be a delete Buton right here delete but so I'm going to delete that to just go back directly to this terminal window and what I'm going to do is just go into my web API directory right so it's the directory of my API and really all you have to do to build your application directly in the terminal you just type net build right so that's going to go ahead and build your application and if you want to run it right you can go ahead and just type net net run so that's going to go ahead again once again build it and then run your application directly in the terminal right no need for a debugger and then once you are here what you can do is of course you can again go back to your HTTP file and you're going to click on send request and that's going to show up the results right there in the right side right so that's another faster way to start testing your API now how about the coding experience right that's the main thing about bs codes how how is that code experience working for you as a c developer so to show you that what I want to do is the following so if you go to pram CS right so you may have seen this or or not but really this this this API is all it is is a simple endpoint that all it does is that it creates kind of a range of five elements from one one to five and then for each element It prepares one of an instance of this wether forecast objects that's going to have a date a temperature in Centigrades a summary and then a conversion into temperature in fahrenheit right and so it's going to create an array of those with a bunch of random values right and then that just gets returned back into the client so that's how it works so what we want to do here is just to see how the code experience work is to add just one more element into this weather forecast which is going to be the season right so you know winter or summer or one of these Seasons according to the to the date that has been predicted for that forecast right so how can we add that season and calculate the right season in there right so for that what I like to do instead of just adding code here what I like to do and also to show you how things work in B code is to create a a class library right so how can we create a class Library to put that other logic I'm going to remove this break point over here so one way to do that would be to just go to Explorer of course and then as you would expect you can right click on your solution you can say new project and that that's going to open up this and you can go ahead and click for instance on class Library that's what we want to create there so that's one way to do it uh but I want to show you also another way to do it uh because I think it's very useful in many cases right which is using the C itself so if you go over here and let me just contr C so contr C is going to stop our application right and then I'm going to go up one directory right and so you can use net CI of course to create your projects and you can just do net new if you do D- list uh or actually is net new list I think is that the right way to do it these days yeah I'm going to show you the template for many different types of application that you can create right and I think is important to to know that you can do this because when you create things by using the solution Explorer by just doing new um sorry right here new project I mean this is Handy but it's not going to offer you many options that you may want to specify for a different for for your project for instance for instance if you wanted to create a net new web API right we can do here help and you're going to discover there are many flags that you can use for the creation of your API right so for instance what if you want to use controllers as opposed to minimal apis right so the default these days is been apis but maybe you want to use controllers so for that you could use this flag here Dash controllers or Das Dash use controllers so that the API is created by default with controllers right H what if you don't want to use a open API Swagger you can use this flag over here uh what if let's say you want to specify a specific framework right what if you want to use donet 6 or donet 7 you can use that flag or this other flag to not use https so there are many flags in there that are not available in the in the UI all the time but they are all available in the CLI right so just keep that in mind uh when you create your projects this is another way of very handy many situations now what we want to create now is a class library right so I'm going to just do net new class Li and we're going to name it just my library right so my my library right so I'll hit enter right so that went ahead and created our library so if you go back into Explorer the thing is that you're not going to see that show up in the solution Explorer because we didn't create it via that remember that solution Explorer is kind of a virtual view of things right and so but if you go into vs tutorial into the file explorer we want to see that the my library is right here how do we bring that my library into a solution Explorer well you all you have to do is just right click in the solution at existing project and then we select my library my library CS BR select project and then my library is going to show up right here right just along as you would expect next to this other project what we want to do now is to create this class that we talked about that's going to be able to to tell us what season is for the specific date that has been specified in the weather forecast so we have this class one that see us over here we were going to actually um let's actually get rid of it so let's get rid of it and let's just right click on my library add new file all right so it's going to be a class and the name of this is going to be weather weather calculator right so it's weather calculator okay so this is the class that is the what we're going to add just one function to calculate or to determine what's going to be the season so for that first thing is going to be that this is going to be a static class so it's going to be static class and then is this is going to have just one method public static string okay and so the method is going to be named German season and then it's going to receive a data only object we're going to name it date and then uh okay so how do we determine the season well first let's go ahead and capture the month right what month it is so date. month all right and then what what we likely want to do is to try to start playing with the with the month number right so if uh let's say month um is greater than or equals to three and also month is less than or equals to five right all right so at least in my side of the world that would be uh Spring right that would be spring and so yeah as you can see I mean there's all sorts of intelligence all over the place right so so that works just as great as it would work anywhere else right so first class support for intelligence in BS code uh but of course I mean this is going to get a little bit tedious right because I I'll have to go ahead and say okay so now if mon is from six to something else then it's another season and and so and so so that I don't like a lot and so for that what I really recommend you to do is to take advantage of GitHub compilot right now that is a paid subscription service right I understand that some people may not want to install it but I really really urge you to try it out there's even a free trial because GitHub copilot massively improves experience you're going to get in BS code uh as you're wri your code and today I I cannot really work anymore without using a gilot so let me show you how that's going to help us here so what you want to do uh after you have gotten a a either the trial or you are subscribed to gith Pilot and you can find a page for that very quickly uh that's very easy what you want to do is just come here and just look for copilot right and so in your you're going to see two extensions it's going to be GitHub kilot and GitHub copilot chat uh you can just go ahead and install I think either of them are going to install both of them so as you can see yeah both of them just got installed it's right there all right so it's installed so let's close this and let's go back here there okay and so you're going to notice that now we have this little icon down there so that means that gith pilot is up and running and ready to help us with our code so how is that going to help us here so let me show you this scroll down a bit and so yeah we know that if mon is is in that range that would be spring but what about the other cisss so let's go down here and notice that copilot already knows that from 6 to8 should be summer so I'm just going to hit tap and accept that suggestion right so that was all powered by copilot if I keep going down it should likely be able to get the rest of what I need right so just by doing this my code is pretty much complete it's not it's not perfect I it's not ideal uh but it suffices what I want to do right so with this this method is able to predict whatever season corresponds to that to that date right so that's how how useful pilot can be uh but there but there's more right it's not just that what we can do is the following so I can go ahead and because you know what having all this if else if else I mean if if if that's is kind of um not a great idea I mean that that could that could get boogy a little bit and it's just it's just too long it makes doesn't doesn't make sense there's much better way to do this so in fact I'm going to go ahead and select all of this right and I'm going to go ahead and open up and select this you see this liel you're going to see that opening up in many places in your code NBS code right especially when you have copilot also so I'm going to click on that I want to do is Select this option that says rewrite modify using copilot right and what you can see is that this opens up this little dialogue over there which is you can use to ask a pilot to help you with the piece of code that you have selected so in this case what I want to do is actually use a switch Expression A C switch expression as opposed to all of these if if if that I have over there so use switch expression right enter and so compilot should be able to now explore my code and suggest how I should I could rewrite this code as you can see on the right side the switch expression is right there right so string season equals month switch three or four or five is spring six or six summer and then and so on so so right and so which makes sense I mean uh I'll click on accept and as you can see now all of that code has been condensed in this one switch expression which is much better much nicer less error prone small method really like it and so all powered by kth hilot without me having to do anything other than prompting it for what I wanted to do and so yeah so that's that with that method and of course now we want to use this weather calculator in our API so let's see how we can do that so let's go back into the API and then uh let's go into program CS right and one thing that of course we have to do is to add a project reference from the API into the library so we can use the types in the library in the API right so let's right click on my web API I'll say adate reference into my library okay so that will give us access to that incs and now what we can do is the following right first thing is in weather forecast we want to add our brand new uh season H property so this is a record type all we have to do is just say string string season right so that's going to be the season and now we want to go back here and take advantage of our weather calculator so I'm going to just add here uh weather weather calculator dot determine season right and notice that cilo is also suggesting how I should pass in the date into the method I'm going to hit tab to asset the suggestion and as you can see it just takes dat time now at days as we're doing over here right and then it will translate that into a date date only object that's going to be sent into the termin system and so yeah that pretty much should do it uh but that being said I don't like H I don't like the the way that I mean we are calculating the time over here and then we are calculating again over here I mean that's not accurate that's not it's not good and so let's see if we can improve this a little bit by just selecting the code here and then once again notice the lightable over there so you can click on that and what we can choose here in this case is this one called extract method down here extract method should be able to take that out into another method right over here uh and then what would be the name what will be the name for this method what you can do is just hit F2 F2 that's going to open this rename H rename symbol uh dialogue and so the name will be let's say calculate date enter all right now this method uh it cannot just go into this location because uh because we have the This Record type over here uh and we are in the prcs so I'm just going to move it over there so now we have that method over there and what we can see is that well the name has been already used for for this and notice that this date only is no longer is not it's not needed really that that casting there so I'm going to just remove that and just like we're using calculate date over there we can also go ahead and use it over here right so now at least that logic is encapsulated into another method uh I think we can do a little bit even even better because we still we're still calculating the date twice right so the now that we're using there is not exactly the same one so how come we improve this well we can what we can do is just open and close uh a section over here let me grab this grab this over there so we're going to be returning return new weather forecast over there and this needs that and then let's move this over there okay and now that we have things in this shape what we can do is the following so instead of calculating the date twice well we we can just go ahead and say bar date equals calculate date with the index and now we can just grab this actual date and replace that over here and over there just small Improvement so that code looks a little bit better okay H so notice that H some of these H some of these castings are no longer required I mean for instance over here notice that this is Creed out because it's not needed this is also not needed so BS will help you uh with the help of the C de keit and the C extension to notice these things are not really needed so you can clean up thing things on the go by doing things like this and I'm going also going to uh remove this like that and so now we have our method pretty much ready so that should not include the season right so let's go ahead and test this out so I'm going to just go ahead and do go into my my web API I'll just do net run in my terminal all right okay so it is running let's go back into our HTTP file over here let's hit send request and as expected as you can see now we have the season right so yeah so pretty much for the DAT that I am I am in December at I'm I'm recording this uh it is winter over here and that's going to be the season that has been predicted for every single case right now this is good but uh I mean I'd like to know if this is actually going to work Beyond Winter right what what about summer what about spring is that going to work or not and so instead of keep playing around with dates uh directly in our production code what we can do is to add a test project right a unit test project so how can we do that in BS code so that's fully supported and so let me show you how that works so let me go back into my terminal contrl C to stop it so I just stopped it and I'm going to close all this so what we can do is just right click on the solution say new project and then what you want to do is just choose an in this case a big fan of xunit so I'm going to pick xunit test project you could also use Ms test or n unit I'm going to go for xunit right and and so I'm going to say my tests all right pick the default directory and then test project appears right here okay and so we have our unit test one class over there but we're going to rename that because we're going to be testing weather calculator right so I'll do F2 on the on top of unit test one and this is going to be weather calculator tests hit enter okay and then the class has been renamed uh we'll have to also name this the same way better calculator tests right and so one thing the first thing that you should do here is also get a reference from your test project into your in this case the class Library so right click in my tests add project reference my library now the test have access to the weather calculator class right and so of course now is time to write this test right and so you you can totally write in manually uh but that is something that I actually stopped doing a while ago uh because this is another thing where copilot can significantly help you right and so you don't need a full complete Suite of unit test but you can get a good Head Start by using a AI so let me show you how it works so what I want to do is go into weather calculator now right so here we are in backing weather calculator what I want to do is just select select the piece of code that I want to test and now what you can do is just click on these three dots right here in my case because my screen is a bit small and then look for the chat icon and so this is GitHub copilot chat so here you can ask copilot to start helping you with things and one of those things is going to be test so you can just type here tests right so tests and then just to be a bit more clear I do want xunit test right so I'm just going to put here x unit and then I'll hit enter and let's see what compile comes with all right and so let's see what it generated so as you can see uh we do have kind of an initial Suite of tests uh handy test right so it's created pretty much one for each possible combination of I guess numbers let me see yeah so different dates for spring and then he create another unit test for summer for Autumn for winter and even for a Le year which is not too bad and it actually use xunit which is what I like uh but I'm thinking that we could do this actually by using uh an next unit Theory right uh data driven unit test as opposed to this kind of testing because it's just too much testing so let's see if if we can ask for that right so can we use a theory instead let's see what we get all right and so as you can see now we have a much better test I guess I mean I guess it has a lot of inline data but now it's just one test that can get coverage for the entire set of of months across the year right so unliking that and it also kept even kept the the Le year the Le year situation over there so I like that so let's go ahead and copy this I'm going to copy this weather calculator test so let me just copy this entire class copy let's go into my actual class let's put it there okay and so I may need a reference over here so let me to to add missing H missing usings or missing H missing dependency what you can do is just click either do the light bulb that's already here you can click on that and do using my library or the one thing that I I like to do all over the place is just use control dot that's a great shortcut so control dot that's going to open up the this dialogue for quick fixes I'll click on using my library and that's going to bring in the missing dependency right on the top and so yeah so now we have our unit test and we probably want to just run them right so how do we run this the first thing I want to do before you can run this and this is because h test cases are not going to be discovered automatically you do have to at least build your test project before you can round them so I'm going to go ahead and just right click under my tests so right click build right and that's going to help BS Cod discover the test cases that we have available there so now we can go we can do is go into the three dots and there's going to be this testing testing view right there testing so let's click on that one and this is going to show a kind of a hierarchy of the test that have been discovered uh in your in your workspace right and what you can do and you can see all the combinations right there right what you can do is just click either over here you can click on there or you can click on there or you can right click any of this and that's going to allow you to go ahead and start running your test so I'm just going to click on this and that will go ahead and run our unit test and see where how how we we go so as you can see all test cases have passed right so we have some confidence that we have some some initial coverage at least for our our test like I said uh it doesn't have to be be exact it doesn't have to be super accurate but I think it is a a great start on the test right and from there you can start asking for more right so I don't like the way that this has been laid out you can ask for the Tria right so arrange act assert and you can ask for a few other reasons a few things but uh it's I think it's a pretty good start and so one last thing I want to show you and just because some people complained about this in the past is the fact that can I can I have some of these tabs moved into another screen right can I pop up pop out some of these and moving it on the screen and H you can totally do that actually uh today right so let me show you this I mean it's a bit hard to to show uh in just one screen but let me show you that I can you can just select this and I'm going to drag this outside of vs code right so now this is actually in another of my screens and I'm going to bring it back but notice that this guy is now floating right it is floating on top of this of the main window right so you can now take this just take it into another monitor right if you have one more and now you can have this multi view of your code and you can even put more more more things in other screens right so that you can nicely see and work on different pie of of cod and code as you would do in the past in Visual Studio you can also do that over here right and so yeah but here is a floating window so H yeah that's what I wanted to show you today I hope that was useful and well I see you in the next video
Info
Channel: Julio Casal
Views: 8,760
Rating: undefined out of 5
Keywords:
Id: O4dCgYicoDg
Channel Id: undefined
Length: 39min 21sec (2361 seconds)
Published: Tue Dec 12 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.