Double Your Coding Speed with Visual Studio and ReSharper | Elias Spock | Skillshare

Double Your Coding Speed with Visual Studio and ReSharper

Elias Spock, Chance favors the prepared mind.

Double Your Coding Speed with Visual Studio and ReSharper

Elias Spock, Chance favors the prepared mind.

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
29 Lessons (2h 54m)
    • 1. 00 Promo

      4:24
    • 2. Moving Through Code

      4:49
    • 3. Selecting Code

      3:19
    • 4. Finding Code

      5:40
    • 5. IntelliSense

      2:16
    • 6. Navigate Through Tabs

      1:52
    • 7. Delete and Remove Code

      2:41
    • 8. Formatting

      2:28
    • 9. Commenting

      1:03
    • 10. Refactorings

      5:56
    • 11. Contextual Refactorings

      2:12
    • 12. Running with and without Debugger

      2:56
    • 13. Debugging with Breakpoints

      9:52
    • 14. Edit and Debug

      2:10
    • 15. Debugging Windows

      6:39
    • 16. Existing Snippets

      4:29
    • 17. Creating Snippets

      9:00
    • 18. Overview of Plugins

      6:08
    • 19. Color VS Output, Roslynator, PInvoke

      3:14
    • 20. .NET Portability Analyzer

      3:40
    • 21. Continuous Testing

      3:57
    • 22. Installing

      2:28
    • 23. Settings Overview

      11:42
    • 24. Create via R#

      11:15
    • 25. Navigate via R#

      7:50
    • 26. Annotations in R#

      2:45
    • 27. Refactorings

      10:00
    • 28. Code Cleanup

      2:30
    • 29. R# in Action

      36:17
  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

86

Students

--

Projects

About This Class

Modern integrated development environments or IDEs, in short, allows us to perform miracles. Why? Because we live in the twenty-first century and modern computers are so powerful that modern IDEs become indispensable assistants which can save us thousands of hours. A decade ago, no one could imagine how much powerful IDEs will become in the future. However, nowadays, developers are armed by superpowers such as deep static analysis, automatically performed refactorings, code fixes, super simple navigation, and many other things.

Want to become an iron developer? Then listen to me.

This course consists of two main parts. The first one concerns the features of a bear visual studio without any super-powerful plugins and  it covers:

  • Navigate through the code base: how to select code, how to find code, camel humps in IntelliSense, navigating through the tabs

  • Edit and format the code base: deleting and removing code, formatting, commenting and applying refactorings

  • Run and debug your code: working with breakpoints, new features of the modern visual studio, different debugging windows

  • Code snippets: existing code snippets and creating custom code snippets

  • Extensions for Visual Studio: Color VS Output, NCrunch, PInvoke, .NET Portability Analyzer, Roslynator

The second part is dedicated to ReSharper (R#). R# is one of the flagship tools developed by JetBrains. I need to warn you that R# is a paid tool but despite of this fact, the majority of professional developers use it on an everyday basis.

R# is a Visual Studio plugin which empowers it by tons of refactorings, analytical features, fixes and a ton of other features. So, the second part is dedicated to R# and it covers:

  • Installing R#

  • R# Settings

  • Creating Code with R#

  • Exploring Code with R#

  • Refactoring with R#

  • Unit Testing with R#

  • R# Annotations

This is only an introduction to R#. I’ll update this course from time to time teaching you other cool features provided by R#.

Enroll and start learning how to double your coding speed in bear Visual Studio and Visual Studio empowered by R#!

Meet Your Teacher

Teacher Profile Image

Elias Spock

Chance favors the prepared mind.

Teacher

I'm thankful enough for that I love what I do.
I began my career as a postgraduate student participating in Microsoft ImagineCup contest.
I've been working with .NET platform since 2003. I've been professionally architecting and implementing software for nearly 7 years, primarily based on the .NET platform. I'm passionate about building rich and powerful applications using modern technologies. 
I'm a certified specialist in Windows Applications and Service Communication Applications by Microsoft.
I'm one of the coordinators of the MSK.NET User Group in Moscow.

"If it's work, we try to do less. If it's art, we try to do more." - Seth Godin.

What I can say is that software is my art.

See full profile

Class Ratings

Expectations Met?
  • Exceeded!
    0%
  • Yes
    0%
  • Somewhat
    0%
  • Not really
    0%
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Your creative journey starts here.

  • Unlimited access to every class
  • Supportive online creative community
  • Learn offline with Skillshare’s app

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

Transcripts

1. 00 Promo: Hi. This is injury spark from injury sparked dot com, and they'll be leading you through the course. I've been working with the dot net platform since 2003. I've been professionally architect ING and implementing software more than 10 years, primarily based on the DOT that platform I'm passionate about building reach and powerful applications using modern technologies. I'm a certified specialist in Windows applications and service communication applications by Microsoft, and I'm one of the co organizer's off the most Kudat, not user group in Russia. And here's my teaching approach. No fluff, no ranting, no beating the air. Steam your time. The course material is succeed. Yeah, comprehensive. All the important concepts are covered particularly important topics not covered in depth for absolute beginners. Offer my help on Skype absolutely free if requested. Take this course and you'll be said it's fine. Modern integrated development environments or ID's. In short, allow us to perform miracles. Why? Because we live in the 21st century, and modern computers are so powerful that modern ID's become indispensable assistance, which can save us thousands off hours. A decade ago, no one could imagine how much powerful ideas will become in the future. However, nowadays developers are armed by superpowers. Such a deep state IQ analysis automatically performed. You're factoring is called fixes Super Simple navigation and many other things. This is a developer without a powerful idea. E abject work. Going to kill yourself against the wall our become aerial developer. Here's how Ariel Developer looks like Want to become an errand developer? Then listen to me. These course consists off two main parts. The 1st 1 concerns the features off bare visual studio without any super powerful plug ins ended covers how to navigate through the gold base. How to select Go, How to find cold camel humps in intelligence. Navigating through the tabs How to add it and format the code base. Deleting and removing code for my acting commanding and the Blinder factories. How to run and debug circle. Working with break points. New features off motor and visual studio. Different debugging windows using code snippets, existing code snippets and creating custom codes. Needs helpful extensions for a visual studio color V s output M crunch p Invoke .net Portability Analyzer. Roslyn ate her. The second part is dedicated to re Sharper Re sharper is one of the flagship tools developed by Jetbrains. I need to warn you that very sharp er is a paid tool. But despite of this fact, the majority of professional developers I'm talking about see shop developers use it on an everyday basis. In my opinion, apart from programming fundamentals, very sharp is exactly that tool, which makes you that guy from the picture. Hurry Sharper is a visual studio blogging, which empowers it by tons of her factories, analytical features, fixes and at Thanh Off other features. So the second part is dedicated to re sharper ended covers. Installing the shop re sharper settings, creating cold with a sharper exploring cold with her sharper re factoring with a sharper unit testing with their sharper Andrews sharper annotations. These is only an introduction to the Sharper. I'll update the scores from time to time, teaching you other cool features provided by her sharp in the role and start learning how to double your coding speed in the bear visual studio and visual studio empowered by the Sharper 2. Moving Through Code: If you're a beginner, then you need to learn the basics of navigation through the cold. Many features that I'm going to talk about in this section actually work in the majority of text editors. Nevertheless, I so many beginner developers who didn't know the basics of navigation. So let's start with the basics. If you need to go to the end of the current word, how would you do that off course? You could press the right arrow key several times like that. 123 for five. But these takes too much time to navigate through the code word by word. You can do control left or right arrow key so you can hold the control and press right key like that again. And I move my cursor to the end of the current word like that. And to the Left Control and Left Arrow key, there is another cool feature you can see that visual studio highlights of the closing round bracket. If you want to navigate to the closing around bracket, you can do control and closing square bracket like so. If you want to get back, you can again press the control key and press the again closing square bracket like so. So with this feature, you can navigate between the highlight brackets. Sometimes when you have many brackets in complex expressions, this shortcut can be very handy. Let's say you want to navigate to the line above the current line. So what would you do in such a case? Of course, you could just press the up arrow and then press enter, but that is too long to go above the line. You can hold control and press enter like so. If you want to go down the line, you can press control, shift and press enter and you will go down the line. So holding control or control shift and then pressing enter. You create a new line, and this is a major difference from clicking on arrows down and up. Let's look at how you can scroll the page. Of course, you can use your mouths and just use this crawler. But if you want to stick with your keyboard, you can hold the control key and then press either down arrow or opt Aero. So for now, I'll hold the control and press and hold the down arrow, and I'm scrolling down the page. And if I hold the control and hold the up arrow, then I scroll up the page. You can just press and hold to the down arrow like so. But you can see that you're not scrolling. Yep. You'll start scrolling on Lee reaching the end off the current screen. Yep. So to avoid that, you can hold the control key and hold the arrow key. Very neat. If you want to scroll down the entire page, you can press page down and if you want to get back, you can press the page up. If you need to navigate to the end of the document, you can hold the control key and press end, and vice versa. If you need to navigate to the beginning off the page, you can press control and whole. If your cursor is at the beginning off the line and you need to navigate to the end of the line, you can always use the and key and vice versa. If you need to navigate to the beginning off the current line, you can press home. Everything is simple. Actually, most of the features I showed you in this lecture actually work in the majority off text editors. But many developers, for example, do not know about control, enter or control. Shift, enter and scrolling, and also navigating between highlight brackets is also very handy in some cases, so do not forget to use it. 3. Selecting Code: we will look into editing and formatting in a separate section, however, very often to edit something, we need to select something. So what options do have in visual studio to select gold? So at first, the most basic feature is to hold control shift and then press left or right arrow keys. In such a case, we select a word, and if I press again, another word and so and so so using control shift plus arrow weaken, Select gold word by word. If we need to select just characters, we can hold shift and then press left or right arrow key like that. If you need to select the whole line, you can hold, shift and press end, and vice versa. If your cursor is that band off the line, you can press, shift and hold shift and press whole. Thus, you select the current line entirely. If you want to select the current word, you can just do control W like so, and there is also a great feature off square selection. It is very useful when you need to. For example, add several items simultaneously to the same least off objects, so I'll show you an example, for example, help create a least off game objects and I'll call it games. And if I want to add several items simultaneously, you can do old shift and pressing the down arrow key like this. Select an area and no type something like New Game. Let's see. Tell like that, of course, in this case, we could just type on Lee the first line and then repeated via control. C Control V. But this technique sometimes is very handy if you need to modify something that you have copied from elsewhere. Believe me, you'll find the case when this feature will be very helpful for you. So don't forget. Use old shift plus arrow keys to select an area and then type what you need to, and you can use standard shortcuts like control A. To select everything in a single file, then control, see to GOP or copy, for example, and ah, single line just control See than control V Like so so Control a Control C and Control V Shortcuts work, as in any other text editor 4. Finding Code: Let's continue to talk about navigation through the code. One of the main shortcuts is F 12 which allows to go to the implementation. So, for example, if the cursor is yet the type which is called tied in this case and I press f 12th I go to the implementation to the declaration off this type. In this case, if you don't need to navigate to the implementation and at the same time you need to introduce a small change. You can press old F 10 and you can see ah pop up like a magnifier and you can more defying here like, for example. But he modified the, uh, these an immigration heading another type of character. Let's say magician, I don't hear it. Here's a magician has been added, and by the way, very often. When you press of 12 you'll end up in a completely other file very far from the place where you have been before, pressing after wealth, and in this case, you can use control minus to get to the previous place of a car, sir, like so. So here's the cursor. Let's say we said the cursor here or imagined that you get to another file, and you can press control minus and you'll get to the previous position off the cursor like so, if you need to find the type or file, you can press control team and you can see the pop up control team calls the Goto all dialogue. Let's search for the game class, for example, and it sees the game CS, game class, game, constructor and so on and so on. Very need. You'll use control T very often, so don't forget about control. T. If you need to find any symbol in dark in a document, you can use control. F. This is a standard shortcut for any text editor pressing control F. You'll search in a current document. If you press control shift F, you confined in all the files an entire solution in all open documents. So it's a little bit more powerful, though in control f. You also have some options. If you need to replace something in a document, you can use control H or control Shift age at the same s in case of control F in control shift F. But in this case, we just replace something in a document or Manu documents, depending on what we want. If you have a place in code about which you need to remember and have a way to get there quickly, you can use the so called bookmarks. So what to do to set a bookmark To set a bookmark, you can do controlled K control K and let's set another bookmark. For example, here control K control K. And now, if you need to navigate to the next bookmark, you can press control K control and Control K Control, End control, K Control end Like so in this case who have on the two bookmarks so control K control p to navigate to the previous bookmark will work like control K control and out Breast control K control P control, K control P. So it works like control K control And And if you need to remove all the bookmarks, you can press control K control. L. Are you sure you want to delete all the bookmarks? Yes, I'm sure, and all the bookmarks have been deleted, Mile said. A bookmark once again control K control K. And there is a window which is very neat for navigating through bookmarks and to observing them. For that, you can press control K control W toe open this window. You'll see all the bookmarks here. And by the way, you can rename here the bookmarks like so just by clicking or just by pressing half to game book mark. So it's very need for navigating through the bookmarks to have named bookmarks instead off having bookmark, want work to bookmark three and so on. 5. IntelliSense: Let's talk a little bit about the power off in Tallis, since let's implement the function Guettel Records, which reads all the lines from a particular file, then select certain records via predicated and finally calls to least so else a file dot And here's what we can do with in Tallis, since in this case I want to call the read all lines function to avoid excessive typing, I can search for a method or any other member like property by searching them by camel humps. So read aligns consists off three words. Read all lines and they start from our A and L. And if I type are a you can see here, hurry, they'll buy it through the lines. Regal text and ill in Tower Sense suggests to use the read all lines method. And if I hit enter, we achieve what we needed. If you want to explicitly call for the intelligence, you can press control space, and the in Tallis Sense pop up window will appear. In this case. I don't need it very much, but sometimes, you know, visual studio just doesn't show the intelligence window, and in such case, you can explicitly call for it by pressing control space. And again I used camel humps to find a method which is gold bar String. In this case, and call to least of the job is done. Intel. A sense is very powerful, and I use camel humps all the time to search for particular members. It saves me much time when I type the code. 6. Navigate Through Tabs: Let's talk a little bit about those shortcuts, which I used to navigate through tabs. In this case, we have five open tabs to navigate through them without touching the mouse. I can do control old page up or paged out. That's very handy. If you want to navigate through the active files like so and active tool windows, you can press control tab. And after that, you can navigate through this window by using arrow keys like so or holding the control key . Press the tab like so if you need to close the Karen tab, you can press control F four. And here's another trick, which I commonly used for union testing. I like to open their tests file and stick it to one of the signs of the screen and open this system under test file on the left side. Like so in this case, I record the screen cast in 7 20 p. But in 10 80 p resolution on a white screen, this is very handy. You'll see all the code in tests and all the code in the system under test. So I split the working area for unit testing very often used the streak to simplify your urine testing as well 7. Delete and Remove Code: how to remove some code. We have a couple of ways to remove the gold. Of course, you can just use the delete key to delete individual letters like so. But if you need to to remove an entire word, you can do control backspace like so, but the cursor should be placed into the end off the word to use control. Backspace. If the cursor is at the beginning off the word and you need to remove it, of course, you could select it doing control shift and right arrow key and then press backspace or delete. But there is a simpler way off doing this. You can just do control, delete control. Delete works the same way as control backspace, but he removes the current word. If your cursor is right at the beginning off that word, I'll and do the operation by pressing control. Z. By the way, pricing control Why we can redo the operation and control Z to undo the operation. If you need to remove an entire line off gold, you have two ways off doing this quickly. Of course, you could just press shift and for selecting the line and then press backspace for delete, but there is a quicker way you can either press, shift, delete or you can press control. L. And these shortcuts do not only delete the entire line, but they also copy it to the buffer. So if you press shift, delete or control L, you can. After that press control V and that line will be pasted. And by the way, if you selecting the line and then remove it by pressing backspace or delete, you will not copy to the buffer. So control L or shift delete are very handy. If you need to duplicate the line, you can use control D like so the current position off the cursor doesn't matter where it is positioned within the current line. So, for example, if the cursor is righted the beginning off the type word, you can press control GS well, and the current line will be duplicated 8. Formatting: Sometimes your documents get unformed, matted in other words, formatted inappropriately, like maybe you copied and based it some cold, and it got basted in appropriately formatted. To format the current document, you can press control K Control D and the current document will be automatically formatted by the means off visual studio, another feature which I commonly used concerns toddling. So to collapse the current method, I can press control and control em. That's it. To open it, I can again press control them and it will be opened control am control em control M control em to tuggle and collapse. If you need to collapse all the members to definitions, you can press control am control Oh, and all the definitions will be collapsed if you need to toggle them. You can press control and control l and all the members. We will be toggled and you'll see their implementation if you need to see the indentation more precisely, you can press control are control w and you can see that dots off indentation appeared. You can use this option mostly for checking the settings off indentation and then turn it off by pressing control our control W once again, if you need to tabulate an expression, you can position your cursor at the beginning of the line and then press tab. And if you need to untapped bit, so to speak, you can press shift tab like so. And by the way, these works for several lines s well, so we can select them and press tab and chief temp. So this is how you can use shortcuts for formatting your documents. 9. Commenting: to command a line off gold. You can use the shortcut control K C and tow. Uncommon to you can press control K u like so. And by the way, if you need to command more than one line, you can select to them and then use the same shortcuts like, so I wouldn't recommend you to use comments too much. They pollute the code base, and they tend to rot. Most likely, you'll use some kind of version control system, so you don't need to keep much gold commanded out. You can just in many cases to remove it and in case you need it after that, you can recover it by using the power off version control system. So I usually use comments on Lee temporally. 10. Refactorings: visual student provides it does and offer factoring. Let's look at them briefly the most. Basically, factoring is renaming. If you need to rename some member and especially if that member is used from different places, you can just, you know, just go. And, for example, rename the speed property just by adding, say, to going this way, you must likely will break the building process so the code will not compile. To rename a member, you can press control our control are and you'll see a pop up window, which allows you to rename a member. If that member name is used in comments like, for example, speed is a good property. Then when you every name it you can mark include comments and visual studio will find that name in comments. You can also include strings and you can preview changes. So to rename it you can just go Andrew. Name it like so and apply. They're naming, and now if we build the solution, it builds successfully. So to rename a member correctly, you should use control, our control, our shortcut and all the EU's ings off that remember you're going to rename will be updated as Well, I didn't include comments, so speak to here was not renamed very often. You have a private field and you want encapsulated of our public property. And for that you can press control our control E and you'll see a nice pop up window with a preview. Cold changes securities. You can just click, apply, and that property will be generated for him. Actually, I had one here. I just commended out it. Okay, island, do the changes. Sometimes you need to extract an interface very quickly. Instead of copying and pasting all the members you need to put into an interface, you can instead just use the corresponding they're factoring by pressing control, are controlled I and you'll see a nice pop up window. Yes, well, where you can select all the members that you want to see in the extracted interface. Click OK and you can see the generated interface with the members were selected in the pop up window. That's a quick way off extracting an interface which are commonly used in case I need to extract several members for dependency injection at two. The next steps another basically factoring, which is commonly used, is called extract method. If you have a longer method, you might want to extract a part of it. So, for example, I want to extract these validation. And for that I'll select the portion off code I want to extract and then press control our control em and you can see here that in you method was extracted and now I want to. They're a name it and call it, for example, validate damage like so. And I I pressed Enter finally Very neat. If you need to reorder parameters, this happens quite rarely, but sometimes you have a bunch of parameters and you want to reorder them. You can set your cursor to the signature off a function and press control our control. Oh, and here, for example, we can reorder type and name like so and all the EU's ings off these constructor were updated as well. So building our solution we will not see any compile ation errors. If you want to remove a parameter, you can press control our control V remove it. Okay, but in this case, off course in then you'll have to deal with such things. Like in this case, we don't have the damage variable here. So in Vande, you need to perform some manufacturing's s well, in some cases, off course, the if a parameter is not used anywhere in the method. You can easily remove that parameter from the signature without any manufacturing's at the next steps, so that gold will compile without any editing. 11. Contextual Refactorings: There is another effecting feature, which can be called via control dot, and this feature is contextual. What does it mean? For example, if your cursor is positioned at the name of a class and you press control dot, you can see the options you have here. For example, you can see a need pop up window, which can be used to generate a constructor like so. Or, for example, you can press here control dot staying on the name off a method and, for example, change signature or use expression body for constructors. Yet this is a constructor, not a method story. For example, you can hear reorder the parameters so controlled DOT is a contextual future pressing control dot You'll open the least off available manufacturing's It also Kim in Lyon. Temporary variables, for example. Here I define a constant variable, and it is used only here. I can in line it by pressing control dot in line. Like so, though I prefer to define a named constant, well named Constant. But this is a self explanatory cold, but sometimes, indeed, it's very need to in line a temporary variable, instead, off in lining a temporary variable, it can introduce a temporary variable. So, for example, you can introduce a local variable like so calling pratica it and in line it reverting. Our code back visual studio team is constantly improving this feature, adding new manufacturing's so follow then use and you'll know about all the modern re factoring is available through this feature. 12. Running with and without Debugger: you can see that in many of my courses in console applications by right invent console, they're in line to prevent the application stopping. However, I do this because I need to do Bach my application. Look at this. I'll Arana short loop for the demonstration purposes, Let's say equals zero less than 10 I plus plus, like so, console right line, that's log the operator and Lance Command out this line. So what will happen if I'll just go and heat run the application? It opens up for a millisecond and then immediately close. The thing is that going here and clicking to round application is equivalent to heating F five key. What leads to around the application in the debug mode? So that means that the D bugger will be attached to the running process. And when there is no quote for execution anymore, visual studio just closes the application. Actually, if you don't need to debunk the application, you don't need to write consulted, lined in the end off console application, because you can just run the application in a release mode, not in debug mode. For that, you can heat control F five instead of just F five and you'll run the application in the Air Illes mode. So I'll press control of five and you can see here the result. But at the same time, it means that you're not heat and break point. So here's a break point, which I sat with F nine shortcuts, and now if I press control of five, you will not get there. The break point is invisible for the running process. This is because the D bargor is detached. There is no attached to D bugger. And at the same time, if I run the application through F five, we reach and break point like so. 13. Debugging with Breakpoints: I said how to set a break point in the previous lecture. Let's talk a little bit about break points once again. So, as I said, you can press F nine as a shortcut to set a break point anywhere you want. I'll around the application through a five in the debug mode, and we're each of the break point. And if I heat F five once again, I reach the break point. Once again. Seems we're in a loop. And if I want to around through the loop until I gets equal to say five, I need to press at five, 234 five times. There is a much quicker way off achieving this. I'll stop the application, and, by the way, you can stop the application by pressing Shift F five and actually break points. Provide additional settings. I'll never get to the break point, and you can see here to pop up icons. This one disables the break point temporarily, so you know it's actually not very interesting. Instead of this, you could just press F nine and remove for the break point, achieving the same result, and another one leads to the settings off these break point. And what settings do we have here? We have a nice you. I hear that the first check box is named conditions. Let's take it and we can add conditions to this brake point so we can apply a conditional expression. We can apply a heat count and filter. Let's, for example, look at the 1st 2 so conditional. Expression is a product. It so, for example, is true. And we can right here a conditional expression cell. If I equals five, we have set the condition. I'll run of five, and you can see that we reach of the break point on Lee when I equals five and, by the way, noticed that now the Eiken off the break point is different. You can see the white cross in the center off a red circle. Let's look at another condition instead off a conditional expression. In this particular case, we could just achieve the same hair by applying the heat count. It's not always possible because heat count, you know, it's like a special condition, So if you need to apply a complex, conditional expression which is based on values off local variables, you need to apply the conditional expression, but in this case, we could apply in just the heat count. So, for example, five here. Yep, and let's run the up in debug mode, and we reached the break point when I equals four. But these is off course. This is because who we start, how reiteration from zero Everything is simple in this case, were logging the value to the console by calling console right line. But in many cases, especially in complex applications like based on WP f, for when those forms are a Speedo that we need to log some value. But we don't need to write console right line, redirecting the output since there is no console. So let's pretend that there is no console. And instead of that, let's calculate, let's say, the square off offer value. Yeah, let's right to the console. The result off of calling the square method. It shouldn't be static. Seems we're in the static context, and I'll set here a break point. And what if we need to log the eyes value in of the debug mode? So for that, let's move to the settings and apply the so called actions and the most common action we apply to the break point is logging a message to output window. And for that you can right here, dollar side function. The value off Meteo Reiter equals I and continue execution because we don't want to stop. Every time we reach the break point, we just want to log it to log the value to the output window. Okay, let's close it and you can see that there I couldn't know looks like a diamond. So I'll press five to run the up in the debug mode. We reached the end off executing the application and let's look at the output window and you can see here the value of its territory was 1234 and so on, and so on. So but this is how blogging attached to a specific break point works. This is very need in debugging scenarios. And of course, you can actually combine actions with conditions. I am so in such a case, only specific value will be logged. Since we said that we want to activate the actions only when our conditions are true. In this case, I should be equal to five. Yes, and you can see that the value if iterated calls five and there is no other values being logged and actually getting back to basics. I need to also say that during the debugging process, you can move through the code by using F 10 and F 11 shortcuts where F 10 is called Step Over. So I pressed of 10 F 10 of 10 of 10 of 10 and F 11 is called Step Inter. So what is the difference here? I'm at the break point had a lot of the line which SAS console right line passing the result of the gold to the square function. And if I press F 11 here, then I step into these function. Yeah, so we will recursive Lee navigate through the stack off calls. Yeah, 11 11. And when we're in the square function, for example. Yet there is no difference what we press your of 10 or 11 because there is no level off nesting in the stack, so F tell will work the same. I mentioned these shortcuts for simplifying the navigation process during the bagging, so do not use here the tools by clicking using your mouth. It takes too much time By the way, there is also a very handy shortcut for removing all the break points. Let's pretend that I have 10 break points that have been set all over the program, and it happens sometimes that we really need to put many break points and you don't want, of course, to navigate, hole over the break points and remove them manually. Yeah, instead of that, you can press control Shift nine and visual studio will ask you if you really want to delete all the break points, and if you press enter, all the break points will be removed. So control shift F nine for removing all the break points. 14. Edit and Debug: Let's look at another relatively new feature introduced in visual studio I B 2015 and it's very powerful and very neat from the debugging process point of view, and it is called added and debug. At first, I'll set here who break point and let's say I want to the reach of the break point only when he'd count. Of course. Five. I'll Iran. The app in the debug mode So you can see here that were already wrote to the console zero while for as the square of two and nine s a square of three and if I want to And 16 since I pressed F town, Um and if I want to change the program itself during the buying process, I can just go here and tweak the cold, for example. I want to see on the console just the values off the iterated Er and I don't want to call this square function anymore. So I changed the code. And if I press a five, you can see here that after 16 Well, right here 56989 Because these are the values off the two Reiter. So we changed the program itself. during the debugging process. This feature is very helpful in certain scenarios. When you don't want to stop the application, diran it once again and you want to verify the behavior on the flow, so to speak. Yet you can just change the cold itself and verify the behavior without leaving the debugging process. 15. Debugging Windows: we have a game here in sticks. What is the meaning of this game? So in the beginning, there is a certain number off sticks in the game and there are two players. One is a human, and the 2nd 1 is machine, and each player should take on its turn 12 or three sticks. That Blair, who takes the last 12 or three sticks, loses the game. I want to debunk this application a little bit and show you different and show you different debugging Windows and explain the difference between them. So I'll put a break point here, and I'll put the break point say here, and I'll around the application in the debug mode. So I press of five. The game asks here, How many sticks do we want to have at the beginning in the game? So let's say 10. Who will start the game? Enter age for human? Let's say human level start and we're each of the first break point, and I want to talk about different debugging windows. So the first window, which is automatically opens up he's called locals what these Windows displays here, it displays all the local variables and their values and their types. And of course, we can explore those variables, which are off custom types like like Game, not primitive types, so we can dig into them and we have a window called Autos and autos. Displace only two variables here, game and game dot game over. Why this is so So the autos window displays the state off the last two variables, calculated in the last two expressions. So the autos output is the subset off the output off the locals window. If you want to track down how a certain variable changes in time, you should add it to the watch window. For that, you can ho over your mouse over a variable, click the right button and then quick ad watch and the watch one window opens up and you see that we added. The variable name starts here and let's say I want to watch for the game. Variable this well and watch. And what is the difference between watch and locals in this situation, for example, Yeah, why would we need to add to the watch window these two variables? Yes, I said, we add some variables to the watch window if we want to track down the changing off these variables in time. So if I exit this, cope off local variables like I press a five and a dig in turkey falling method reaching the break point here, you can see that we lost those locals from the main method. And actually, we don't have access to them even in the watch window, because the D burger cannot reach them by stack. So actually, you'd want to add those variables, which are ST Ick, and they're visible to the bugger through a long period of time. But nevertheless, this window is very need unhelpful in certain scenarios, so locals displays only the local variables. The watch window can display any kind of variables which have been added to this window manually. If you want to issue an arbitrary command to the D bugger, you can open up either immediate window or the command window. But the difference between these windows is tiny. The command window is different from the immediate window just because it has this sign in the beginning already inserted and we can issue commands like question mark, question, mark game and question mark. Question mark is the shortcut for quick watch. If you want to query the state off a particular variable, you can question Mark and the name off a variable like human move and it response three. Or if you want to look at the variable in the quick watch window, you can two question marks, as I said. But in the previous example, I requested the game variable, which was unreachable by the stack. So in this case, that's try to query the same variable, and the quick watch window opens up. Here it is. You can reevaluate here the expression you can do hear different things like that, plus two very recalls five. So you can very quickly calculate differing things operating on certain variables. Quick watch window is also helpful sometimes in the immediate window. In this case, I'll just show you that you can issue the commands in the immediate window as well. And by the way, immediate window provides thes the intel a sense help. What is very need and very handy, like so. So these were the basics about the peculiarities of different dividing windows. I just wanted to share this information because many inexperienced developers do not understand the difference between different debugging windows 16. Existing Snippets: There is a tall, off code snippets provided by visual Studio out of the box, and those coats nippers can significantly reduce time spent two typing. So the most useful and commonly used code snippets are class, and you can see a special I can hear in the pop up window. And if visual studio sees and suggests to use a code snippet, and if you want to use that Kourtney. But you can then press tab toe ice and the code snippet will be expanded. So now I can rename the class like customer and press enter and after pressing enter the cursor gets placed inside the class. If I want to create a constructor, then I can see tour and the visual studio suggests Echolls need before constructor so I can step twice to insert this snippet, and we have a default constructor. If I want to define a property, I can type prop, and actually, they're a different code snippets for inserting different properties. Prop a probably p prop Full prop G. Let's look at them so prop is a code snippet for inserting and automatically implemented proper team with public getter and setter. So at first Actually, it suggests to change the type of this property. In this case, let's say it will be integer and the name of the property will be age. Enter Probe A Probe A is a special property for the WP F framework, which accepts the dependency object so the so called attached property proper. DP is also for a WP of framework. It's a dependency property and prop full generates a property with the backing field. Let's say this is going to be a string cold name like so. And prop G is an automatically implemented property with the private center. Equals is a code snippet for over riding the bull equals method with some kind of default implementation. Actually, I don't use this code snippet at all. And other code snippet, which is quite handy, helps to insert the loops. For example, we have code snippets for the four loop for each loop. While let's try the for loop for our stands for a reversed four to run the for each loop, you can print for each and then step twice. The tri snippet is for inserting to try and catch blocks. Try F East for inserting. Try finally, an interface code snippet is for inserting, ending to face and so so cold. Snippets are very handy for inserting the boilerplate parts off the cold. Such a different cold blocks like try filing to try catch and so to generate constructors for loops for each loops eso for generating properties. 17. Creating Snippets: gold snippets are very handy, and sometimes you need to create your own code snippets for a smoother process of creating code snippets. You can use a special plug in. I'll show you this plugging in the browser. Here it ease. This plug in is called snippet designer. It's an open source blogging, which enhances the visual studio I d to allow a richer and more productive code snippet experience. You can read about this Blufgan in details here following the links on this page, I'll get back to visual studio and provide you an example. Well, we may need to create how old called snippet, and then I'll show you how to create a simple code snippet. Let's say we have a system under test and we want to write unit tests for that system under test using the end union testing framework, I'll go to them Damn a project. Let's say we have calculator here, which exposes the public method called and and it takes two Villagers A and B, and it returns the sum of A and B. And let's say that we want to test this method so we create a demagogue tests. I'll go to managing, you get packages and I'll add the end units testing framework here like so Island stole it . So let's use the amusing framework. Let's declare class. I'll call it killed. Count Kill later tests. And I want to say that I like to write unit testing methods. Which names are split into three parts separated by an underscore. So, for example, if I would write a unit tests for the ad method, I would do this like that. We need to mark are testing method by the test attribute and then right public void. And here's the naming pattern goes. So the first part is the unit off work, he says. The ads method. Then the test gaze goes, Let's say two plus three. And finally, the expected result goes returns. Five. This is what we expect to see returned from the ad method, passing two and three s arguments, and the test is done off course. This is a toy example, however. Well, we're testing large systems. We need to write hundreds off unit tests and every time you need to write tasked as the attribute than right public avoid and then type the names for three parts off the testing method like add than type underscore, then again apart, then an underscore and so on. Off course, we can speed up this process by creating our old snippet. For that, after installing our plug in, you can select a piece of cold, then right click on the most button and click export s snippet like so and you'll see a window and you can add it here. The code snippet. Using special symbols, we need to make thes three parts replaceable. For that, you should use the dollar sign. I'll call it unit off work and enclosed by the dollar sign, and the same goes here and the same goes here, though I'll, of course, renamed this Yes, let's say test case, and this is going to be an expected result and to determine where the cursor should be placed after heating return on the keyboard, you should write dollar sign and dollar sign. So, after feeling the gaps, I mean our placeholders, the cursor will be placed inside the method. Let's define the shortcut for invoking this code snippet. I'll call it and unit tasked, and by the way, I'll open the properties you need to set the snippet kind and this is not a method body. This is a method declaration. You can also set time declaration. This is a method declaration. So I'll select this one. You can set the author I am under near sparks soil type in my name. You can set a description. You can add it here. The two tips that will be visible for the user off your code snippet and the default value off the placeholder. So if a user will just press tab without typing something to replace the placeholder, it will take a devalue from this column. This is some kind of bug or something. I don't know. What is that? The little which is set to see Sharp and the name of this sleep. It will be and unions tasked. And before saving these union test, I would look at where testing code snippet story side. For that, you can open up a default code snippets manager built in the visual studio by pressing control Care control be here is a code snippet manager you can select here the language it is said to see sharp right now test our testing code snippets or side in this folder. Okay, unfortunately, my instance Off visual studio works under an unprivileged account, so I'll save this code snippet to a temporary folder like, so I'll close it for now and then I'll go to my temper folder and I'll co P and pays to this code snippet manually to the folder where gold snippets for testing are stored. I'll close this folder. Let's press control K control being Yes, indeed, this gold's knee but now is visible for a visual studio. And let's try to use it by typing and unit test. I'll press tab twice, and it is expanded so and Tab three plus one returns four and I'll heat downturn and everything works as expected. So remember this simple way off creating your old cold snippets. This can help you to significantly reduce the boilerplate typing and save you much time. 18. Overview of Plugins: but there are several bludgeons, which I want to talk about. The first blogging on little to talk about is called the S color out. But it's pretty simple plugging, and what it does is that it colors the output. Why would you need that? The thing is, that color now is very helpful when you build large projects. Sometimes when you build a large project and the building process ends with the turns off compilation errors, you need to sort them out. Fix somehow and you need to understand their. Often you need to understand what error a cured first, and actually the errors window sometimes is not very informative. Sometimes it it is. Even these informative. The errors window, with its output is not s informative acid, the output off the out window. So the output window logs the compilation process in a more verbose manner. And sometimes you really need exactly the output in the output window instead of the output in the errors window, especially if you're building your application after bigger factoring or after factoring caused by the necessity to support different platforms. So in such a case, you really might need to analyze Thea putting out between the. But the problem is that the output in the output window is gray, and it's very hard to distinguish errors from warnings from successful events. So it's hard to analyze the building process, looking at such output. To simplify the process of finalizing the output in the output window, you can install the V s color out plug in which colorize the output, making green the successful events or add the errors and so on and so on so you can distinguish different events and analyze the output much easier. Another plugging, which is unfortunately paid, is called El Crunch for Visual Studio, And this plug in will help for those developers who practice the so called has driven development, or TDD. In short, I'm not selling it to you, but I need to say that And Crunch significantly simplifies the so called red, green, red factoring process, which is the core off. There's driven development practices. I'll demonstrated this plugging in action in a separate lecture. Another very simple yet quite helpful plugging in certain scenarios is called Teen Vogue .net visuals to the extension, which can be used if you need to bring the invocation off Win 32 functions this black and allows to search for a certain Win 32 method and copy and paste. The P invoke implementation off that method to call it via managed code in C sharp so you can just cope and paste already prepared code. So this blogging in the cells is a container off p invokes for all the existing Win 32 methods. Another plugging his gold dot net portability analyzer. And these plugging helps you to determine how flexible your application is across .net platforms, and it is very helpful. Scenes dot net core eventually becomes the primary platform on which we develop our applications, and if you need to understand what a P eyes are available here and there, you can use the dot net portability analyzer. So if you need some code and you need to make it portable and you don't know which parts off your code are enough flexible to be portable between different platforms, you can around the dot net portability analyzer, and it will analyze your application, creating the report concerning the degree off flexibility off your application. So it will say which AP eyes are unavailable in certain platforms, which AP eyes, You may want to replace by other AP eyes and Solan and another plugging we child like the rematch is called Roslyn Ater 2017. I bet you remember that we used the shortcut control dot to use the context Dependent Manufacturing's. So the Rosslyn Ater 2017 by Joseph Appeared, is the blood in which extends these feature. So after installing the rustling in her 2017 activating it and pressing control dog, you'll see much more available. Factoring is here and there, and don't forget that they depend on the context. So the provided you're factoring is, you'll see, depend on where you call for the feature by pressing control dot on a class on the method on the parameter and so on. So Roslyn and her 2017 is actually comprised off analyzers and code fixes, So the scenario off using this plugging is straightforward. Just install it and use control dot and you'll see the improvements. There is no meaning to in least older factoring provided by the Rosslyn ater 2017 scenes. There are, you know, maybe 100 off those they're factoring. Just install it and try to use it. If you need to read the documentation, you can visit the detail, page off this plug in and look for the documentation. 19. Color VS Output, Roslynator, PInvoke: here I am in visual studio, Eines told V escolar output, Roslyn, ater and P invoke and I want to show you them in action. So the first plugging I'll demonstrate your inaction is V s color output. So now the application is compatible. Let's compile it. You can see here that bill started. His green warning is something like brown and so a beautiful out. But and in case we introduce in there and reveal the application, the output contains a red line, which refers to a specific problem in code. Remember that if one day you'll compile a very large application and you observe hundreds off errors and the sequence off errors printed out in the errors window will not help you to fix a certain problem, then try to use the out between the and in such a case, don't forget to install this plug in. I'll demonstrate you now that Russell in Ator actually adds Sam Manufacturing's to control dot, for example. Here we have lined out split and Landlords pleat returns in the area of strings and visual studio by default. When you press control, Dot does not provide the introduce variable manufacturing. However, after installation there. Also Nader, 2017. I can press control daunt and you can see here the introduced local for line split like so it really works. So after installing Russell in a 2017 you'll see different Manufacturing's Here and There, which were unsupported by visual studio by default. Another plug in I installed is called Teen vogue dot net, so to use it, you can go to me. New p involved did not insert p invoke signatures and search for and Win 32 function like Let's say open. And if I want to import the open file function from Colonel 32 I can still acted and you can see here they prepared code snippet, which is a p invoke for these function. And if I click insert, you can see that these cold who was properly inserted to the place in cold where the cursor has bean. So it works like that. So this is how these plug ins really work 20. .NET Portability Analyzer: portability becomes an indispensable characteristic off the code base, especially because off modern cross platform movement in the world off dot net, a great amount of code has been written before appearing off the net core and darkness standard. So the problem off analyzing the degree off court portability becomes important. Sometimes we need to understand how difficult it will be for us to pour to the code base. Let's play around a little bit with this tool. Let's go and install the dot net portability Analyzer plugging for visual studio. Now I'll open one of my solutions. I have opened a solution where I have to portable class libraries before analysing it. Let's look at dot net portability analyzer settings, so I'll right click on any project and click on Portability Analyzer settings Menu item. First of all, you can get the results off analysis in three different formats, including Jason, Html and Excel. I want to just look at errors in the output window in visual studio so Al and check these options Target blood firms is the least of platforms against which we want to perform portability analysis. I want my lips to be compatible with dot Net core. 1.1 dot net framework 4.6 point one dot net standard 1.4 Mona 4.5 You WP and a Semmering, Android and IOS. I'll click OK, and let's begin with analysis off a super simple library, which allows building your eyes. I'll start the analysis by going to analyze assembly portability and look, we have no errors in doubt between dough. This means that my library is 100% compatible with all the platforms with selected previously. Okay, let's check another PCL, which contains a lot of detail your objects and is responsible for serializing and the serializing them to and from Jason. Oh, it seems there is something wrong. It says that the Methodist serialize object is not supported in darkness standard 1.4 UW B and other platforms. So this is how portability analyzer works. You just select all the platforms you want to make her court compatible with and performed the analysis, then fix the problems in this particular case. Seemingly, I need to wait for darkness standard 2.0, and targeted, or I need to remove some of the blood forms I selected to perform the analysis Another way is to implement my own Jason's realize er on top of darkness. Standard 1.4 21. Continuous Testing: modern programmers like Practice, which names start from the world continues, for example, continues. Integration continues, deployment continues testing. Why not? Continuous integration is about automated building off the whole project on the server, triggered by some events like chicken off some cold into the source control continues. Deployment is about automating deployment as a continuation off the successful build. All these practices are intended to save the tile of developers. Well, we follow these practices. We don't forget to do what we have to, and we have to keep the project in a state. When these continues, practices are possible to have and run continues. Testing is up not so complex from the perspective off, setting up all the things continues. Integration s well as deployment requires from us. An enormous amount off efforts continues. Testing is much easier to set up and live with. Everything you need is to choose a tool which provides this feature turning on and reap the benefits. One important note is that these tools require modern, powerful processors and a lot off memory. I doubt it's possible to use these tools on slow computers. So what is continuous testing? You had to notice that we Iran, the tests all the time at test has been changed. We need to run it. A chunk of code has been changed. We need to run all the corresponding tests. By the way, if we're on Onley, put off the whole test suite. We have some chance to forget about certain tests, and that can lead to unfortunate consequences. We could think that the implementation is correct until running the whole test suite. This extends the feedback, beard and, of course, damages the effectiveness off the workflow continues. Testing tools are smart enough to detect changes both in tests and the production code and run all the tests related to changes Absolutely automatically. I would say that we have three major continues testing tools. The 1st 1 is and Crunch Live unit testing in Enterprise Visual Studio 2017 continues. Testing in every sharper and crunch is a leader. It's a very mature tool, and it's paid. I attached a link to and crunch check it out. You'll discover that Crunch also provides some code metrics and some other features. Live unit testing is available only in the enterprise version of visual studio re shopping by itself doesn't support continues testing. Actually, there is a separate two called dot cover and it is paid. You can either purchase it separately or use it as a part off the re sharper ultimate package I installed and crunch to demonstrate you how continues testing works. Let's move to an interesting session where we will implement the ticktock, tore a game following TDD and relying on the continues testing provided by the end crunch tool. 22. Installing: to download a sharper you can visit. The Spade jet brings that commoner sharper download, and you have several options. Here you can download Air Sharper Ultimate installer in the Re Sharper Ultimate and Stoler . You can select different products to install because Jetbrains provides several tools for visual studio not only a sharper but that covered the trace and other very powerful tools aimed at unit testing, profiling and so on. You can Donald a weapon, Stoller, which is very tiny. You can doubled re sharper as decay, so you need a sharper as decay. If you're are a developer, often extension for a sharper. So if you want to create your own extensions for a sharper than, you should download the every sharper as decaying. And the last option is command line tools. Well, that's a rare case when you need to use the command line tools. So it's a free set off stand alone command line tools that enable you to Ron every sharper inspections outside of visual studio, for example, on the server. Okay, I'll I'll download a tiny 14 megabytes weapons, told her. I'll click on it, and it says that actually re sharper dot cover dot peeked dot trays and other tools except a sharper C plus plus and team Ctrl Riddle was told on my machine, so it suggests to update them. I'm not going to explain what are these tools. So you'll see The year is sharper at the top in this window and you click. Install here instead of update, and the installation process is very straightforward, so there is nothing to explain. Actually, everything is very simple, and you can hear select your your version of visual studio. The installer determines your version automatically. However, if you have installed more than one version of visual studio, you'll have to pick that version of visual studio, to which you want to install the air a sharper. So this is how you can install a sharper in tow visual studio. 23. Settings Overview: you can see my visual studio that no additional menu for Re Sharper was introduced here. This is because I temporarily suspended every sharper because I demonstrated you how to use the power off visual studio itself to riff actor code and so on and so on. So to enable a sharper I need to go to tools, options search for every sharper and I'll click resume now. And if I want to suspended, I can click. Suspend now, sell. I'll click OK, and they're sharper. Menu item should appear in a second. Yes, here it is. Let's go to the option. So for Sharper and discuss them a little bit, I'll explain some options that are provided by re Sharper. It's literally impossible to cover all the options in this window, so we're going to cover only the most important ones. So now we're in the environment section in the general tab, and we have an interesting option here, which is called Show Manage Memory Musician Status Bar. This can be helpful if you need to track consumption off memory because they re sharper. It's a lot off random access memory, and if you want to look at how much memory. It eats for different purposes, mostly for analyzing the problems which are caused by using the re sharper. You might want to check this box here, have a section off options that are related to cash is the thing is that re sharper? Builds a lot of cash is especially for large projects, so you can choose where to keep those caches. And I would recommend you to keep them on SSDI instead of HDD, and you can clear them in case of specific problems, or just because they started to eat too much mammary. You can clear the cache is by clicking on this button and change a folder to a store. Solution. Caches. Let's go to keyboard and menus. Override visual studio Factoring and hide overridden visual studio menu items. Options are ticked by default. It says that re Sharper will replace all the features where it is much more powerful than visual studio. And believe me, using re sharper, you won't use ves features which are provided by you're a sharper so I believe you really want to keep these boxes checked. So what concerns keyboard shortcuts? So these option determines what shortcuts will be mapped to specific, very sharper commands and features. And if you are a nolde user off visual student, you don't want to change the shortcuts that you're accustomed to. Then you might want to stick with the visual studio option. However, if you're an old user off every sharper or another i. D. E for Java called Intelligent Idea, also developed by Jetbrains, you might want to stick with their sharper two dot exe or intelligent idea option. And I prefer this options since I'm an old user off three year a Sharper and I am acquainted with all the shortcuts provided by the old versions off a sharper and intelligent idea, i e. So if you change here, the option after that you need to click. Applies came and the current scheme will be overridden by new shortcuts. Let's move further. Here's an editor appearance. You can customize here the appearance off the editor, and you know, I tried to play around with colors once, and I must say that it's not so simple to select good looking collars. Appearance is not very important from our discussion point of view. So else keep this entirely. This section is very important. However, however, in most cases you don't have to tweak anything, since all the defaults are quite thoughtful. The only thing I would do here is to enable camel humps, since it enables vehicle editing features related to camel humps we discussed previously in this course, let's go to Intel Assistance. So a Sharper provides its old in Tallis since and don't together to re sharper in all the features it provides, by itself is much more powerful than visual studio. So in 99% off cases, you want to stick with every Sharper's intel a sense which is much more powerful than Intel , a sense provided by visual studio. So you don't need to change these option. Just check that these option is selected. I mean, you're a sharper completion. Behavior is related to how the Intel ascends behaves itself. I would check here the symbol, completion and import completion, since it will enhance the experience off using intel a sense provided by a sharper import Completion, for example, enables the feature that when you type some a P I member's name, it will explore all the semblance available in the A solution, and it will discover all the types or a pie members, which match by their name to what you started to type. I'll move to code inspection and I'll go to inspection. Severity. I'll expenses sharp, and you need to know that. See, Sharper provides hundreds off code inspections, and it has different levels off inspection. So they're hints, suggestions, warnings and so on. And sometimes your opinion may different from the opinion offers sharper, and you want to treat a piece of code that is treated by her sharper as code off. Not a good quality. And you think that this code is okay. You can go here and change the inspection severity to make it green like suggestion. For example, if you disagree with three sharper and you don't want to see excessive number off warnings , there are some very handy and helpful code annotations provided by Harry Sharper. They allow you to to simply five. For example, the implementation off the well known I notify property changed into face, which is commonly used in WP F or to mark by now or not now attributes different a pie members what will help very sharper to analyze your solution on potential bugs so we re sharper will look at applied attributes and lies them and give you suggestions about potential bogs like no reference exceptions. So you can use code annotations by adding them s and you get a package or just copy the C sharp implementation took Liebert and bring them as a CS file. In the cold editing section, You can see here that we have C sharp and different languages and even technologies and frameworks. I'll go to see sharp naming style, and if you disagree with defaults that have been set by re sharper, you can change them here. For example, if you weren't instance private instance fields to be named without an underscore at the beginning off the name off a field, then you can double click on it and remove the name traffics, for example, though I'm not going to do that since I like underscores in private instance Fields and you can change the formatting style provided by every sharper. For example, you might want to manage that the braces layout by default. It's a BSD style, like in the preview here, but for example, maybe you want to use current Eagle and the richest style. Who knows You can change it. The right here. Tabs in dense alignment, blank lines and line breaks and wrapping spaces. All can be changed here without any problems, since the U. Y is very intuitive and you'll have no problems to manage all the options on your own here . Actually, all the settings for free, sharper like braces lee out, you know, formatting style leaning style. They're commonly shared by all the team members, and that's very important to share such settings between all the team members to keep your solution consistent with consistent naming consistent formatting. So for that, Reese Sharper provides. I am in your option called managed options, and you can see here that there are three layers off settings. Solution wide but personal solution wide but team shared and computer wide. So the team shared layer is the layer, which should be shared between team members so you can expert your settings and then add them too version, cultural system and thus share your settings with other team members, and you will keep your solution consistent in naming and formatting. If you want toe override the team shared settings. You can do that in the personal level or even this computer. So this computer overrides team shared and personal overrides that this computer off course in a particular solution. So going to use this feature to share all the settings between all the team members? It's very simple. I'm not going to demonstrate you the process off adding settings file to version control system. I believe that you're so professional that you use version control system, you'll manage to do it on your own. 24. Create via R#: Let's look at what shortcuts from the create section off the default re Sharper's key map Do so you'll see in the default key map that you have three shortcuts for using Intel Incense Control space for simple called completion control. Shift space for a smart code completion and control old space for import symbol completion . Actually, I always use a symbol code completion using control space shortcut because actually symbol called Completion Control space internally provides all the features off smart code and import symbol completion. So you can always just use the control space shortcut for using the most powerful intel, a sense provided by re sharper like that. But again, mostly, you don't need to use the control space shortcut because you can just type in your code and the intel incense will appear automatically. Let's look at another shortcut for completing the statement, which can be called via control shift Enter. For example, Let's say that I want to define another method here, which is called public and sub tract and the text into a anting to be, and you can see where the cursor is right now and in case off using visual studio, I mean bare visual studio. I'd need to never get here and then type in curly braces and using her sharper. I don't need to do this. I can just press here. Control, shift, enter and every sharper is enough smart to type in the opening and closing curly brackets and place the cursor inside the methods body. So control shift enter for completing the current statement. So in general it can be used when the current statement is already completed anyway. But you don't want to type all the you know, so to speak excessive symbols, and you can just press control. Shift enter and the current statement will be completed. And the example I demonstrated you several seconds ago. Maybe one of the most common cases when I use control shift enter for completing a method. Another cool shortcut is controlled. Shift old, up, down, left or right arrow keys. What it does is that it moves code up, down, left or right. In 99% of cases, you want to move code upper down. So, for example, if I want to, let's say switch the place is off our subtract and add methods. I can press control shift old up and control shift old down, and you can see the result. The individual statements also can be moved by using this shortcut. For example, let's say that I do hear something like that. And if I want to swap these line and the last line, I can again price control shift old down like this very need. You also can move classes around using the same shortcut like this, very powerful for formatting your code. Another cool future is hidden under the control W and Control Chief W shortcut. Yes, you may remember, I show you that control W in case of bear visuals to Ugo Select of the current word. You can see here that I pressed control W using Re Sharper's default key map, and it also still acts to the current keyword. However, in case of for a sharper I can continue to press control W. And it will extend the selection. You can see here that now the whole line has been selected, and if it continued to press control, W it's elects another line. And if I press control W, it's elects the whole method and going backward, I can press control shift W and shrink the selection like so very powerful selection. Feature control de in every sharper works s well as in case of bear visual studio just duplicates the line. You can use control shift and square bracket left square bracket if you want to select a containing declaration right away. But actually I used this shortcut rarely. Actually, it's too much, you know, to remember such extremely specific shortcuts. So I usually use control. W and I press it several times and a select everything I need to select to commend out the line you can press, control slash. And by the way, you can see that the cursor was moved down the line so you can brass control, slash, control, slash, control slash and so onto to commend out the lines sequentially. And if you need to uncommon the line, you can go to that line and press control slash once again and it will be uncommanded. Let's say that we have, for example, a customer class which defines several properties like age and name, and every sharper provides the generation cold feature and to use that you can press Ault insert and in this case, every Sharper allows to generate. A constructor allows to override virtual members in this case, off the object class. Of course, to generate the deconstruct er and so on. My press enter and you see here a beautiful pop up window, which allows to generate a constructor. And here you can select those properties that you want to initialize via that constructor. You can change the access rights to that constructor. You can make it public protected and so on, and so you can insert the check for now's off the arguments of the constructor. You can make them optional and you concert them move and so on, women to reorder. So I'll click finish, and you can see here that the constructor was generated properly. Actually, it's impossible to check the integer for now, so only the string instance off Name was checked for the Nile value. By the way, every Sharper provides a very handy shortcut, which is called C Tour. See Torpey? I'll expanded and this same constructor was generated without pressing control. Insert taking the mouse to your hand, clicking all over that pop up window. So seater P is much shorter. Anyway, you can use Ault insert to generate different members and other feature concerns. Inserting their life templates. Let's say that we want to expose a saving method off a customer, which is going to be a public avoid save method and these method. We'll try to save the customer into a database so it will call d B Don't save. I'll generate this class. AL generated the save method. And let's say that we want to catch the exceptions that could be thrown from this coal. And to wrap this call into a template, I can select this expression and click control Old J. Andrew Sharper suggests to rapid via try, try finally and so on. I'll type eight, and this cold was wrapped by the try Catch block with these default implementation with logging to the console. The information about the exception Andriy throwing it. I'll remove it, and you also can insert a life template by pressing control Jane, and you can see here different templates like console right line, do while loop four loop for reach, loop and so on and so on. There are different templates provided by a sharper, which are very similar to the code snippets provided by Visual Studio 25. Navigate via R#: three. Sharper provides that dozing off shortcuts for navigating the code. Let's investigate the most commonly used shortcuts. If you want to go to last edit location, you can press control shift back space block. So So if you did something here and you after that, navigate somewhere else, you can press control ship back space and get back immediately. It works like control minus in bear visual student. I like the shortcut Control E for navigating through their recently opened files. It's very need. And by the way, after pressing control, you can search for a particular find by typing its name like so. If you want to view recently added, it files. You can press control, shift old backspace and again you can type foran, ape, EI member or file where you performed a recent editing, and you'll navigate after that where you want like that to set a bookmark. Using re sharper, you can press control shift six, and now you can navigate to this bookmark by pressing control. Six. Works like a charm, and to remove this bookmark, you can again press control shift six. And now, if you press control six. It says that you can't go to bookmark six because it doesn't exist to explore the code base . You have several shortcuts, and the most commonly used in my practice is control and which is goto everything or search everywhere. And it means that pressing control and re sharper will allow you to find any type or a symbol or a file and so on. So if you want to go toe kill toe later, for example, I type cow and I see that calculator and I never get to it. However, if you work in a large code base control and may find too many members and files. So if you want to shrink the searching field, you can press, for example, control shift and for searching for a file or a folder. And here, if you type calculator, it won't find the type you need to type in an existing file name or folder like Program CS . Like this. Actually, I'm here, and by the way, you can switch between different searching modes by pressing control End then and again, it's which is to the searching for a type than control, and it switches to searching for a word or an arbitrary text another shortcut, which I commonly used his control F 12 to navigate through all the prime members which exist in the current file. So let's say I want to never get to the save method, my type, save, click on it and navigate to the save method. If I want to find all the usages off this method, I can press Ault F seven. And actually, these method is not used anywhere. Let's use it somewhere, for example, from here. And if I now go back and press cult of seven in this case, there is a single usage, so it never gates directly to that usage. And what if we have another method, which does the same? Let's check the behavior. I'll go to the save method. By the way, I can navigate to the save method by clicking control. Be in case of bear visual studio. You'd click F 12 to navigate to the declaration, often epi, I remember. In case of free Sharper, you need to press control be and let's breast cult of seven, and if there is more than one usage, then you'll see find results window where you can look at the results and mitigate to the usage that you want to navigate to, like so like. So, yeah, they're very close to each other in this case to open up the find results window, you can explicitly press control old you and you'll see the window we just saw. There is a contextual shortcut control shift G for navigating to, which will show you the available options, depending on the context off your cursor. So, as I said, to navigate to a declaration off a member, you should press control be like so if you want to go to type off symbol. Staying on an instance, for example, the cursor at the sea variable. And if you want to navigate to its type declaration, then you can press control shift T. And in this case, I'll never get to the customer class. If you want to investigate the file structure, you can press control F 11 and you'll see a very beautiful window, which is called file structure. Not surprisingly, and you'll see here all the members and you can navigate to them very quickly. By the way, you can off course, stick this window to the right or to the left like so So it's also very neat You can use is if your preference is to have an open file structure instead of pressing control of 12. Factually, I use control F 12 in most of the cases. If you want to navigate to the next member in a type you can press old and in their okey like old down, old, down, old down, you can see how old down works. Yep, I never gate through the prime members. Actually, I use it also rarely. Almost always. I use for that control of 12 though, to navigate between closely related a prime members. This shortcut can be used to navigate between those members a little bit faster. If you want to locate the currently open file in a solution Explorer, you can press Ault Shift L and A Solution Explorer will be opened with a correspondingly selected file 26. Annotations in R#: there's another common approach to dealing with now calls. It is based on state of analysis. So what is stated code analysis? In essence, roughly speaking, any analysis without actually running the code can be considered static. If you run the cold click here and there, see the result estimated and then fixing the problem. If there's one, then you're actually doing a reactionary inspection or dynamic analysis. Unfortunately, see Shopko does not provide enough information about possible now out of the box for ST Ick Analysis tools. Such a saree shop, asan or leaned BBS studio or end depend in order to empower ST ick analysis tools by the capability for analyzing methods, inputs and outputs. You can mark output and input parameters has allowed to be now or not allowed. Let's look at an example of how does it work in a re sharper I'll go to re sharper options and code annotation here. Now, in order to use a re sharper annotations, weaken generally either download and you get package or integrate the source code. Using any good package is a better idea, but I'll just copy the source code and included in the project. Now let's look at an example off using annotations. Here we have a method which returns a customer and the method which uses that method. What will happen if I'm Mark the predicate as an argument which doesn't allow knows? Now you can see that Re Sharper says that we can't pass now to the get customer method. Seems the get customer method explicitly says that it doesn't tolerate now, says the input. Let's fix it. The blue squiggly line disappeared. Let's say that the get customer method made return now, In this case, I want to use the can banal attribute on top of the method signature. Now we re sharper shows the blue squiggly line under the customer instance, every sharper statically sees that the get customer may return. Now, as a Corolla re, an exception may be thrown at the attempt to use the returned instance without an al check . Let's fix it by a blank. A standard nal check. Great Everything works as expected. Now you know how to struggle with now's by using special tools performing ST ick analysis. This is a very powerful technique 27. Refactorings: you can see here on the scroll bar different icons off different collars. These icons are displayed by re sharper, since it is constantly analysing your solution. And in each file, it displace all the problems or potential problems that the analyzer sees to navigate through the errors, warnings and suggestions. You can use F 12 F 12 to go to next highlight or go to previous highlight via Shift F 12 so f 12. So I'm navigating to the next issue in file. And to fix this problem, I can try to call the least off available quick fixes and context actions via all to enter . And in this case, it suggests me to command exceptional suppression to change this block to just catch, and it suggests, to manage the inspection to cure the disease. I can do here something like logging and they're throwing the exception. Have 12 old enter and it suggests me to remove an unused parameter black. So have 12. This method is unused, so I can remove it entirely. F 12 and there is sharper suggests to remove all down used during directives in this file, like so f 12 and there are no errors, warnings or suggestions. Founding this file. This is a straightforward process, which helps you to clean your code up, using the power of for a sharper so you just can navigate by F 12 for shift of 12 through all the highlights and fix them using the context dependent shortcut. Old Enter, which always shows all the available quick fixes and context actions to rename a member. You can use a shortcut. F two. Let's say Gold customer like so, and you also can teak or antique the searching comments and string leader Tal's box. Here I'll press next, and the class was renamed to move type or a state IQ member. You can press F six and you'll see a context menu and several options. So in this case, I can move to another file this class to another folder, or to move to another name Space. I'll press moved to another file, and it suggests me to move it to a file named Gold Customer CS. I'll press okay, and now we have, yes, separate file. With this class, I'll get back. If you want to safely delete an A P. I remember you can go to that a P I member and press old delete, and it will ask you to confirm the removal. And if you confirm it, will search for the conflicts. And if you want to remove in a pay, remember which is used somewhere, it will say that it can lead to a problem. To extract a method. You can use the control old M shortcut like so you can choose here either a method or a local function as super cool. Feature off C. Sharp seven. In this case, I'll stick with a method. I'll click next and you'll see another window, which allows you to set and name for the method. I'll name it. Create customer. You can change here, a return type. You can change the signature here in this case by clicking thes box. I say that I want to return a gold costumer via an output parameter. And of course, you can change the access rights selecting private, protected, internal or public. Let's say I want to make it public, and you can see in the preview what you'll get in the end, I'll click next, and they're factoring is done if you want to. In the line variable. You can navigate to that variable and press control old and and as you can see, the expression was incorporated into the call to the right old lines method. And if you want to introduce a variable, so to speak, to perform manufacturing in a completely opposite direction, you can press control old V, and you can see that have variable is introduced, you can rename it right away, and another factoring is that sometimes you want to move, for example, a local variable to a field. If you want to do that, you can navigate to that variable and do control Old D. And you'll see a pop up window, which allows you to give a name to a field that will be created in this case. What is going to be is going to be an innumerable off strings. Let's name it, file the records. You can set a visibility to that field or access rights. In other words, I'll keep it private. And in other scenarios, you can also choose field initialize er or initialize it through a constructor or introduce a constant make it static. But in this case, because I am an aesthetic context. These options are unavailable. Okay, All press next. Andere factoring was performed to change a signature off a method you can do control F six . But actually, I don't use this feature very often. I don't know why. Maybe because these perfect rings are in most cases very simple to perform without any additional super powerful features. However, if you need to, for example, every order, the parameters off a function or constructor that is used from many, many places in your code than these re factoring can be very helpful. I showed you several re factoring is in this lecture. And the last thing I want to say that to call the so called reflector These were context dependent. Factoring You can always do control shift our So, for example, if I stay on the method, I can press control, shift are and you will see all the available options so you can change signature in line method moved to another type, rename it save, delete, extract a super classics extract class extract members to partial push members down and so on and so on Transformed parameters. Let's say I mean the gold customer class. I'll press control shift are. And let's say in this case I can extract and interface, And if I want to extract an interface, I'll do this like that. I'll press enter and isles see a pop up window off extracting an interface, and I can choose here members that will be put in the newly created interface. Let's say I want to see the interface in the same file. Yes, to the source file. By the way, there are two buttons for selecting dependent from each other members and select all the public ones. Okay, I'll click next. Here's our interface. Let's say I want to move it to another filing and press control. Shift our and let's say I want to move it to another folder. This is another pop up window which allows you to navigate through a solution like this. In this case, we don't have a separate folder. Let's say I want to create a fuller for keeping all the interfaces. I'll create this folder since we don't have it and I'll click next and you can see that we have. They're folder called Into Faces Now and ending to face inside that folder. So used control shift our for performing their factoring depending on the context off the cursor So used control shift our when you assume that there should be re factoring that you want to use. But, for example, you don't remember the shortcut for that You're factoring, so you always can ask for You're a sharper to show you all the available options Don't forget about this very powerful shortcut control shift our 28. Code Cleanup: three Sharper supports reformatting. You can see here that we have two functions which are incorrectly formatted. Obviously, there are three main shortcuts for reformatting or so to speak for cleaning up the cold. You can press control old F for cleaning up the code, or you can strictly apply cold styles. Only the code styles pricing control old s or refer Matt the code pressing control old L. I don't know why, but actually, I almost always use control old if and what it does is that it opens up such a window where you can choose what you want to do to perform a full cleanup or two just to refer Matt The code A full cleanup includes many things like apply filing out cold styles, which includes, in its turn, apply far, if possible, certain modifiers. Iran J attributes room off cold redundancies, use ultra product property, if possible, make field Redon, if possible and so on and so on and optimizing using directives, it means mostly removing all the unused directives using statements. Refer Matt code and soul and so on. And if you choose refer Matt coat, you'll just refer. Made the code. If you want to change the behavior off a full cleanup. You can dub click eight. This option you can rename it. Not so full clean up. Of course I'm joking, but you can do so without any doubts, and you can check or uncheck certain boxes. For example. Maybe I don't want to. Certain modifiers were make feels read only if possible, and so on save and then apply exactly these cold clean up. In this case, I want to, Let's see reformat the coats while we're on it and the code was refer matted. Everything is simple. Or, as I said, you could just press control Old L and the code would be reformatted. 29. R# in Action: Let's continue to practice TDD. We move from the simplest examples toward more complex ones. In this session, I'm going to implement the tick tack toe a game with three rows and three columns as tendered won. This game is simple but requires much more tasks rather than in case of parsing the Roman numerals. I need to explain the rules quickly. Since I have students enrolled in my courses from more than 100 countries all over the world, some students from the exotic countries may be unaware of the Tick Tector game. Okay, let's get to the Rose detector. Also known us knots and crosses or access, and those is a paper and pencil game for two players. Ex Endo, who take turns marking the spaces in a three by three greed. The player who succeeds in placing three of their marks in a horizontal vertical or diagonal row wins the game. The example of a game you see on the slide demonstrates how the ex player wins. Placing three crosses in the third row. I installed and crunch as the most popular, too, for running continues testing. You'll see how in crunch intelligently rounds tests automatically when either the test or the cold under the test has been changed, so and crunch is smart in that way, this helps to reduce the frictions caused by hundreds off clicks to run the tests before starting to write tests. We need to think a little bit and build a plan. We want to build a class which provides some FBI to rule the game. I think we will need to count moves to rule the state of squares, setting crosses and knots, determined the state of the game. And who is the winner and basically, that's all. Let's start with a simple test when the game has not been started yet the number of moves should should be equal to zero. I'll write. A test is going to be public void. Great game. We have zero moves and I'll start with assertion right away, and I am going to verify the moves counter property. I think I'll name it moves counter. Okay, it has generated the code. It's going to be off type game equals new game and I will generate the property. It's going to be of type into your and I'll change the center to private and the test passes and crunch says that it passes. We don't need to do here anything. Let's prove that the implementation is wrong by writing. And now the test case. Well, that's right. Another test. It's going to verify that. Well, we make a move, the counter shifts, so I'll name it. Make move counter shifts. And now I can start just with grating and game. Seems we already have the moves counter property. Uh oh. Make a call to make a move. Pressing one. This function doesn't exist yet. Bertel, right? The assertion right away. Expect one as a result. Off calling the moves counter property well, generate the method and eat will take the integer called index. For now, it is failing. Oh, ride the obvious implementation here. I'll incremental moves counter and all the tests. Bass. That's great. I believe we should be able to make moves making a move. I want to pass an indexed off the square. So in Texas, from 1 to 9 are valid. I'll start from a degenerative case, making a move, passing an invalid index so I'll write the following test. I'll name it. Make sorry. Make invalid Move. Throws exception Maybe it would be better to point out the concrete type off. The exception we're expecting to the throne. Okay, assert throws. I expect the argument out French exception to be thrown, and I'll pass the limbed expression here. I'll just create the game instance and call the game. Make move, passing an invalid index and the test fails to satisfy the test. We just need to write a guard clause. Let's do this right here. If Index he's less than one or index is greater than nine, then please throw you in in volatile period. No, no argument. Argument. Out of frame exception and tests. Bass Great. The TDD processes now semi automated I like the and Crunch Tool. Another obvious invalid cases to make move at the same square twice. Let's write a test. Proving implementations is wrong. So I led in the test case. Yeah, let's scope and based it. I'll name it. Move on the same square throws exception, but we're expecting here in invalid operation Exception and let's make a move twice in the first square and the test fails to defend the code. We need to introduce a board with nine squares where we can store the current game state. The current state off square can be unset cross and zero. This is also breathing office. Let's do that. So at first tile, let's move the game in tow. A separate folder. I don't like to create too many glasses through the single file. I'll create a folder and I'll name a tick tack toy in the reality off course the production classes would recite in separate assemblies. I just do this just for the sake of simplicity. And let's move the game class there by re factoring through every shopper moved to folder and yes, yes to the tick tack Toe a folder. Please move it. Yes, three tests best. The last one doesn't. Okay, let's go there and and add. And at a class. Actually, it's going to be an in, um, I'll name it state. Let's change it to public in them and eat will contain Cross zero or not. I'll leave zero and on set. Let's get to the game class and defined the ray off state. Oops, I'll name it. Board the run. Nine squares, so we need to write another guard close. So if I'll write a function here get state passing index is not equal to state on set. They'll please throw and in the village operation exception yet and close generate the good state method It returns the enumeration and takes their index and return the state from index minus one. And I believe that we need to initialize of this. The board off states, all the squares drawn set the move in the same square. He's failing steel. What are we doing wrong? Oh, yes, I know what we're doing. Wrong. Off course. Making a move. We need to change the state. Change the state off the field where we put crosses or not. So let's set the state The logic is pretty simple. Here you've moves counter the remainder off division by two equals 20 Then we're going to set the cross. Otherwise, zero Yes, all the tests pass. I hope everything is clear. I don't do anything complex here. Let's ensure that well, we make a move. A corresponding square gets field by either cross or zero. We satisfy the previous task. But actually we don't verify that square gets field by either across or easier. Let's write another test. Let's get back to tests and write another one. It's going to be a public void and I'll name it. Making moves set state. Sorry said I stayed correctly. Create the game and I'll make several moves. Make 1234 234 And I'll assert with the States. I expect across to be pulled on the first field. Get state from the first index. 234 234 Likes expect here. Zero I expect here across. And I expect here a zero once again and we need to generate the get state method. And we Actually, it was just private. We have already reading this method. Who? Yeah, that's pretty interesting. And all the tests past Look at that. Oh, how nice. I didn't expect that. I see that we have duplication here. I would re factor four calls these four calls to make move method. I would write a private method, make moves which takes game instance and a sequence off parameters. No fainted your time and I'll run it for H loop here in Texas of our index game. Make move, index. And now I can just make moves here, passing game and and passing the indexes. Oh, actually, I can do this without writing the your reign. That's great. Everything passes. By the way. There is a simple case which I forgot to cover. The initial state off a square should be equal to unset. Let's prove that the implementation is incorrect. Or maybe correct. I don't know if you feel let's write another test. I'll write it here. Okay, I'll name it. Create board. By the way, maybe we are going to maybe whom I'm thinking off just adding this assertion right here. Maybe it's good. Maybe it's it's simpler to rename this test create game game. He's He's in is incorrect state. Okay, game is in correct state finding name. Okay. Sounds like it is incorrect state. And add the assertion. We expect this state of set Oh, from the get state pressing index one. And the test passes. Oh, yes. This is because this is because who we try to fix that test and went wrong? Way and initialized. There. A Yep. Yep. So we're already satisfied this test. Okay. Okay, that's fine. Nothing bad happened. So what are we going to do next? I feel like that. The final step is to determine a winner, and generally we have three test cases. A winning line goes horizontally, vertically and diagonally. Let's ride a test. Well, that's right, By the way, these four assertions also can be affected. I'm knowing I'm not going to do this. Let's write another test. I'll call it Get winner Zeros. Ween vertically. Returns, returns. Zeros. Yeah, that will be the value, often in admiration. I'll start from this assertion because we don't have that ap I yet. So this is going to be in the new variation winner Zeros, and it's going to be a method named Get Weiner. I guess at least it sounds logical. Let's create the game and the sequence to five and eight zeros. Zero should win and let's make a sequence of moves. Passing the game soul Cross it. One zero to three is going to be across. Five is going to be 07 is going to be across eight is going to be a zero. Let's generate while the stuff was generated. The winner. Yes, it's going to be in in groups. It's going to be an enumeration. It will contain zeros. I think it will contain crosses and it will contain draw and game. He's, um, finished, though I'm not sure yet drawn. It will contain Draw for sure, but I'm not sure about. The game is unfinished. Let's remove it for now. So let's generate the get winner method. It should return the enumeration. Now we need to write an actual implementation. I could run sleek loops to go through an array detecting, winning, winning lines, but I think I'll go the easier way. I'll just pass to a scanning math at all. The possible winning come by nations. Yes, let's do this. I'll create another method. I'll just get there there within that method. Winning combinations in triplets. So 36 blind. 123 456 79 789 and two, Diagonals. 15 nine 357 It was generally the method. Oh, my goodness. Oh, my goodness. Uh uh Oh. Or a factory to Okay, the Rams argument. Yeah, it's much better. So around a loop through in Texas, incriminating, I buy three. Let's determine that. Are seen signs in the next three Plett in Texas Story sore indexes in Texas. Uh, I plus one. All right. Loss to If they're the same, then that's determined was the winner. If State is not equal to onset, then we can return the winner using the Turn Eri operator. Otherwise, return zeros finally return draw. And, of course, we need to implement our same method, which takes a be and see. We need to check if there this same there stayed the same. No Get state and and get state hey equals states. See? Yes and the tests are passing. That's good. Another case concerns the diagonal winning combination. Let's add a corresponding test case. Maybe it will be satisfied automatically. I'm not sure I believe it should pass. Let's a very five this across his Ween diagonal returns crosses. Yes, the combination off 15 and nine should win the game on for five, say, to end nine and crosses should wean. And indeed, the testes passing. Okay, the get winner method should yes, to get when your math it should also understand when the game is unfinished. Let's write a test that covers this case. Get winner game. He's on finished returns. Well, game is unfinished. Unfinished. Let's make some moves. I'll pass game worm to four. Several lose the game is unfinished. RealAge should bound, finished, and let's assert that get winner returns. Yes, game is on Finished. I was right about the state dame yet winner, and the test fails off course It fails. It should fail. That's good. So we need to implement the corresponding BA hair. So let's go to Let's go to the get winner method. And yes, we can. We can satisfy the test by the following condition. If moves counter lasts of the nine van, the return game is unfinished. Yes, that's right. The testes passing. I feel like we covered all the test cases. That's good. If you find any interesting test cases here, let me know about that on the discussion board or writing me a private message. I could forget something. So this is going to be your homework. Okay, let's try it. Declines code at first. I'll create a separate console application Console application? Yes, I'll name it. Teak tech. Two game and lattes. Let's around these application. Let's play a game. Let's try to win her result liberal, tickly and diagonally. I'll set this project s start up and run. I hope that the printable state will be fine. Let's looted. So let's try to play a game one to three. Yeah, crosses win. Let's wean vertically. 12 three, 56 eight Zeros, Ween and let's wean diagonally one to claws. Six nine crosses win, and we can test the draw. By the way, let's test the draw When. 23 five for seven eight, 96 year and the result is draw. Everything works as expected. Let's look at the test coverage. Mataric. Look at it. The tick tack toe game. He's covered by tests for almost 100%. Do you imagine how reliable our code is? We can trust our tests and cold. If someone introduces changes which break and a task, we will see that and start to investigate the problem. That was a great programming session, lads. Move further.