<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Daniel Donbavand</title>
    <description>The latest articles on DEV Community by Daniel Donbavand (@donbavand).</description>
    <link>https://dev.to/donbavand</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F27027%2F661787fc-5f8b-4030-84f3-c8166d77f1f3.jpg</url>
      <title>DEV Community: Daniel Donbavand</title>
      <link>https://dev.to/donbavand</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/donbavand"/>
    <language>en</language>
    <item>
      <title>ASP.NET Core 2.0: Implementing a 3rd Party Web API</title>
      <dc:creator>Daniel Donbavand</dc:creator>
      <pubDate>Thu, 25 Jan 2018 23:48:27 +0000</pubDate>
      <link>https://dev.to/donbavand/aspnet-core-20-implementing-a-3rd-party-web-api-7p8</link>
      <guid>https://dev.to/donbavand/aspnet-core-20-implementing-a-3rd-party-web-api-7p8</guid>
      <description>&lt;h5&gt;
  
  
  This post was first published on my &lt;a href="http://danieldonbavand.com/implementing-an-api/"&gt;blog site&lt;/a&gt;
&lt;/h5&gt;

&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;A common task for a developer when working with or building an application is implementing and interacting with APIs.&lt;/p&gt;

&lt;p&gt;In this post, we will look at what an API is. We will then move onto creating our own .NET Core 2.0 Web API that implements a 3rd party Web API. &lt;/p&gt;

&lt;h1&gt;
  
  
  What are 3rd Party APIs
&lt;/h1&gt;

&lt;p&gt;API is an acronym for Application Programming Interface which is a software intermediary that allows two applications to talk to each other.  &lt;/p&gt;

&lt;p&gt;There are many different types of APIs, one of the more common types is a Web API, these are often called Web Services. They provide an interface for Web Applications and allow applications to connect and communicate to each other via the internet. You can create your own API for others to interact with or you can interact with others API&lt;/p&gt;

&lt;p&gt;There are thousands of public APIs that can be used, these do things like check for weather updates, get and confirm address details, make online payments and update social media status.&lt;/p&gt;

&lt;p&gt;An example of an API in action, if you think of any website that you have visited where you are made to fill in your address details, you start by typing your street number and name, then a list of addresses are displayed, you select an address and the rest of the fields are populated. Chances are that the website is using a 3rd party Web API that calls off to an address service to get you a list of known addresses that match your search criteria.&lt;/p&gt;

&lt;p&gt;While there are many different types of APIs, this post will focus on Web APIs.&lt;/p&gt;

&lt;p&gt;The example we are going to implement is a Giphy API &lt;a href="https://giphy.com/"&gt;https://giphy.com/&lt;/a&gt;. Giphy is a website that stores GIF images, when a user enters provides Giphy with specfic search criteria, Giphy will try and match that to an image. This API allows us to send an Http request and receive back a GIF image url. &lt;/p&gt;

&lt;h1&gt;
  
  
  What we will be covering
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;Create a Simple ASP.NET Core 2.0  Web API project

&lt;ul&gt;
&lt;li&gt;If you are unsure on how to create a blank .NET Core 2.0 project, then vist my YouTube channel where I show you how this is done &lt;a href="https://youtu.be/lv43vrCo2fg"&gt;ASP.NET Core 2.0: Building a Simple Web API&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Search and read the API (Giphy) documentation&lt;/li&gt;
&lt;li&gt;Create our Controller&lt;/li&gt;
&lt;li&gt;Dependency Injection&lt;/li&gt;
&lt;li&gt;Project Structure&lt;/li&gt;
&lt;li&gt;Creating the Model&lt;/li&gt;
&lt;li&gt;Creating a Service Class&lt;/li&gt;
&lt;li&gt;Creating the GetRandomGif class&lt;/li&gt;
&lt;li&gt;Running the Application&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Implementing the GIPHY API
&lt;/h1&gt;

&lt;h3&gt;
  
  
  Create an Empty .NET Core 2.0 Web API Project
&lt;/h3&gt;

&lt;p&gt;In order to start implementing our Giphy API, we need to create a blank .NET Core Web API project. &lt;/p&gt;

&lt;p&gt;I’ve created a YouTube tutorial &lt;a href="https://youtu.be/lv43vrCo2fg"&gt;ASP.NET Core 2.0: Building a Simple Web API&lt;/a&gt; that goes through how to create this. If you need help creating the Web API, then follow that tutorial before continuing on with the next step. &lt;/p&gt;

&lt;h3&gt;
  
  
  Read the API Documentation
&lt;/h3&gt;

&lt;p&gt;Before we start implementing anything, it’s really important to make sure we have read the APIs documentation. The API documentation contains instructions about how to effectively use and integrate with the API. &lt;/p&gt;

&lt;p&gt;Good API documentation will tell you about usage restrictions, what kind of input the request needs, what the output of your request will look like and other implementation details. &lt;/p&gt;

&lt;p&gt;Unfortunately, not all APIs have good documentation, you need to work with what you get and sometimes you need to do some exploratory learning.&lt;/p&gt;

&lt;p&gt;By reading the API documentation you can use your favourite http request client to call off to the API and view the results, currently, I am using PostMan. By ensuring that the request you make is returning you the results you expect mean that you have understood what is needed to make the request. It will also make it easier to implement into our solution.&lt;/p&gt;

&lt;p&gt;The URL we will be using is &lt;a href="http://api.giphy.com/v1/gifs/search?api_key=%7BgiphyKey%7D&amp;amp;q=%7BsearchCritera%7D&amp;amp;limit=1"&gt;http://api.giphy.com/v1/gifs/search?api_key={giphyKey}&amp;amp;q={searchCritera}&amp;amp;limit=1&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Giphy Links
&lt;/h4&gt;

&lt;p&gt;Website: &lt;a href="https://giphy.com/"&gt;https://giphy.com/&lt;/a&gt;&lt;br&gt;
Developer Website: &lt;a href="https://developers.giphy.com/"&gt;https://developers.giphy.com/&lt;/a&gt;&lt;br&gt;
Giphy Documentation: &lt;a href="https://developers.giphy.com/docs/"&gt;https://developers.giphy.com/docs/&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Creating our Controller
&lt;/h3&gt;

&lt;p&gt;First, we add a controller that returns OK. &lt;/p&gt;

&lt;p&gt;We then add the route [Route("v1/giphy/random/{searchCritera}")] this will allow us to hit our endpoint and pass in a value, the value will be what we want to search on.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[Route("v1/giphy")]
    public class GiphyController : Controller
    {
        [HttpGet]
        [Route("random/{searchCritera}")]
        public IActionResult GetRandomGif(string searchCritera)
        {
            return Ok();
        }
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once we have our basic concept of what the controller and method will look like we will then be following a coding style called Wishful Programming. &lt;/p&gt;

&lt;p&gt;Wishful programming basically means that we write code with the idea that we already have classes and methods available to us, even if we haven’t created them yet. We then create these classes and methods when we need them.&lt;/p&gt;

&lt;p&gt;Let’s try that. We know that the controller is going to call off to a GiphyServices class, so we can write the following inside our controller.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        [HttpGet]
        [Route("v1/giphy/random/{searchCritera}")]
        public async Task&amp;lt;IActionResult&amp;gt; GetRandomGif(string searchCritera)
        {
            var result = await _giphyServices.GetRandomGifBasedOnSearchCritera(searchCritera);

            return Ok(result);
        }
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Throughout this code you will see that I will be using the async and await keywords. Asynchronous programming in C# requires a full blog post of its own. As such, I won’t go into much detail about what it is doing. If in the meantime you would like to know more about Asynchronous programming then you can read more about it &lt;a href="https://docs.microsoft.com/en-us/dotnet/csharp/async"&gt;here&lt;/a&gt;. &lt;/p&gt;

&lt;h2&gt;
  
  
  Dependency Injection
&lt;/h2&gt;

&lt;p&gt;We will be using ASP.NET Cores inbuilt dependency injection framework. I wrote a blog post a while back explaining a bit about dependency inversion, injection and control, you can read it here &lt;a href="http://danieldonbavand.com/dependencyinversion/"&gt;Dependency Inversion&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;MSDN also has a good article &lt;a href="https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection"&gt;Introduction to Dependency Injection in ASP.NET Core&lt;/a&gt; that is directly related to ASP.NET Core &lt;/p&gt;

&lt;p&gt;A very simplified explanation of dependency injection is that in order to access and use methods inside classes we need to instantiate the class, we can do this by newing up the class i.e var x = new GiphyServices(); or making the class static. &lt;/p&gt;

&lt;p&gt;Dependency injection in how we will be using it inside our Giphy project will allow us to instantiate our classes at startup and then inject them into the constructor of each class that needs them. &lt;/p&gt;

&lt;p&gt;Remember this is a very simplified explanation of why we are using dependency injection, it has many other uses as well.&lt;/p&gt;

&lt;p&gt;In order to use and implement Dependency Injection, we need a class and an interface for our class i.e IGiphyServices and GiphyServices, we then add the following code to the startup.cs under the ConfigureServices method&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; public void ConfigureServices(IServiceCollection services)
        {
            services.AddSingleton&amp;lt;IGiphyServices, GiphyServices&amp;gt;();
        }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can then inject it into our GiphyController class constructor&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; private readonly IGiphyServices _giphyServices;
        public GiphyController(IGiphyServices giphyServices)
        {
            _giphyServices = giphyServices;
        }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We are now able to call our GiphyServices class.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        [HttpGet]
        [Route("v1/giphy/random/{searchCritera}")]
        public IActionResult GetRandomGif(string searchCritera)
        {
            var result = _giphyServices.GetRandomGifBasedOnSearchCritera(searchCritera);
            return Ok();
        }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Creating the Project Structure
&lt;/h3&gt;

&lt;p&gt;When designing and building applications, it’s important that we spend time thinking about how we are designing our application and where we put everything. &lt;/p&gt;

&lt;p&gt;Our Giphy solution is going to have two projects inside, a Giphy.API where we will store our Controllers and a Giphy.Libs. &lt;/p&gt;

&lt;p&gt;Inside the Libs project, we will create a services class, this will be used as the glue between calling off to our Giphy class inside the Libs project, once we receive a result we will then send it back to our controller. &lt;/p&gt;

&lt;p&gt;We will then create a Giphy class, this will be used to implement the Giphy API. We will then hit the Giphy Endpoint and get back a gif image URL.  &lt;/p&gt;

&lt;p&gt;We will also need to create a model class inside the Libs project, this model will contain properties. Once we receive a result back from our Giphy API, we then need to deserialize the result into our model. The model will hold the GIF URL that we will then send back to the person making the request.&lt;/p&gt;

&lt;p&gt;Below is an image of what the structure looks like&lt;/p&gt;

&lt;p&gt;&lt;a href="https://thepracticaldev.s3.amazonaws.com/i/euf9rbh5tjlpfbetrfdr.png"&gt;https://thepracticaldev.s3.amazonaws.com/i/euf9rbh5tjlpfbetrfdr.png&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Creating the Model
&lt;/h3&gt;

&lt;p&gt;A model in the case of the Giphy project is a class file, that will have one or more properties that will be used to store the results that we are being returned from the Giphy API. &lt;/p&gt;

&lt;p&gt;We will then return this result in the model back to the user making the request. &lt;/p&gt;

&lt;p&gt;In the Read the API Documentation section above, we found what the endpoint was that we needed to use to make the request to Giphy. The request should have returned us a JSON object similar to this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://thepracticaldev.s3.amazonaws.com/i/rz2uscdvokenm4p73nbq.png"&gt;https://thepracticaldev.s3.amazonaws.com/i/rz2uscdvokenm4p73nbq.png&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can work out from this result, what we want inside our model(s). While there is a lot of data returned here, we often don’t need everything that is displayed. In this case, we are going to take the bitly_gif_url property only.&lt;/p&gt;

&lt;p&gt;When creating a model that is directly mapping to the json result that is returned by the API, we want to follow it’s structure i.e we create two classes one that holds an IEnumerable (Collection) with a property name data, and the second that holds a string with a property name bitly_gif_url. We do this so that we can deserialize the json object into the model. More to come… &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GiphyModel&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class GiphyModel
    {
        public IEnumerable&amp;lt;data&amp;gt; data { get; set; }
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;DataModel&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class data
    {
        public string bitly_gif_url { get; set; }
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Creating the Service Class
&lt;/h3&gt;

&lt;p&gt;Inside the services folder, we now want to create a class called Giphy services along with a matching interface. This will be the glue that takes a request from the controller and passes it to the Giphy class, once we receive a result, we then pass that back to the controller. &lt;/p&gt;

&lt;p&gt;Notice that our return type is the GiphyModel that we created previously. This is what we will be returning back to the controller.&lt;/p&gt;

&lt;p&gt;Using wishful programming, we make a call off to a method in our next class that we will be creating 'GetRandomGif'&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class GiphyServices : IGiphyServices
    {
        private static IGetRandomGif _getRandomGif;

        public GiphyServices(IGetRandomGif getRandomGif)
        {
            _getRandomGif = getRandomGif;
        }

        public async Task&amp;lt;GiphyModel&amp;gt; GetRandomGifBasedOnSearchCritera(string searchCritera)
        {
            return await _getRandomGif.ReturnRandomGifBasedOnTag(searchCritera);
        }
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Creating the GetRandomGif class
&lt;/h3&gt;

&lt;p&gt;This class will make the call to the Giphy API endpoint and return us back a result, we will also deserialize the result using newtonsoft json deserialize into our GiphyModel. &lt;/p&gt;

&lt;p&gt;Let's go ahead and create a GetRandomGif class along with an interface IGetRandomGif so we can dependency inject this class and use it inside the GiphyServices class.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class GiphyServices : IGiphyServices
    {
        private readonly IGetRandomGif _getRandomGif;
        public GiphyServices(IGetRandomGif getRandomGif)
        {
            _getRandomGif = getRandomGif;
        }
        public async Task&amp;lt;GiphyModel&amp;gt; GetRandomGifBasedOnSearchCritera(string searchCritera)
        {
            return await _getRandomGif.ReturnRandomGifBasedOnTag(searchCritera);
        }
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We need to ensure we have added our GetRandomGif class to our ConfigureServices method inside the startup.cs class.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; public void ConfigureServices(IServiceCollection services)
        {
            services.AddSingleton&amp;lt;IGiphyServices, GiphyServices&amp;gt;();
            services.AddSingleton&amp;lt;IGetRandomGif, GetRandomGif&amp;gt;();
        }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You will need to install the following nuget package “Newtonsoft.JSON”&lt;br&gt;
into your Giphy.Libs project&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; install-package Newtonsoft.JSON
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We are using HttpClient to make the request to the Giphy API endpoint, once we get a response we deserialize the JSON object into our Giphy model that we created earlier.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class GetRandomGif : IGetRandomGif
    {
        public async Task&amp;lt;GiphyModel&amp;gt; ReturnRandomGifBasedOnTag(string searchCritera)
        {
            const string giphyKey = "";
            using (var client = new HttpClient())
            {
                var url = new Uri($"http://api.giphy.com/v1/gifs/search?api_key={giphyKey}&amp;amp;q={searchCritera}&amp;amp;limit=1");
                var response = await client.GetAsync(url);
                string json;
                using (var content = response.Content)
                {
                    json = await content.ReadAsStringAsync();
                }
                return JsonConvert.DeserializeObject&amp;lt;GiphyModel&amp;gt;(json);
            }
        }
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; you will need to add your own Giphy API key into the giphyKey constant above.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const string giphyKey = "";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Run the Application
&lt;/h3&gt;

&lt;p&gt;If we run the application, we should be able to hit our endpoint&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{localhost}/v1/giphy/random/{searchCritera}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://thepracticaldev.s3.amazonaws.com/i/nfxs3ngawzyivw2pc48e.png"&gt;https://thepracticaldev.s3.amazonaws.com/i/nfxs3ngawzyivw2pc48e.png&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://thepracticaldev.s3.amazonaws.com/i/4n491guf8cjp4hz7rvfl.png"&gt;https://thepracticaldev.s3.amazonaws.com/i/4n491guf8cjp4hz7rvfl.png&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Summary
&lt;/h3&gt;

&lt;p&gt;In this blog post, we looked at what APIs are and how they are used everywhere. A lot of companies offer Web APIs as a service, that allows us to interact and gather information from the service they are offering. &lt;/p&gt;

&lt;p&gt;In the example above Giphy offers a GIF image service, you enter a search term and it returns you a URL to a gif related to your search.&lt;/p&gt;

&lt;p&gt;In programming we interact with Web APIs all the time, by learning how to find and read the documentation on an API and then interact with it, is a very useful coding skill to have. &lt;/p&gt;

&lt;p&gt;Remember, it’s really important that you &lt;a href="http://danieldonbavand.com/documentationisimportant/"&gt;read the documentation&lt;/a&gt; to ensure you understand what you are implementing. &lt;/p&gt;

&lt;p&gt;You can find the working code that we built above in my gitHub repo&lt;br&gt;
&lt;a href="https://github.com/donbavand/Giphy"&gt;https://github.com/donbavand/Giphy&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I have made a recording on YouTube, you can watch it here.&lt;/p&gt;

&lt;p&gt;If you have any questions, comments or if something doesn’t make sense, reach out to me through twitter &lt;a href="https://twitter.com/Donbavand"&gt;@donbavand&lt;/a&gt; and I’d be more than happy to help. &lt;/p&gt;

&lt;p&gt;I also have a &lt;a href="https://www.youtube.com/user/MultiB0x"&gt;YouTube channel&lt;/a&gt; that I am creating How-To tutorials on that you can subscribe to. &lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>csharp</category>
      <category>dotnetcore</category>
    </item>
    <item>
      <title>Deploying a Dockerized .NET Core application with Bitbucket pipelines and AWS</title>
      <dc:creator>Daniel Donbavand</dc:creator>
      <pubDate>Thu, 16 Nov 2017 01:52:00 +0000</pubDate>
      <link>https://dev.to/donbavand/deploying-a-dockerized-net-core-application-with-bitbucket-pipelines-and-aws-7dg</link>
      <guid>https://dev.to/donbavand/deploying-a-dockerized-net-core-application-with-bitbucket-pipelines-and-aws-7dg</guid>
      <description>&lt;p&gt;This post was first published on my &lt;a href="https://danieldonbavand.com/bitbucketpipelines/"&gt;blog site&lt;/a&gt; &lt;/p&gt;

&lt;h1&gt;
  
  
  Introduction:
&lt;/h1&gt;

&lt;p&gt;I recently started refactoring my side project, the refactor included converting my .NET 4.5 Web Api into a .NET Core 2.0 Web Api, I wanted it to run on an AWS Linux instance inside a Docker container. After spending too much time building and pushing code up to my Docker container on AWS I decided that I needed a continuous delivery deployment pipeline.&lt;/p&gt;

&lt;p&gt;There are many tools that help you achieve CI/CD, my project is stored in a Bitbucket account and I had noticed last year 'October 2016' Bitbucket had launched a new feature called pipelines. &lt;/p&gt;

&lt;p&gt;Bitbucket pipelines offers a continuous integration or delivery service that is built right into Bitbucket. Using Bitbucket pipelines made it easy for me to create a way to build my .NET Core application and to build, tag and push my Docker image to my AWS ECR repository. I was then able to create a new task definition and update my service in AWS to make use of the new task. The build pipeline kicks off as soon as I merge changes into my master branch.&lt;/p&gt;

&lt;p&gt;This blog post is going to show you how I have setup my Bitbucket pipeline, that builds my .NET Core application, then builds, tags and pushes my docker image to my AWS ECR repository and how I update a task definition and service.&lt;/p&gt;

&lt;h1&gt;
  
  
  What are Bitbucket Pipelines
&lt;/h1&gt;

&lt;p&gt;Bitbucket pipelines allows people to build, test and deploy applications without the need to setup an expensive and time consuming CI/CD server. Bitbucket uses docker images as a base, that setups an environment that allows you to then run other commands.&lt;/p&gt;

&lt;p&gt;The Bitbucket pipeline adds a bitbucket-pipelines.yml file to your project that is used when the pipeline kicks off, this holds all your commands on what the pipeline is to do. The default image that is run when the build pipelines kicks off, is the atlassian/default-image:latest, this allows you to run linux commands such as “sudo apt-get update”. By simply adding the option "docker: true" inside the pipeline bitbucket-pipelines.yml file, your pipeline will now have docker support and allows you to run docker commands.&lt;/p&gt;

&lt;p&gt;When I push my C# .NET Core project up to my Bitbucket account the Bitbucket pipelines registers that I have push up code changes and kicks off the build pipeline process.&lt;/p&gt;

&lt;p&gt;I love the fact that I don’t have to switch between multiple applications to build and deploy my code, with Bitbucket pipelines, I can push my code up to my master branch and that’s it. Within a short time the code would have built and updated on my AWS EC2 instance. &lt;/p&gt;

&lt;h1&gt;
  
  
  What am I using Bitbucket pipelines for?
&lt;/h1&gt;

&lt;p&gt;My project is a .NET Core 2.0 application that is run on a Linux Docker container on AWS. The first cut of my build pipeline includes the following &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Download and install the .NET Core SDK&lt;/li&gt;
&lt;li&gt;Restore and publish my .NET Core application&lt;/li&gt;
&lt;li&gt;Download and install the AWS SDK &lt;/li&gt;
&lt;li&gt;Log into AWS &lt;/li&gt;
&lt;li&gt;Build my Docker image&lt;/li&gt;
&lt;li&gt;Tag my Docker image&lt;/li&gt;
&lt;li&gt;Push my Docker image up to my AWS ECR repository&lt;/li&gt;
&lt;li&gt;Register a new task definition in AWS&lt;/li&gt;
&lt;li&gt;Update my AWS service, to make use of the new task definition.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I am doing a lot in the pipeline script, as you can most likely see, downloading and installing the AWS and .NET Core SDK each time I run the pipeline is time consuming and wasteful. Stage 2 of building my Bitbucket pipeline includes creating a docker image that contains the AWS SDK and to also include the .NET Core build, restore and publish process inside my Dockerfile. Rather than showing you the end result, I wanted to show how I am doing all of these tasks first, as this could be useful for others.&lt;/p&gt;

&lt;h1&gt;
  
  
  BitBucket Pipeline Code - Stage 1
&lt;/h1&gt;

&lt;p&gt;Let's take a look at the bitbucket-pipelines.yml file and work through what each command is doing. &lt;/p&gt;

&lt;p&gt;It’s important to mention here that the bitbucket-pipelines.yml file is very picky about spacing and where everything is, so make sure you align everything correctly.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;image: atlassian/default-image:latest

options:
  docker: true

pipelines:
  branches:
    master:
      - step:
          script:
          #.NET Core         
          # Register the Microsoft Product key as trusted.
          - curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor &amp;gt; microsoft.gpg
          - sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg

          # Set up host package feed.
          - sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-trusty-prod trusty main" &amp;gt; /etc/apt/sources.list.d/dotnetdev.list'

          # Install .NET Core SDK.
          - sudo apt-get install apt-transport-https
          - sudo apt-get update
          - sudo apt-get -y install dotnet-sdk-2.0.0

          # Restore, Publish and Release the .NET core project
          - dotnet restore ./projectName.sln &amp;amp;&amp;amp; dotnet publish ./projectName.sln -c Release -o ../obj/Docker/publish

          # AWS SDK

          # Download AWS SDK
          - curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"

          # Unzip the AWS SDK and Install
          - sudo apt-get install jq
          - unzip awscli-bundle.zip
          - ./awscli-bundle/install -b ~/bin/aws
          - export PATH=~/bin:$PATH

          # Login to AWS
          - export LOGIN=$(aws ecr get-login)
          - $LOGIN

          # Build my docker image
          - docker build -t projectName .

          # Tag and push my docker image to ECR
          - docker tag projectName:latest xxxxxxxxxxx.dkr.ecr.us-east-1.amazonaws.com/projectName:latest
          - docker push  xxxxxxxxxxx.dkr.ecr.us-east-1.amazonaws.com/projectName:latest

          # Register the ECS task definition and capture the version
          - export IMAGE_NAME=xxxxxxxxxxx.dkr.ecr.us-east-1.amazonaws.com/projectName:latest
          - export TASK_VERSION=$(aws ecs register-task-definition --family ECRFamilyName --container-definitions "[{\"name\":\"ExampleName\",\"image\":\"$IMAGE_NAME\",\"portMappings\":[{\"containerPort\":80,\"hostPort\":80,\"protocol\":\"tcp\"}],\"memory\":128,\"essential\":true}]" | jq --raw-output '.taskDefinition.revision')

          # Set ECS service to desired count 0  
          - aws ecs update-service --cluster default --service ecrServiceName--desired-count 0

          # Set ECS service to desired count 1 and assign the new task-definition 
          - aws ecs update-service --cluster default --service ecrServiceName --task-definition ECRBonecrusher:$TASK_VERSION --desired-count 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's take a closer look at each line of code and see what they are doing&lt;/p&gt;

&lt;p&gt;First I’m telling the build pipeline what image I want to use for my build and also I’m enabling docker support.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;image: atlassian/default-image:latest

options:
  docker: true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You are able to run different builds on different branches with Bitbucket pipelines. Here I am specifying that I want to run the following script on my master branch.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pipelines:
  branches:
    master:
      - step:
          script:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next we install the .NET Core SDK, so we can build our project. In order to download the .NET Core SDK, we need to register the microsoft product key and setup the host package feed. If you don’t do this, you won’t be able to install the dotnet-sdk.20.0&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;     #.NET Core         
          # Register the Microsoft Product key as trusted.
          - curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor &amp;gt; microsoft.gpg
          - sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg

          # Set up host package feed.
          - sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-trusty-prod trusty main" &amp;gt; /etc/apt/sources.list.d/dotnetdev.list'

          # Install .NET Core SDK.
          - sudo apt-get install apt-transport-https
          - sudo apt-get update
          - sudo apt-get -y install dotnet-sdk-2.0.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next I restore, publish and release my .NET Core project&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;          # Restore, Publish and Release the .NET core project
          - dotnet restore ./projectName.sln &amp;amp;&amp;amp; dotnet publish ./projectName.sln -c Release -o ../obj/Docker/publish
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The next stage is to download and install the AWS SDK.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;          # AWS SDK          
          # Download AWS SDK
          - curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"

          # Unzip the AWS SDK and Install
          - sudo apt-get install jq
          - unzip awscli-bundle.zip
          - ./awscli-bundle/install -b ~/bin/aws
          - export PATH=~/bin:$PATH
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next we log into AWS, so we can push to the ECR repository where my project lives.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;          # Login to AWS
          - export LOGIN=$(aws ecr get-login)
          - $LOGIN
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The next steps are the standard build, tag and push for the Docker image.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;          # Build my docker image
          - docker build -t projectName .

          # Tag and push my docker image to ECR
          - docker tag projectName:latest xxxxxxxxxxx.dkr.ecr.us-east-1.amazonaws.com/projectName:latest
          - docker push  xxxxxxxxxxx.dkr.ecr.us-east-1.amazonaws.com/projectName:latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once we have our new Docker image, we want to register a new task definition ready to use on our service.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;          # Register the ECS task definition and capture the version
          - export 
IMAGE_NAME=xxxxxxxxxxx.dkr.ecr.us-east-1.amazonaws.com/projectName:latest
          - export TASK_VERSION=$(aws ecs register-task-definition --family ECRFamilyName --container-definitions "[{\"name\":\"ExampleName\",\"image\":\"$IMAGE_NAME\",\"portMappings\":[{\"containerPort\":80,\"hostPort\":80,\"protocol\":\"tcp\"}],\"memory\":128,\"essential\":true}]" | jq --raw-output '.taskDefinition.revision')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The final step is to update our service with our new task, spin down the service and spin it back up to make use of the new task definition.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;          # Set ECS service to desired count 0  
          - aws ecs update-service --cluster default --service ecrServiceName --desired-count 0

          # Set ECS service to desired count 1 and assign the new task-definition 
          - aws ecs update-service --cluster default --service ecrServiceName --task-definition ECRTaskName:$TASK_VERSION --desired-count 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt;&lt;br&gt;
In order for me to be able to spin down my service to 0 and then update the task definition on the service, then spin it back up I’ve set ‘number of healthy hosts' to 0%, on my AWS service, so that I don’t need to run multiple instances (cost savings) if this was a production instance, then I would be running multiple instances, release to a single instance before draining connections from the other instances and releasing to them. &lt;/p&gt;

&lt;p&gt;I would also be using an ALB, but because this isn't a production application (yet) short outages are fine.&lt;/p&gt;
&lt;h1&gt;
  
  
  Bitbucket Pipelines Code - Stage 2
&lt;/h1&gt;

&lt;p&gt;I have removed a lot of the unneeded code inside the bitbucket-pipelines.yml file by combining the dotnet build and publish steps into my Dockerfile that, then copy the published app step into a runtime image all in the same Dockerfile.&lt;/p&gt;

&lt;p&gt;“.NET Core Docker images can now use multi-stage build using a new feature from Docker that allows multiple FROM lines to be used in one Dockerfile. The multi-stage build feature was recently introduced into the Docker client Stable channel. Using this feature, you can build a .NET Core app in an SDK image (AKA 'build image') and then copy the published app into a runtime image all in the same Dockerfile. To see an example of this in practice, check out the .NET Docker Samples Repo.”&lt;/p&gt;

&lt;p&gt;Also by creating a docker image that contains the AWS SDK, I can remove the need to install it as part of my pipeline.&lt;/p&gt;

&lt;p&gt;Below is what my final version is.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;image: aaithal/aws-sdk

options:
  docker: true

pipelines:
  branches:
    master:
      - step:
          script:          
          # Login to AWS
          - export LOGIN=$(aws ecr get-login)
          - $LOGIN

          # Build my docker image
          - docker build -t imageName .

          # Tag and push my docker image to ECR
          - docker tag imageName:latest xxxxxxxxxxxx.dkr.ecr.us-east-1.amazonaws.com/imageName:latest
          - docker push xxxxxxxxxxxx.dkr.ecr.us-east-1.amazonaws.com/imageName:latest

          # Register the ECS task definition and capture the version
          - export IMAGE_NAME=xxxxxxxxxxxxxxxx.dkr.ecr.us-east-1.amazonaws.com/imageName:latest
          - export TASK_VERSION=$(aws ecs register-task-definition --family ECRName --container-definitions "[{\"name\":\"xxxxxxx-xxxxx-xxx-xxxx-xxxxxxxxxxxxx\",\"image\":\"$IMAGE_NAME\",\"portMappings\":[{\"containerPort\":80,\"hostPort\":80,\"protocol\":\"tcp\"}],\"memory\":128,\"essential\":true}]" | jq --raw-output '.taskDefinition.revision')

          # Set ECS service to desired count 0  
          - aws ecs update-service --cluster default --service serviceName --desired-count 0

          # Set ECS service to desired count 1 and assign the new task-definition 
          - aws ecs update-service --cluster default --service serviceName --task-definition taskDefintionName:$TASK_VERSION --desired-count 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Summary:
&lt;/h1&gt;

&lt;p&gt;There are many tools that you can use to achieve CI/CD, this was one of them, for a side project I found using Bitbucket pipelines easy to use and it lives in the same place as my source code. Bitbucket pipelines is also very cheap.&lt;/p&gt;

&lt;p&gt;Being able to push my code to master and then forget about it, makes developing my project a lot easier, it was also fun to learn and investigate other CI/CD tools that I haven’t used before.&lt;/p&gt;

&lt;p&gt;If you have any questions, comments or advice, I would love to hear from you, please feel free to email or get in touch via twitter.  &lt;/p&gt;

</description>
      <category>bitbucket</category>
      <category>pipelines</category>
      <category>c</category>
      <category>docker</category>
    </item>
    <item>
      <title>Integration Testing in .NET Core 2.0</title>
      <dc:creator>Daniel Donbavand</dc:creator>
      <pubDate>Thu, 31 Aug 2017 03:52:32 +0000</pubDate>
      <link>https://dev.to/donbavand/integration-testing-in-net-core-20</link>
      <guid>https://dev.to/donbavand/integration-testing-in-net-core-20</guid>
      <description>&lt;p&gt;This post was first published on my &lt;a href="https://danieldonbavand.com/integration-testing/" rel="noopener noreferrer"&gt;blog site&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;We all know how important writing tests are when developing software, it ensures that your code is working as expected and allows you to more easily refactor existing code. Tests can also help someone new to your application learn how it works and what functions its offers. &lt;/p&gt;

&lt;p&gt;Each test level has its purpose, whether that be unit or integration testing. Having good integration tests are important when you are developing software. It ensures your application end to end flow is working correctly. &lt;/p&gt;

&lt;p&gt;While making sure your project has well designed integration tests, it is equally important that your tests are easy to run and fast. This is an important point, if there is a big investment to set up in order for the tests to run, or the tests take a long time to run, people are simply not going to use them.&lt;/p&gt;

&lt;p&gt;This blog post shows you how to create an in-memory integration testing framework that is quick and easy to setup for a .NET core 2.0 Web Service.   &lt;/p&gt;

&lt;h2&gt;
  
  
  In-Memory Testing
&lt;/h2&gt;

&lt;p&gt;Using an in-memory web host allows us to setup and run our tests quickly and easily. Kestrel is a cross-platform development web server that is used by .NET core applications.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Kestrel is a cross-platform web server for ASP.NET Core based on libuv, a cross-platform asynchronous I/O library. Kestrel is the web server that is included by default in ASP.NET Core project templates.&lt;br&gt;
Kestrel supports the following features:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTTPS&lt;/li&gt;
&lt;li&gt;Opaque upgrade used to enable WebSockets&lt;/li&gt;
&lt;li&gt;Unix sockets for high performance behind Nginx&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Kestrel is supported on all platforms and versions that .NET Core supports.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Creating a simple .NET core 2.0 WebApi
&lt;/h2&gt;

&lt;p&gt;Below I have setup a simple WebApi in .NET Core 2.0 with a single ping controller. This returns an OK response when called. I will create my integration test project inside this solution, then write and run my tests against the ping controller.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnny2m7jkovaxbuk3qi8u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnny2m7jkovaxbuk3qi8u.png" alt="2017-08-29_6-47-19" width="233" height="186"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    public class HealthcheckController : Controller
    {
        [HttpGet]
        [Route("ping")]
        public IActionResult Ping()
        {
            return Ok();
        }
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Setting up the Integration Test Framework
&lt;/h2&gt;

&lt;p&gt;First let's create an integration test project inside our solution. I like to follow the following naming format &lt;code&gt;ProjectName.Integration.Tests&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now we have our integration test project setup, we can start to create a test context, it is common for integration test classes to share setup and cleanup code we often call this a "test context". We will use the test context to setup a hosting framework ready to run our integration tests on. The test context for this example will be used to setup the test server and client.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5n08hc5015rpu7hhuetb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5n08hc5015rpu7hhuetb.png" alt="2017-08-29_6-47-20" width="229" height="267"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We now need to install the following nuget package &lt;code&gt;Microsoft.AspNetCore.TestHost&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;ASP.NET Core includes a test host that can be added to integration test projects and used to host ASP.NET Core applications, serving test requests without the need for a real web host. &lt;/p&gt;

&lt;p&gt;Once the Microsoft.AspNetCore.TestHost package is included in the project, you'll be able to create and configure a TestServer in your tests. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Once we have install the TestHost nuget package, we need to setup the test server and client.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; public class TestContext
    {
        private TestServer _server;
        public HttpClient Client { get; private set; }

        public TestContext()
        {
            SetUpClient();
        }

        private void SetUpClient()
        {
            _server = new TestServer(new WebHostBuilder()
                .UseStartup&amp;lt;Startup&amp;gt;());

            Client = _server.CreateClient();
        }
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Before starting to write our actual tests, we need to install a few nuget packages. &lt;code&gt;xunit&lt;/code&gt; and &lt;code&gt;xunit.runner.visualstudio&lt;/code&gt; I also like to use FluentAssertions, if you are following along, then install the &lt;code&gt;fluentassertions&lt;/code&gt; package as well. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Fluent Assertions is a set of .NET extension methods that allow you to more naturally specify the expected outcome of a TDD or BDD-style test.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Another important package you need to install is the &lt;code&gt;Microsoft.NET.Test.Sdk&lt;/code&gt; otherwise your tests will show "Test Inconclusive" in the ‘Test Session Runner’ when trying to run them.&lt;/p&gt;

&lt;p&gt;Here is a list of the nuget packages and versions I have installed. I'm including this screenshot as often versions change and this can cause problems, also the error messages can sometimes not be very helpful. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhcy51wx0lcjkk0zhupok.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhcy51wx0lcjkk0zhupok.png" alt="2017-08-31_6-09-08" width="375" height="240"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The first test we are going to write is to test the ping controller. When we call the ping controller we should see an OK response. Very simple, but a good starting point to ensure your test framework and your WebApi are working correctly.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; public class PingTests
    {
        private readonly TestContext _sut;

        public PingTests()
        {
            _sut = new TestContext(); 
        }

        [Fact]
        public async Task PingReturnsOkResponse()
        {
            var response = await _sut.Client.GetAsync("/ping");

            response.EnsureSuccessStatusCode();

            response.StatusCode.Should().Be(HttpStatusCode.OK);
        }
    }   
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That’s it, you now have an integration test framework, ready to add more tests to as you build out your WebApi. &lt;/p&gt;

&lt;h2&gt;
  
  
  Creating a Single Test Context
&lt;/h2&gt;

&lt;p&gt;Creating tests with the structure above, creates a new test context per test scenario. This isn't always desirable, sometimes you want to setup your test context then run all tests or a collection of tests in your solution. &lt;/p&gt;

&lt;p&gt;Setting up your test context once can have massive benefits, for example, if you need to deploy and publish a database as part of your integration test setup, doing this is going to take some time to complete. It might not make sense to setup the database for each test scenario. What would be a better plan, would be to set it up once, then run all your tests that interact with the database.&lt;/p&gt;

&lt;p&gt;Xunit allows us to setup and create collections.&lt;/p&gt;

&lt;p&gt;First we need to create a collection class. This class can be named whatever make sense to you.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[CollectionDefinition("SystemCollection")]
    public class Collection : ICollectionFixture&amp;lt;TestContext&amp;gt;
    {

    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The collection class will never have any code inside it. The purpose of this class is to apply the [CollectionDefinition] decorator and all of the ICollectionFixture&amp;lt;&amp;gt; interfaces. &lt;/p&gt;

&lt;p&gt;I have applied only one ICollectionFixture, but you can apply as many as you want. &lt;/p&gt;

&lt;p&gt;Next add the IDisposable interface to your TestContext class, to ensure context cleanup happens.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  public class TestContext : IDisposable
    {
        private TestServer _server;
        public HttpClient Client { get; private set; }

        public TestContext()
        {
            SetUpClient();
        }

        private void SetUpClient()
        {
            _server = new TestServer(new WebHostBuilder()
                .UseStartup&amp;lt;Startup&amp;gt;());

            Client = _server.CreateClient();
        }

        public void Dispose()
        {
            _server?.Dispose();
            Client?.Dispose();
        }
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we add the CollectionDefinition name to the tests we want to run in a single collection&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    [Collection("SystemCollection")]
    public class PingTests
    {
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the test class needs access to the fixture instance, add it as a constructor argument, and it will be provided automatically.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  [Collection("SystemCollection")]
    public class PingTests
    {
        public readonly TestContext Context;

        public PingTests(TestContext context)
        {
            Context = context;
        }

        [Fact]
        public async Task PingReturnsOkResponse()
        {
            var response = await Context.Client.GetAsync("/ping");

            response.EnsureSuccessStatusCode();

            response.StatusCode.Should().Be(HttpStatusCode.OK);
        }
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An important note is that when running tests in a collection they do not run in parallel. If you want your tests to run in parallel, then you need to either split out the collections or not use collections at all. &lt;/p&gt;

&lt;p&gt;You can find the above code in my &lt;a href="https://github.com/donbavand/dotnetcore-integration-tests-example" rel="noopener noreferrer"&gt;GitHub repository&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finally, if you want to discuss anything written here or in any of my other blog posts, you can find me on &lt;a href="https://twitter.com/Donbavand" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;&lt;/p&gt;

</description>
      <category>testing</category>
      <category>beginners</category>
      <category>programming</category>
      <category>csharp</category>
    </item>
    <item>
      <title>Developer Bootcamp</title>
      <dc:creator>Daniel Donbavand</dc:creator>
      <pubDate>Thu, 03 Aug 2017 17:57:01 +0000</pubDate>
      <link>https://dev.to/donbavand/developer-bootcamp</link>
      <guid>https://dev.to/donbavand/developer-bootcamp</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Developer bootcamps are often associated with 3rd party organisations offering bootcamps to help train junior developers looking to get into their first job. Development bootcamps are used as a way to upskill  an individual's coding knowledge rapidly.&lt;/p&gt;

&lt;p&gt;Why are bootcamps only run as a way to get into your first role? Why not set them up and run them in your organisation for either junior, intermediate or even senior developers?&lt;/p&gt;

&lt;p&gt;This is exactly what we did at my current place of employment, when I made the &lt;a href="https://danieldonbavand.com/qatodevelopment/"&gt;transition from QA into a Development&lt;/a&gt;, a 2 month C# coding bootcamp was setup that would start off with some of the basics of the C# programming language then move into more advance topics. &lt;/p&gt;

&lt;h2&gt;
  
  
  Why a Developer Bootcamp?
&lt;/h2&gt;

&lt;p&gt;C# is a complex language and contains many different areas that require diving deep to fully understand them. It can be quite overwhelming for junior developers to see how many different areas there are in the C# language. All areas of the C# language are important, but when starting out, it's important to know what areas are going to give you the biggest bang for your buck, i.e what areas to learn first, then work out how deep to go in learning these certain areas.&lt;/p&gt;

&lt;p&gt;It’s easy for developers to fall into the trap of copying and pasting code without actually understanding it, with sites such as stack overflow that many developers use to grab snippets of code, it’s important that you actually understand the code you are using. When you don’t understand what the code is doing you are in danger of releasing code that is not scalable, has unintended side effects and you are more likely to have bugs in your code.&lt;/p&gt;

&lt;p&gt;When starting out as a developer the bootcamp helped me build on top of my existing coding knowledge. While I knew certain areas, I definitely fell into the trap of copying and pasting a lot, without actually understanding what it was doing. The camp has allowed me to more easily see when I should be investigating other ways to do things, to know when something doesn’t look right and to know why code might be written the way it is.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bootcamp Structure.
&lt;/h2&gt;

&lt;p&gt;The boot camp consisted of three two and a half hour sessions a week run by the more senior developers in our team. We were assigned homework to complete prior to class. The homework included watching pluralsight courses that were focused on the next day's topics, reading relevant articles and certain chapters from code books.&lt;/p&gt;

&lt;p&gt;We were assigned mentors that put time aside every week for 1 on 1 sessions. In these sessions, we would go over anything we needed more clarification on from the bootcamps.&lt;/p&gt;

&lt;p&gt;An example of the bootcamp structure that we followed can be seen below.&lt;/p&gt;

&lt;h4&gt;
  
  
  Weeks 1 - 2
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;C# Fundamentals&lt;/li&gt;
&lt;li&gt;Equality and comparison&lt;/li&gt;
&lt;li&gt;Collections&lt;/li&gt;
&lt;li&gt;Interfaces

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Exercises&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://exercism.io/exercises/csharp/accumulate/readme"&gt;http://exercism.io/exercises/csharp/accumulate/readme&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://exercism.io/exercises/csharp/strain/readme"&gt;http://exercism.io/exercises/csharp/strain/readme&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://exercism.io/exercises/csharp/word-count/readme"&gt;http://exercism.io/exercises/csharp/word-count/readme&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Weeks 3
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Best practices - collections and generics&lt;/li&gt;
&lt;li&gt;OOP &lt;/li&gt;
&lt;li&gt;C# events, delegates

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Exercises&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Write a shard/route/cell lookup cache&lt;/li&gt;
&lt;li&gt;Create an event driven file watcher&lt;/li&gt;
&lt;li&gt;&lt;a href="http://exercism.io/exercises/csharp/robot-simulator/readme"&gt;http://exercism.io/exercises/csharp/robot-simulator/readme&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Week 4
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Lambdas/anonymous objects&lt;/li&gt;
&lt;li&gt;LINQ expressions&lt;/li&gt;
&lt;li&gt;LINQ operators

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Exercises&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Refactor previous lessons to use LINQ&lt;/li&gt;
&lt;li&gt;&lt;a href="http://exercism.io/exercises/csharp/simple-linked-list/readme"&gt;http://exercism.io/exercises/csharp/simple-linked-list/readme&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://exercism.io/exercises/csharp/binary-search-tree/readme"&gt;http://exercism.io/exercises/csharp/binary-search-tree/readme&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Week 5 - 6
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Defensive programming&lt;/li&gt;
&lt;li&gt;Exceptions and exception handling&lt;/li&gt;
&lt;li&gt;Streams/IO&lt;/li&gt;
&lt;li&gt;Http Requests&lt;/li&gt;
&lt;li&gt;Reflection&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Week 7 - 8
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Threads/Concurrency&lt;/li&gt;
&lt;li&gt;Monitors/Locking/Semaphores&lt;/li&gt;
&lt;li&gt;Async programming&lt;/li&gt;
&lt;li&gt;Concurrent collections

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Exercises&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Coding Dojo&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The bootcamp can be customised in many ways, depending on skill level, the amount of time people have to invest etc. &lt;/p&gt;

&lt;p&gt;The format for each session depended on the person taking the class and also what content was being covered.&lt;/p&gt;

&lt;p&gt;An example format that was followed would be, answer a set of questions at the start of the class, this then helped drive what areas to focus on. We would complete coding exercises and dive into deep discussions on ideas and thoughts about topics that were being covered in that week.&lt;/p&gt;

&lt;p&gt;While we use many different websites for the training material, some of the more common sites are&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.pluralsight.com"&gt;&lt;strong&gt;Pluralsight&lt;/strong&gt;&lt;/a&gt; - is an online education company that offers a variety of video training courses for software developers, IT administrators, and creative professionals through its website.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.codeschool.com"&gt;&lt;strong&gt;Code School&lt;/strong&gt;&lt;/a&gt; - is an online learning destination for existing and aspiring developers that teaches through entertaining content. Each course is built around a creative theme and combines gaming mechanics with video instruction and in-browser coding challenges to make learning both educational and memorable.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://exercism.io/"&gt;&lt;strong&gt;Exercism&lt;/strong&gt;&lt;/a&gt; - is an online site that provides coding exercises in many languages. Each exercise has a set of automated tests, that you must get passing. The exercises encourage you to explore trade-offs and best-practices. Each solution you write is an occasion to ponder readability and code smells.&lt;/p&gt;

&lt;h4&gt;
  
  
  Coding books that we found useful,
&lt;/h4&gt;

&lt;p&gt;• &lt;a href="https://www.amazon.com/C-6-0-Nutshell-Definitive-Reference/dp/1491927062/ref=sr_1_2?s=books&amp;amp;ie=UTF8&amp;amp;qid=1501612688&amp;amp;sr=1-2&amp;amp;keywords=c+in+a+nutshell"&gt;C# in a Nutshell&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;• &lt;a href="https://www.amazon.com/C-Depth-3rd-Jon-Skeet/dp/161729134X/ref=sr_1_1?s=books&amp;amp;ie=UTF8&amp;amp;qid=1501612666&amp;amp;sr=1-1&amp;amp;keywords=C%23+in+depth"&gt;C# in depth&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;• &lt;a href="https://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882/ref=sr_1_1?s=books&amp;amp;ie=UTF8&amp;amp;qid=1501612644&amp;amp;sr=1-1&amp;amp;keywords=Clean+Code"&gt;Clean-Code&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;• &lt;a href="https://www.amazon.com/Code-Complete-Practical-Handbook-Construction/dp/0735619670/ref=sr_1_1?s=books&amp;amp;ie=UTF8&amp;amp;qid=1501612324&amp;amp;sr=1-1&amp;amp;keywords=Code+Complete"&gt;Code-Complete&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Mentorship
&lt;/h2&gt;

&lt;p&gt;Having a mentor assigned was another part that made the bootcamp so successful, it gives people a single point of contact to ask questions to. Mentors would setup weekly training dojos, that were used to through a set of problems, based on the weekly bootcamps. These dojos would be used to also cover areas that might not have been fully understood at the time or needing further information on.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;I’ve taken one of these bootcamps and it has helped increase my knowledge and understanding in the C# language. I believe that it’s important we understand the code we are writing so that we write more maintainable code that is easy to read and less prone to bugs.&lt;/p&gt;

&lt;p&gt;The bootcamp has helped section off the C# language, allowing me to more easily set goals and tasks to focus my learning on these areas after the bootcamp has finished. &lt;/p&gt;

&lt;p&gt;These bootcamps can be targeted to any skill level and be run over a set period of time that works for you and your team. &lt;/p&gt;

&lt;p&gt;If you have any questions or comments, I would love to hear from you. See my ‘About’ page for my contact details, or feel free to leave a comment below.&lt;/p&gt;

</description>
      <category>development</category>
      <category>beginners</category>
      <category>learning</category>
      <category>coding</category>
    </item>
    <item>
      <title>Transitioning from QA to Development</title>
      <dc:creator>Daniel Donbavand</dc:creator>
      <pubDate>Sat, 22 Jul 2017 23:07:04 +0000</pubDate>
      <link>https://dev.to/donbavand/transitioning-from-qa-to-development</link>
      <guid>https://dev.to/donbavand/transitioning-from-qa-to-development</guid>
      <description>&lt;h2&gt;
  
  
  Introduction:
&lt;/h2&gt;

&lt;p&gt;Last year, I made the move from &lt;a href="https://danieldonbavand.com/qatodevelopment/" rel="noopener noreferrer"&gt;QA to Development&lt;/a&gt;. I had been a QA for a number of years and due to a number of reasons, I felt like I needed a change.&lt;/p&gt;

&lt;p&gt;While I knew the change was going to require dedication and effort, I didn’t quite realise how hard it was going to be.&lt;/p&gt;

&lt;p&gt;I made a few mistakes in my transition. This post goes over those mistakes and then looks how I rectified them. I want to highlight my pitfalls to hopefully help anyone else thinking about changing roles, so they don’t have to make the same mistakes I made.&lt;/p&gt;

&lt;h2&gt;
  
  
  My technical dev skills before moving into Development.
&lt;/h2&gt;

&lt;p&gt;I was fairly confident with my skill level before moving into development. I knew I had a lot to learn, but I didn’t think twice about my ability to pick those skills up.&lt;/p&gt;

&lt;p&gt;I have a BCA majoring in Information Systems and E-commerce. Due to work commitments I wasn’t able to dedicate enough time towards a Computer Science degree, so I decided that the next best thing was a Bachelor of Commerce and Administration, where I was able to take a few programming and database papers to gain a certain level of coding knowledge.&lt;/p&gt;

&lt;p&gt;I was heavily involved in UI automation at Xero. I was able to design solutions that would test big applications. This is where I picked up most of my coding knowledge.&lt;/p&gt;

&lt;p&gt;The number one resource I used to upskill was Pluralsight. This is a fantastic resource for anyone at any level looking to upskill in any programing language. Pluralsight offers courses in many different programing languages for beginners to advanced, I use Pluralsight a lot to upskill. If you are interested in learning more about UI Automation I wrote a blog on &lt;a href="https://danieldonbavand.com/testing-279/" rel="noopener noreferrer"&gt;Getting Started with UI Test Automation&lt;/a&gt; on my testing blog site.Â &lt;/p&gt;

&lt;p&gt;While I had some knowledge in coding activities, it was heavily focused around test automation. At the time I thought these skills were enough to easily transition into a development role.&lt;/p&gt;

&lt;h2&gt;
  
  
  Developer Bootcamp
&lt;/h2&gt;

&lt;p&gt;The first bit of training that I was involved in when making the move was a training bootcamp designed and lead by my team lead.&lt;/p&gt;

&lt;p&gt;Just like an exercise boot camp, this was a 2 month intense focused training camp, the C# language was split into sections, we would spend 5 to 6 hours a day, 4 days a week and go through exercises, articles, watch videos and have discussions, around the C# section for that week. We would dedicate time by ourselves outside of this to also do some extra reading and watch videos on the subject.&lt;/p&gt;

&lt;p&gt;The boot camp was a good introduction into the different C# concepts and principles, however going through this boot camp I started to realise how little previous skills in development I actually had.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Struggle
&lt;/h2&gt;

&lt;p&gt;The bootcamp had finished and a few months had passed, reality started to set in for me. I wasn’t picking up the skills needed to be a successful developer. While I was improving, I was still struggling to understand some of the more basic concepts.&lt;/p&gt;

&lt;p&gt;I had discussions with my team lead, was development something I still wanted to pursue, or would I prefer to move back into a QA role.&lt;/p&gt;

&lt;p&gt;I hate failure and I was feeling like a bit of a failure at this point. Â &lt;/p&gt;

&lt;p&gt;I needed to take a step back and work out why I wasn’t picking things up as fast as I should be.&lt;/p&gt;

&lt;p&gt;GOALS….. Or lack of. After taking the step back and looking at how I had succeeded in the past, I realised I hadn’t set any clear goals for myself. I was turning up to work each day and hoping to improve, while I was improving slightly, it wasn’t at the rate I wanted or needed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Writing down your goals and tasks
&lt;/h2&gt;

&lt;p&gt;I found and started using an application that allowed me to write down my goals, then split those goals into actionable tasks. Trello is a tool we use at work and fit my purpose perfectly.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmbe20cq6fmuypk3ohkq8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmbe20cq6fmuypk3ohkq8.png" alt="alt" width="800" height="224"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I would add tasks into my “ToDo” column, these would include chapters of development books that I wanted to read, side project tasks, coding exercises that I wanted to complete, pluralsight courses that I wanted to watch.&lt;/p&gt;

&lt;p&gt;As I started working on and completing each task, I would move them from left to right across my board to the â€˜Done’ column&lt;/p&gt;

&lt;p&gt;My trello board also included a column labeled documentation - blog, I want to start documenting and blogging about my development journey. I would add blog post ideas into this column.&lt;/p&gt;

&lt;p&gt;I have an ideas column. I was finding that I would have these good ideas during the day, these might come to me while chatting with work colleagues or while reading twitter, if I waited and wrote them down at the end of the day, I would often struggle to remember a certain level of detail about the idea. Having a place to write these down, allows me to quickly write the main concepts and points of the the idea and remember them.&lt;/p&gt;

&lt;p&gt;Using a board such as a Trello board has another big advantage and that is the ability for collaboration and the ability to share tasks and ideas with a mentor.&lt;/p&gt;

&lt;h2&gt;
  
  
  Finding a Mentor
&lt;/h2&gt;

&lt;p&gt;Finding and having a mentor is going to really help when moving into another role such as development.&lt;/p&gt;

&lt;p&gt;No matter what programming language you pick, it’s going to look big and scary, it’s important that you break it down into manageable sections. This can be hard for any junior developer to do on their own. This is where a mentor can help, they can work with you to break down the language into smaller chunks, they can help you focus on areas that are more important to understand first.&lt;/p&gt;

&lt;p&gt;When finding a mentor there are a few important points that you need to think about&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Someone you can trust&lt;/li&gt;
&lt;li&gt;Someone willing to give up time to help you improve&lt;/li&gt;
&lt;li&gt;Someone you feel comfortable asking questions to.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Someone that you can trust goes without saying, if you can’t trust the person, then they should not be your mentor.&lt;/p&gt;

&lt;p&gt;You need to make sure that the person who is going to be your mentor understands the time commitments. Being a mentor requires a lot of time and effort, if someone isn’t prepared to give up that time, then it isn’t going to work. So having those discussions up front at the beginning will really help.&lt;/p&gt;

&lt;p&gt;There are some people that I find more comfortable asking questions to than others, when finding a mentor, it’s important you have someone that you feel comfortable asking any questions to.&lt;/p&gt;

&lt;h2&gt;
  
  
  Finding a Side Project
&lt;/h2&gt;

&lt;p&gt;One of the biggest things that help improve my skill level was finding a side project. This advice came from my team lead and while I didn’t pick one up straight away, as soon as I did I saw my skill level rise rapidly.&lt;/p&gt;

&lt;p&gt;Before starting off on a main project, I started off on a few smaller side projects, such as creating a simple .NET core console app, interact with DynamoDB (AWS) work with and interact with 3rd party APIs.&lt;/p&gt;

&lt;p&gt;After working on a few smaller side projects, I started on my main side project. The side project that I am currently working on is a Slack Chat App bot. We have a betting syndicate, where two people will bet each week and if the win is greater than what they spent and beats the other person's result, then they get to bet again, otherwise they go to the bottom of the betting list. I created a bot that will tell us, who is betting, who is betting next, store and show a leader board and a number of other things. As I have learnt different coding techniques and design patterns, I am able to implement these into my side project, where it can be sometimes hard to implement these type of changes into apps running in production, at least with a side project the only people I am annoying, if it breaks, are my fellow betters.&lt;/p&gt;

&lt;h2&gt;
  
  
  Extra Learning Advice
&lt;/h2&gt;

&lt;p&gt;Development Books: While I learn more by doing, I still read development books, to supplement working on my side projects and give me inspiration and ideas. A few good books I have read recently are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Code Complete&lt;/li&gt;
&lt;li&gt;Clean Code&lt;/li&gt;
&lt;li&gt;C# in depth&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Pluralsight: This is such a fantastic resource for anyone at any level looking to upskill in any programing language. Pluralsight offers courses in many different programing languages for beginners to advance, I use Pluralsight a lot to upskill. Â &lt;/p&gt;

&lt;p&gt;Coding Exercises: There are many different sites around, that allow you to work on coding exercises online. The site I’m currently using is Code Wars, you are given an exercise to complete with a bunch of failing tests, the goal is to make all the tests pass. I find working through these helps train your mind look and then solve different problems. Skill level ranges from beginner to advance, so there is something for everyone.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary:
&lt;/h2&gt;

&lt;p&gt;If you are thinking about changing roles, then one of the key pieces of advice is to prepare ahead of time, work out areas and tasks that you can work on before actually making the role change to try and make it easier for the first few months in your transition.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>development</category>
      <category>career</category>
    </item>
  </channel>
</rss>
