<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Kodebot</title>
		<link>https://kodebot.com/</link>
		<description>Recent content on Kodebot</description>
		<generator>Hugo</generator>
		<language>en-GB</language>
		
		
		
		
			<lastBuildDate>Wed, 03 Feb 2021 13:55:27 +0000</lastBuildDate>
		
			<atom:link href="https://kodebot.com/feed.xml" rel="self" type="application/rss+xml" />
			<item>
				<title>What is SOLID principles?</title>
				<link>https://kodebot.com/tutorials/solid-principles/1-introduction/</link>
				<pubDate>Wed, 18 Sep 2019 00:00:00 +0000</pubDate>
				<guid>https://kodebot.com/tutorials/solid-principles/1-introduction/</guid>
				<description>&lt;hr&gt;&#xA;&lt;p&gt;&lt;a class=&#34;button button-youtube&#34; href=&#34;https://youtu.be/StT2I0mwjus?t=33&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;svg class=&#34;icon&#34; viewBox=&#34;0 0 24 24&#34; width=&#34;18&#34; height=&#34;18&#34; fill=&#34;currentColor&#34; aria-hidden=&#34;true&#34;&gt;&lt;path d=&#34;M23.5 6.2a3 3 0 0 0-2.1-2.1C19.5 3.6 12 3.6 12 3.6s-7.5 0-9.4.5A3 3 0 0 0 .5 6.2 31.4 31.4 0 0 0 0 12a31.4 31.4 0 0 0 .5 5.8 3 3 0 0 0 2.1 2.1c1.9.5 9.4.5 9.4.5s7.5 0 9.4-.5a3 3 0 0 0 2.1-2.1A31.4 31.4 0 0 0 24 12a31.4 31.4 0 0 0-.5-5.8zM9.6 15.6V8.4l6.3 3.6-6.3 3.6z&#34;/&gt;&lt;/svg&gt;&lt;span&gt;Watch video&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr&gt;&#xA;&lt;p&gt;SOLID is mnemonic acronym where each letter represents one principle.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Result verification</title>
				<link>https://kodebot.com/tutorials/automated-unit-testing-basics/4-verification-techniques/1-result-verification/</link>
				<pubDate>Fri, 22 Feb 2019 10:25:49 +0000</pubDate>
				<guid>https://kodebot.com/tutorials/automated-unit-testing-basics/4-verification-techniques/1-result-verification/</guid>
				<description>&lt;p&gt;We use result verification technique when the test receives the result by running SUT.&lt;/p&gt;&#xA;&lt;p&gt;Consider an example of testing a function that adds two numbers and returns the result&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;function add(a, b):&#xA;    return a+b&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;we verify the correctness of this function by simply checking the result returned by add function&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;function test_add():&#xA;    // arrange&#xA;    a = 10&#xA;    b = 15&#xA;&#xA;    // act&#xA;    result = add(a, b)&#xA;&#xA;    // assert&#xA;    areEqual(25, result) // 25 is expected&#xA;&lt;/code&gt;&lt;/pre&gt;</description>
			</item>
			<item>
				<title>Simple test data</title>
				<link>https://kodebot.com/tutorials/automated-unit-testing-basics/3-setup-techniques/1-simple-test-data/</link>
				<pubDate>Fri, 22 Feb 2019 10:25:49 +0000</pubDate>
				<guid>https://kodebot.com/tutorials/automated-unit-testing-basics/3-setup-techniques/1-simple-test-data/</guid>
				<description>&lt;p&gt;When we need data, we just create variables with the data and use them in the other places within the unit test.&lt;/p&gt;&#xA;&lt;p&gt;consider an example of testing a function that adds two numbers&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;function add(a, b):&#xA;    return a+b&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;to test this function, we need two input data.&#xA;We can simply create two variables with the data in our test function and use them as arguments for &lt;code&gt;add()&lt;/code&gt; function.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;function test_add():&#xA;    // arrange&#xA;    a = 10&#xA;    b = 15&#xA;&#xA;    // act&#xA;    add(a, b)&#xA;&lt;/code&gt;&lt;/pre&gt;</description>
			</item>
			<item>
				<title>Structure</title>
				<link>https://kodebot.com/tutorials/automated-unit-testing-basics/2-structure-of-unit-test/1-structure/</link>
				<pubDate>Fri, 22 Feb 2019 10:25:49 +0000</pubDate>
				<guid>https://kodebot.com/tutorials/automated-unit-testing-basics/2-structure-of-unit-test/1-structure/</guid>
				<description>&lt;p&gt;Any unit test will have two or more of the following steps&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Setup&lt;/li&gt;&#xA;&lt;li&gt;Run SUT&lt;/li&gt;&#xA;&lt;li&gt;Verification&lt;/li&gt;&#xA;&lt;li&gt;Cleanup&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h2 id=&#34;setup&#34;&gt;Setup&lt;/h2&gt;&#xA;&lt;p&gt;One of the first step in writing unit test is &lt;strong&gt;Setup&lt;/strong&gt;. In this step, we prepare test data, dependencies and/or the context for the test.&lt;/p&gt;&#xA;&lt;p&gt;For example, we will replace any real dependencies with fake ones and define set of good test data as part of this step.&lt;/p&gt;&#xA;&lt;p&gt;However, this step is not necessary for all the tests.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Test driven development</title>
				<link>https://kodebot.com/tutorials/automated-unit-testing-basics/5-test-driven-or-test-oriented/1-test-driven-development/</link>
				<pubDate>Fri, 22 Feb 2019 10:25:49 +0000</pubDate>
				<guid>https://kodebot.com/tutorials/automated-unit-testing-basics/5-test-driven-or-test-oriented/1-test-driven-development/</guid>
				<description>&lt;p&gt;Test driven development (TDD) is a popular approach for writing unit tests.&lt;/p&gt;&#xA;&lt;p&gt;With this approach, we write a test first, see it fail, then write production code to make the test pass.&lt;/p&gt;&#xA;&lt;p&gt;Typically, we repeat the steps below in that order&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;take a small requirement&lt;/li&gt;&#xA;&lt;li&gt;write failing test for the requirement&lt;/li&gt;&#xA;&lt;li&gt;write production code to make test pass&lt;/li&gt;&#xA;&lt;li&gt;refactor&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;figure&gt;&#xA;&lt;img src=&#34;https://kodebot.com/tutorials/automated-unit-testing-basics/5-test-driven-or-test-oriented/1-test-driven-development/images/TDD.png&#34; alt=&#34;&#34; height=&#34;300&#34; loading=&#34;lazy&#34;&gt;&#xA;&lt;/figure&gt;&#xA;&lt;p&gt;It is claimed that TDD helps to write code that simple, flexible and just enough to satisfy the requirement.&lt;/p&gt;</description>
			</item>
			<item>
				<title>What is automated unit testing?</title>
				<link>https://kodebot.com/tutorials/automated-unit-testing-basics/1-introduction/1-what-is-automated-unit-testing/</link>
				<pubDate>Fri, 22 Feb 2019 10:25:49 +0000</pubDate>
				<guid>https://kodebot.com/tutorials/automated-unit-testing-basics/1-introduction/1-what-is-automated-unit-testing/</guid>
				<description>&lt;p&gt;Let&amp;rsquo;s first understand what we call as &lt;strong&gt;Unit&lt;/strong&gt;. The term unit is very subjective, so it means different things to different people. In the context of testing, I like to think of unit as one or more lines of code that does something small but tangible to move towards achieving the end goal of the program.&lt;/p&gt;&#xA;&lt;p&gt;What do I mean by this? Well, lets look at an example of a very simple calculator program. In order to build a calculator, we need to build individual operations that are supported by the calculator. Each simple operations like addition, subtraction, multiplication and division are implemented using few lines of code and these operations are units as these are small but tangible steps needed to build a calculator.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Single Responsibility Principle</title>
				<link>https://kodebot.com/tutorials/solid-principles/2-single-responsibility-principle/</link>
				<pubDate>Wed, 18 Sep 2019 00:00:00 +0000</pubDate>
				<guid>https://kodebot.com/tutorials/solid-principles/2-single-responsibility-principle/</guid>
				<description>&lt;hr&gt;&#xA;&lt;p&gt;&lt;a class=&#34;button button-youtube&#34; href=&#34;https://youtu.be/StT2I0mwjus?t=89&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;svg class=&#34;icon&#34; viewBox=&#34;0 0 24 24&#34; width=&#34;18&#34; height=&#34;18&#34; fill=&#34;currentColor&#34; aria-hidden=&#34;true&#34;&gt;&lt;path d=&#34;M23.5 6.2a3 3 0 0 0-2.1-2.1C19.5 3.6 12 3.6 12 3.6s-7.5 0-9.4.5A3 3 0 0 0 .5 6.2 31.4 31.4 0 0 0 0 12a31.4 31.4 0 0 0 .5 5.8 3 3 0 0 0 2.1 2.1c1.9.5 9.4.5 9.4.5s7.5 0 9.4-.5a3 3 0 0 0 2.1-2.1A31.4 31.4 0 0 0 24 12a31.4 31.4 0 0 0-.5-5.8zM9.6 15.6V8.4l6.3 3.6-6.3 3.6z&#34;/&gt;&lt;/svg&gt;&lt;span&gt;Watch video&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr&gt;&#xA;&lt;p&gt;Single Responsibility Principle (SRP) is about how we separate or modularise code in object oriented design. This principle says that&lt;/p&gt;</description>
			</item>
			<item>
				<title>Data driven test</title>
				<link>https://kodebot.com/tutorials/automated-unit-testing-basics/3-setup-techniques/2-data-driven-test/</link>
				<pubDate>Fri, 22 Feb 2019 10:25:49 +0000</pubDate>
				<guid>https://kodebot.com/tutorials/automated-unit-testing-basics/3-setup-techniques/2-data-driven-test/</guid>
				<description>&lt;p&gt;When we want to test SUT, we usually want to test with different set of data. It is not ideal to create one test function for one set of input data.&#xA;This is where data driven tests are helpful.&lt;/p&gt;&#xA;&lt;p&gt;Consider the same example function that adds two numbers&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;function add(a, b):&#xA;    return a+b&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To be thorough, we need to test this function with few different set of data including but not limited to negative numbers, positive numbers and zeros.&lt;/p&gt;</description>
			</item>
			<item>
				<title>State verification</title>
				<link>https://kodebot.com/tutorials/automated-unit-testing-basics/4-verification-techniques/2-state-verification/</link>
				<pubDate>Fri, 22 Feb 2019 10:25:49 +0000</pubDate>
				<guid>https://kodebot.com/tutorials/automated-unit-testing-basics/4-verification-techniques/2-state-verification/</guid>
				<description>&lt;p&gt;State verification is similar to result verification but rather than checking the result of SUT, we check the state of an object or something similar.&lt;/p&gt;&#xA;&lt;p&gt;Consider an example of testing a function that closes the database connection&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;module databaseManager&#xA;&#xA;isOpen&#xA;&#xA;function close():&#xA;    isOpen = false&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;When we call this function, it is not going to return anything, instead it is going to change the state of &lt;code&gt;isOpen&lt;/code&gt; field&lt;/p&gt;&#xA;&lt;p&gt;So we need to verify the state of &lt;code&gt;isOpen&lt;/code&gt; field to ensure the correctness of &lt;code&gt;close&lt;/code&gt; function&lt;/p&gt;</description>
			</item>
			<item>
				<title>Test oriented development</title>
				<link>https://kodebot.com/tutorials/automated-unit-testing-basics/5-test-driven-or-test-oriented/2-test-oriented-development/</link>
				<pubDate>Fri, 22 Feb 2019 10:25:49 +0000</pubDate>
				<guid>https://kodebot.com/tutorials/automated-unit-testing-basics/5-test-driven-or-test-oriented/2-test-oriented-development/</guid>
				<description>&lt;p&gt;Test oriented development is another approach where it is not important to write tests first but it is important to write test while writing production code.&lt;/p&gt;&#xA;&lt;p&gt;Typically, we repeat the steps below in that order&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;take a small requirement&lt;/li&gt;&#xA;&lt;li&gt;write production code&lt;/li&gt;&#xA;&lt;li&gt;write unit tests&lt;/li&gt;&#xA;&lt;li&gt;refactor&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;figure&gt;&#xA;&lt;img src=&#34;https://kodebot.com/tutorials/automated-unit-testing-basics/5-test-driven-or-test-oriented/2-test-oriented-development/images/TOD.png&#34; alt=&#34;&#34; height=&#34;300&#34; loading=&#34;lazy&#34;&gt;&#xA;&lt;/figure&gt;</description>
			</item>
			<item>
				<title>Why are we writing unit tests?</title>
				<link>https://kodebot.com/tutorials/automated-unit-testing-basics/1-introduction/2-why-are-we-writing-unit-tests/</link>
				<pubDate>Fri, 22 Feb 2019 10:25:49 +0000</pubDate>
				<guid>https://kodebot.com/tutorials/automated-unit-testing-basics/1-introduction/2-why-are-we-writing-unit-tests/</guid>
				<description>&lt;p&gt;We can find many reasons for writing unit tests, there are three reasons that stands out in my opinion&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Verify the correctness of the code&lt;/li&gt;&#xA;&lt;li&gt;Provide safety-net when we want to change the code (feedback mechanism)&lt;/li&gt;&#xA;&lt;li&gt;Serve as a documentation of the code&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;verify-the-correctness-of-the-code&#34;&gt;Verify the correctness of the code&lt;/h2&gt;&#xA;&lt;p&gt;I don&amp;rsquo;t think any good developer will just write code and say the work is done. They will test it, either via manual steps or by writing automated unit tests, to verify whether the implementation is correct or not.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Open-Closed Principle</title>
				<link>https://kodebot.com/tutorials/solid-principles/3-open-closed-principle/</link>
				<pubDate>Wed, 18 Sep 2019 00:00:00 +0000</pubDate>
				<guid>https://kodebot.com/tutorials/solid-principles/3-open-closed-principle/</guid>
				<description>&lt;hr&gt;&#xA;&lt;p&gt;&lt;a class=&#34;button button-youtube&#34; href=&#34;https://youtu.be/StT2I0mwjus?t=368&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;svg class=&#34;icon&#34; viewBox=&#34;0 0 24 24&#34; width=&#34;18&#34; height=&#34;18&#34; fill=&#34;currentColor&#34; aria-hidden=&#34;true&#34;&gt;&lt;path d=&#34;M23.5 6.2a3 3 0 0 0-2.1-2.1C19.5 3.6 12 3.6 12 3.6s-7.5 0-9.4.5A3 3 0 0 0 .5 6.2 31.4 31.4 0 0 0 0 12a31.4 31.4 0 0 0 .5 5.8 3 3 0 0 0 2.1 2.1c1.9.5 9.4.5 9.4.5s7.5 0 9.4-.5a3 3 0 0 0 2.1-2.1A31.4 31.4 0 0 0 24 12a31.4 31.4 0 0 0-.5-5.8zM9.6 15.6V8.4l6.3 3.6-6.3 3.6z&#34;/&gt;&lt;/svg&gt;&lt;span&gt;Watch video&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr&gt;&#xA;&lt;p&gt;Open-Closed Principle(OCP) says software must be open for extension but closed for modification. When we first hear this, it might sound like oxymoron but it is not when we understand this principle correctly.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Fake test dependency</title>
				<link>https://kodebot.com/tutorials/automated-unit-testing-basics/3-setup-techniques/3-fake-test-depencency/</link>
				<pubDate>Fri, 22 Feb 2019 10:25:49 +0000</pubDate>
				<guid>https://kodebot.com/tutorials/automated-unit-testing-basics/3-setup-techniques/3-fake-test-depencency/</guid>
				<description>&lt;p&gt;It is very common that the SUT depends on something else. The dependency could be anything like another function, object or external system and we may not be able to control their behavior all the time. A good unit test should not be affected by the changes in the dependencies of SUT.&lt;/p&gt;&#xA;&lt;p&gt;So, a common technique is to replace the dependencies with fake versions that we can control.&lt;/p&gt;&#xA;&lt;figure&gt;&#xA;&lt;img src=&#34;https://kodebot.com/tutorials/automated-unit-testing-basics/3-setup-techniques/3-fake-test-depencency/images/fake-dependency.png&#34; alt=&#34;&#34; height=&#34;350&#34; loading=&#34;lazy&#34;&gt;&#xA;&lt;/figure&gt;&#xA;&lt;p&gt;For example, consider a function that takes age of the passenger and prints whether he/she is eligible for senior citizen discount when promotion is available.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Interaction verification</title>
				<link>https://kodebot.com/tutorials/automated-unit-testing-basics/4-verification-techniques/3-interaction-verification/</link>
				<pubDate>Fri, 22 Feb 2019 10:25:49 +0000</pubDate>
				<guid>https://kodebot.com/tutorials/automated-unit-testing-basics/4-verification-techniques/3-interaction-verification/</guid>
				<description>&lt;p&gt;Interaction verification is completely different from result and state verification. With this technique, we will be checking whether an interaction under a specific condition has happened or not.&lt;/p&gt;&#xA;&lt;p&gt;Consider the example below, the &lt;code&gt;databaseManager&lt;/code&gt; module offers a function to close database, but it neither returns any result nor changes the state. All this function does is that it calls a function in &lt;code&gt;database&lt;/code&gt; module.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;module databaseManager&#xA;&#xA;function close():&#xA;    database.close()&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;So, the only thing we can do to verify the correctness of this function is to check whether it calls &lt;code&gt;close()&lt;/code&gt; function in &lt;code&gt;database&lt;/code&gt; module or not&lt;/p&gt;</description>
			</item>
			<item>
				<title>What is good unit test?</title>
				<link>https://kodebot.com/tutorials/automated-unit-testing-basics/1-introduction/3-what-is-good-unit-test/</link>
				<pubDate>Fri, 22 Feb 2019 10:25:49 +0000</pubDate>
				<guid>https://kodebot.com/tutorials/automated-unit-testing-basics/1-introduction/3-what-is-good-unit-test/</guid>
				<description>&lt;p&gt;When writing tests for any block of code, it must be comprehensive and cover all the scenarios. If we write tests for most obvious scenarios and don&amp;rsquo;t cover the less common scenarios then we don&amp;rsquo;t know how it is going to behave on those untested scenarios.&lt;/p&gt;&#xA;&lt;p&gt;Each test we write should have the following qualities&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Quick to run&lt;/li&gt;&#xA;&lt;li&gt;Repeatable&lt;/li&gt;&#xA;&lt;li&gt;Focused&lt;/li&gt;&#xA;&lt;li&gt;Isolated&lt;/li&gt;&#xA;&lt;li&gt;Self validating&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;quick-to-run&#34;&gt;Quick to run&lt;/h2&gt;&#xA;&lt;p&gt;When running unit test, we don&amp;rsquo;t want to wait long. Because each of the tests we write target only few lines of the code, we could easily end up with hundreds, if not thousands, of tests even for a small program/application. Our tests must be extremely fast to get the feedback quickly. So we should try to avoid anything that will slow down our tests. When this is not possible, we should at least be able to keep the slow running tests separate and run them independently without affecting fast running tests.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Liskov Substitution Principle</title>
				<link>https://kodebot.com/tutorials/solid-principles/4-liskov-substitution-principle/</link>
				<pubDate>Wed, 18 Sep 2019 00:00:00 +0000</pubDate>
				<guid>https://kodebot.com/tutorials/solid-principles/4-liskov-substitution-principle/</guid>
				<description>&lt;hr&gt;&#xA;&lt;p&gt;&lt;a class=&#34;button button-youtube&#34; href=&#34;https://youtu.be/StT2I0mwjus?t=731&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;svg class=&#34;icon&#34; viewBox=&#34;0 0 24 24&#34; width=&#34;18&#34; height=&#34;18&#34; fill=&#34;currentColor&#34; aria-hidden=&#34;true&#34;&gt;&lt;path d=&#34;M23.5 6.2a3 3 0 0 0-2.1-2.1C19.5 3.6 12 3.6 12 3.6s-7.5 0-9.4.5A3 3 0 0 0 .5 6.2 31.4 31.4 0 0 0 0 12a31.4 31.4 0 0 0 .5 5.8 3 3 0 0 0 2.1 2.1c1.9.5 9.4.5 9.4.5s7.5 0 9.4-.5a3 3 0 0 0 2.1-2.1A31.4 31.4 0 0 0 24 12a31.4 31.4 0 0 0-.5-5.8zM9.6 15.6V8.4l6.3 3.6-6.3 3.6z&#34;/&gt;&lt;/svg&gt;&lt;span&gt;Watch video&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr&gt;&#xA;&lt;p&gt;Liskov Substitution Principle(LSP) is about substitution of one object for another without affecting the program that uses those objects.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Mock dependency</title>
				<link>https://kodebot.com/tutorials/automated-unit-testing-basics/3-setup-techniques/4-mock-dependency/</link>
				<pubDate>Fri, 22 Feb 2019 10:25:49 +0000</pubDate>
				<guid>https://kodebot.com/tutorials/automated-unit-testing-basics/3-setup-techniques/4-mock-dependency/</guid>
				<description>&lt;p&gt;While fake dependencies are really useful for unit testing, they lack in features like tracking function calls, intercepting arguments, etc.. that makes unit testing easier.&#xA;Mock dependency is a dependency which offers all the benefits of fake dependencies and more features to make unit testing easier.&lt;/p&gt;&#xA;&lt;p&gt;It is not going to be easy to create and maintain mock dependencies; this is why we generally use mocking libraries to create mock dependencies.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Other types of automated testing</title>
				<link>https://kodebot.com/tutorials/automated-unit-testing-basics/1-introduction/4-other-types-of-automated-testing/</link>
				<pubDate>Fri, 22 Feb 2019 10:25:49 +0000</pubDate>
				<guid>https://kodebot.com/tutorials/automated-unit-testing-basics/1-introduction/4-other-types-of-automated-testing/</guid>
				<description>&lt;p&gt;While unit test targets small piece of code, we have other types of test that generally focus at higher level than unit tests. Two examples of such types of test we have are&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Integration tests&lt;/li&gt;&#xA;&lt;li&gt;End to end tests&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Generally, unit tests focus on small piece of code without considering the behavior of dependencies they have (usually with the help of fake dependencies). This means we will be able to verify whether the target code works on it own or not, but we will not know whether it is going to work correctly as a part of bigger program. While this is the correct approach for unit tests, it doesn&amp;rsquo;t cover verifying the behavior with real dependencies. Integration and End to end tests falls under this category where SUT will be tested with real dependencies.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Interface Segregation Principle</title>
				<link>https://kodebot.com/tutorials/solid-principles/5-interface-segregation-principle/</link>
				<pubDate>Wed, 18 Sep 2019 00:00:00 +0000</pubDate>
				<guid>https://kodebot.com/tutorials/solid-principles/5-interface-segregation-principle/</guid>
				<description>&lt;hr&gt;&#xA;&lt;p&gt;&lt;a class=&#34;button button-youtube&#34; href=&#34;https://youtu.be/StT2I0mwjus?t=1046&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;svg class=&#34;icon&#34; viewBox=&#34;0 0 24 24&#34; width=&#34;18&#34; height=&#34;18&#34; fill=&#34;currentColor&#34; aria-hidden=&#34;true&#34;&gt;&lt;path d=&#34;M23.5 6.2a3 3 0 0 0-2.1-2.1C19.5 3.6 12 3.6 12 3.6s-7.5 0-9.4.5A3 3 0 0 0 .5 6.2 31.4 31.4 0 0 0 0 12a31.4 31.4 0 0 0 .5 5.8 3 3 0 0 0 2.1 2.1c1.9.5 9.4.5 9.4.5s7.5 0 9.4-.5a3 3 0 0 0 2.1-2.1A31.4 31.4 0 0 0 24 12a31.4 31.4 0 0 0-.5-5.8zM9.6 15.6V8.4l6.3 3.6-6.3 3.6z&#34;/&gt;&lt;/svg&gt;&lt;span&gt;Watch video&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr&gt;&#xA;&lt;p&gt;Interface Segregation Principle(ISP) was introduced by &lt;a href=&#34;https://en.wikipedia.org/wiki/Robert_C._Martin&#34;&gt;Robert C. Martin&lt;/a&gt;. He says&lt;/p&gt;</description>
			</item>
			<item>
				<title>Dependency Inversion Principle</title>
				<link>https://kodebot.com/tutorials/solid-principles/6-dependency-inversion-principle/</link>
				<pubDate>Wed, 18 Sep 2019 00:00:00 +0000</pubDate>
				<guid>https://kodebot.com/tutorials/solid-principles/6-dependency-inversion-principle/</guid>
				<description>&lt;hr&gt;&#xA;&lt;p&gt;&lt;a class=&#34;button button-youtube&#34; href=&#34;https://youtu.be/StT2I0mwjus?t=1243&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;svg class=&#34;icon&#34; viewBox=&#34;0 0 24 24&#34; width=&#34;18&#34; height=&#34;18&#34; fill=&#34;currentColor&#34; aria-hidden=&#34;true&#34;&gt;&lt;path d=&#34;M23.5 6.2a3 3 0 0 0-2.1-2.1C19.5 3.6 12 3.6 12 3.6s-7.5 0-9.4.5A3 3 0 0 0 .5 6.2 31.4 31.4 0 0 0 0 12a31.4 31.4 0 0 0 .5 5.8 3 3 0 0 0 2.1 2.1c1.9.5 9.4.5 9.4.5s7.5 0 9.4-.5a3 3 0 0 0 2.1-2.1A31.4 31.4 0 0 0 24 12a31.4 31.4 0 0 0-.5-5.8zM9.6 15.6V8.4l6.3 3.6-6.3 3.6z&#34;/&gt;&lt;/svg&gt;&lt;span&gt;Watch video&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;hr&gt;&#xA;&lt;p&gt;Dependency Inversion Principle(DIP) is introduced by &lt;a href=&#34;https://en.wikipedia.org/wiki/Robert_C._Martin&#34;&gt;Robert C. Martin&lt;/a&gt; and his definition is&lt;/p&gt;</description>
			</item>
			<item>
				<title>System Under Test (SUT)</title>
				<link>https://kodebot.com/tutorials/automated-unit-testing-basics/1-introduction/5-system-under-test/</link>
				<pubDate>Fri, 22 Feb 2019 10:25:49 +0000</pubDate>
				<guid>https://kodebot.com/tutorials/automated-unit-testing-basics/1-introduction/5-system-under-test/</guid>
				<description>&lt;p&gt;The implementation of System Under Test (SUT) that are the target of our unit test can be one of the following&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;direct implementation&lt;/li&gt;&#xA;&lt;li&gt;indirect implementation&lt;/li&gt;&#xA;&lt;li&gt;combination of the above&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h2 id=&#34;direct-implementation&#34;&gt;Direct implementation&lt;/h2&gt;&#xA;&lt;p&gt;If a function or piece of code is direct implementation, then it will take zero or more inputs and provide some results or cause state change with very little or no dependencies.&lt;/p&gt;&#xA;&lt;p&gt;Examples of direct implementation&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Functions that implement individual operations of a calculator program like addition, subtraction, etc&amp;hellip;&lt;/li&gt;&#xA;&lt;li&gt;Function that creates new student object&lt;/li&gt;&#xA;&lt;li&gt;Function that validates bank account number&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;indirect-implementation&#34;&gt;Indirect implementation&lt;/h2&gt;&#xA;&lt;p&gt;Normally a function or piece of code falls under this type when it gets something done via one or more of its dependencies rather than doing it on its own.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Join and GroupJoin in C#</title>
				<link>https://kodebot.com/blog/2021/join-and-groupjoin-in-dotnet/</link>
				<pubDate>Wed, 03 Feb 2021 13:55:27 +0000</pubDate>
				<guid>https://kodebot.com/blog/2021/join-and-groupjoin-in-dotnet/</guid>
				<description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;&lt;code&gt;Join&lt;/code&gt; and &lt;code&gt;GroupJoin&lt;/code&gt; are two different methods that we can use in our LINQ query to join two different collections. At first glance, they might look similar but they produce different results. Lets look at how they work with an example.&lt;/p&gt;&#xA;&lt;h3 id=&#34;example-setup&#34;&gt;Example setup&lt;/h3&gt;&#xA;&lt;p&gt;For our example, we are going to use the following &lt;code&gt;Student&lt;/code&gt; and &lt;code&gt;Enrolment&lt;/code&gt; class.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-csharp&#34; data-lang=&#34;csharp&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;class&lt;/span&gt; &lt;span class=&#34;nc&#34;&gt;Student&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;kd&#34;&gt;public&lt;/span&gt; &lt;span class=&#34;kt&#34;&gt;string&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;Id&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;get&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;set&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;kd&#34;&gt;public&lt;/span&gt; &lt;span class=&#34;kt&#34;&gt;string&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;Name&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;get&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;set&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;class&lt;/span&gt; &lt;span class=&#34;nc&#34;&gt;Enrolment&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;kd&#34;&gt;public&lt;/span&gt; &lt;span class=&#34;kt&#34;&gt;string&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;Id&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;get&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;set&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;kd&#34;&gt;public&lt;/span&gt; &lt;span class=&#34;kt&#34;&gt;string&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;StudentId&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;get&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;set&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And we assume, we have the following data&lt;/p&gt;</description>
			</item>
			<item>
				<title>tmux One Minute Guide</title>
				<link>https://kodebot.com/blog/2021/tmux-one-minute-guide/</link>
				<pubDate>Thu, 28 Jan 2021 10:19:39 +0000</pubDate>
				<guid>https://kodebot.com/blog/2021/tmux-one-minute-guide/</guid>
				<description>&lt;h3 id=&#34;what-is-tmux&#34;&gt;What is tmux?&lt;/h3&gt;&#xA;&lt;p&gt;&lt;code&gt;tmux&lt;/code&gt; is terminal multiplexer that allows your terminal to be split into different sessions, windows and panes. One of the great thing about &lt;code&gt;tmux&lt;/code&gt; is that, you can detach from and reattach to, tmux sessions without terminating the programs running in those sessions.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Session&lt;/strong&gt; - is a wrapper for your windows and panes that you can create, detach from and reattach to without terminating the programs running in the sessions&lt;/p&gt;</description>
			</item>
			<item>
				<title>NodeJs: Loops, Closure and Async Invocation</title>
				<link>https://kodebot.com/blog/2015/nodejs-loops/</link>
				<pubDate>Sun, 04 Oct 2015 00:00:00 +0000</pubDate>
				<guid>https://kodebot.com/blog/2015/nodejs-loops/</guid>
				<description>&lt;h2 id=&#34;closure&#34;&gt;Closure&lt;/h2&gt;&#xA;&lt;p&gt;Closure is something that is very familiar to all C# developers who know lambda expressions/functions but they just may not know that it is called Closure in JavaScript.&lt;br&gt;&#xA;Lets look at what is closure in JavaScript without further ado with an example:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-js&#34; data-lang=&#34;js&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kd&#34;&gt;function&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;outer&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(){&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#x9;&lt;span class=&#34;kd&#34;&gt;var&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;inOuter&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;outer&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#x9;&lt;span class=&#34;nx&#34;&gt;inner&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;();&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#x9;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#x9;&lt;span class=&#34;kd&#34;&gt;function&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;inner&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(){&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#x9;&#x9;&lt;span class=&#34;nx&#34;&gt;console&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;log&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;inOuter&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt; &lt;span class=&#34;c1&#34;&gt;// prints &amp;#39;outer&amp;#39;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#x9;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In this example, the variable &lt;code&gt;inOuter&lt;/code&gt; is defined in the function &lt;code&gt;outer&lt;/code&gt; but it is used in the function &lt;code&gt;inner&lt;/code&gt;. This is possible because, the a function in JavaScript can access all the variables in the scope where the function is defined and this is called Closure.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Exception Handling in NodeJS</title>
				<link>https://kodebot.com/blog/2015/exception-handling-in-nodejs/</link>
				<pubDate>Sun, 27 Sep 2015 00:00:00 +0000</pubDate>
				<guid>https://kodebot.com/blog/2015/exception-handling-in-nodejs/</guid>
				<description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;&#xA;&lt;p&gt;Exception handling in Node might look completely different for developers coming from C# background like myself.&#xA;It is mainly because of the way Node works. Node uses single thread based event loop to enable concurrency, this results in higher throughput with relatively low overhead.&#xA;When it comes to exception handling, having some understanding of the event loop will help you to do the right thing.&lt;/p&gt;&#xA;&lt;h2 id=&#34;event-loop&#34;&gt;Event Loop&lt;/h2&gt;&#xA;&lt;p&gt;Node has the following three main components to achieve concurrent, non-blocking execution&lt;br&gt;&#xA;1. Event Demultiplexer&lt;br&gt;&#xA;2. Event Loop&lt;br&gt;&#xA;3. Event Queue&lt;/p&gt;</description>
			</item>
			<item>
				<title>Unit Testing Entity Framework async Queries</title>
				<link>https://kodebot.com/blog/2015/unit-testing-entity-framework-async-queries/</link>
				<pubDate>Thu, 13 Aug 2015 00:00:00 +0000</pubDate>
				<guid>https://kodebot.com/blog/2015/unit-testing-entity-framework-async-queries/</guid>
				<description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;&#xA;&lt;p&gt;In my &lt;a href=&#34;../unit-testing-entity-framework-queries/&#34;&gt;last article&lt;/a&gt;, we have seen how to unit test Entity Framework queries. Now, let&amp;rsquo;s look at how to unit test async queries.&#xA;When using async tasks, if we don&amp;rsquo;t use it all the way then we are not using async tasks properly. For example, if you have async action method in your controller which queries database synchronously to send some data to the requester, then we are NOT using async properly as the thread is blocked during database operation. So, to take full advantage of async tasks, we have to use async tasks all the way wherever it is applicable. Fortunately, we get async query support starting from &lt;a href=&#34;https://msdn.microsoft.com/en-us/data/jj819165.aspx&#34;&gt;Entity Framework 6&lt;/a&gt;.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Unit Testing Entity Framework Queries</title>
				<link>https://kodebot.com/blog/2015/unit-testing-entity-framework-queries/</link>
				<pubDate>Mon, 10 Aug 2015 00:00:00 +0000</pubDate>
				<guid>https://kodebot.com/blog/2015/unit-testing-entity-framework-queries/</guid>
				<description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;&#xA;&lt;p&gt;When writing unit tests, we should test only one thing at once and isolate the system under test(SUT) from all the dependencies. We should follow the same approach for any LINQ queries you write to retrieve data from the underlying Database. But, I have seen many developers excluding the whole data access layer from unit testing. This is not right approach to follow IMHO. Many developers don&amp;rsquo;t bother unit testing data access layer because of the perceived effort and complexity involved in isolating the data access layer from underlying Database and ORM tools like Entity Framework. The truth is, it is very easy to test your queries without touching Entity Framework or Database.&lt;/p&gt;</description>
			</item>
			<item>
				<title>VS-TAC - Cordova version</title>
				<link>https://kodebot.com/blog/2015/vs-tac-cordova-version/</link>
				<pubDate>Fri, 17 Jul 2015 00:00:00 +0000</pubDate>
				<guid>https://kodebot.com/blog/2015/vs-tac-cordova-version/</guid>
				<description>&lt;p&gt;&lt;a href=&#34;http://aka.ms/cordova&#34; target=&#34;_blank&#34;&gt;Visual Studio – Tools for Apache Cordova&lt;/a&gt; is a great addition to Visual Studio. It allows us to develop &lt;a href=&#34;http://cordova.apache.org/&#34; target=&#34;_blank&#34;&gt;Apache Cordova&lt;/a&gt; applications while taking all the advantages of Visual Studio. I started using it with VS 2015 RC for one of the application I am developing using &lt;a href=&#34;http://ionicframework.com/&#34; target=&#34;_blank&#34;&gt;Ionic&lt;/a&gt;. &lt;/p&gt; &lt;p&gt;Most of the work is done by visual studio using a new npm package called vs-tac, this package takes care of building and deploying your application using collection of cordova tools.</description>
			</item>
			<item>
				<title>ASP.NET MVC 5 - JsonResult with Http Status Code 400</title>
				<link>https://kodebot.com/blog/2015/aspnet-mvc-5-jsonresult-with-http-status-code-400/</link>
				<pubDate>Fri, 19 Jun 2015 00:00:00 +0000</pubDate>
				<guid>https://kodebot.com/blog/2015/aspnet-mvc-5-jsonresult-with-http-status-code-400/</guid>
				<description>&lt;p&gt;ASP.NET Web API 2 introduced several helper methods like Ok, NotFound, BadRequest, etc… . This allows us to write code which makes its intentions clear.&lt;/p&gt;&#xA;&lt;p&gt;In recent times, I have been working in semi-single page application which uses ASP.NET MVC 5 and AngularJS. The application is designed in a way that, there is only one view per feature and each view is SPA. So, each ASP.NET MVC controller have only one GET action that returns the view and rest of the communication is using actions that returns JsonResult that can be used by client in AJAX style just like consuming Web API.&#xA;With this design, I have to send JsonResult for everything, but, the Http Status Code has to be set appropriately so that the client can use them for any processing that it needs to do based on the Status Code.&lt;/p&gt;</description>
			</item>
			<item>
				<title>AngularJS 1.x - Validation on File Input type</title>
				<link>https://kodebot.com/blog/2015/angularjs-1x-validation-on-file-input-type/</link>
				<pubDate>Tue, 16 Jun 2015 00:00:00 +0000</pubDate>
				<guid>https://kodebot.com/blog/2015/angularjs-1x-validation-on-file-input-type/</guid>
				<description>&lt;h3&gt;Introduction&lt;/h3&gt; &lt;p&gt;You might already known that AngularJS 1.x &lt;a href=&#34;https://github.com/angular/angular.dart/issues/1094&#34; target=&#34;_blank&#34;&gt;doesn’t support&lt;/a&gt; model binding for File Input type at the moment. This means, implementing any validation on File Input type is not straight forward as validation entirely depends on model binding.&lt;/p&gt; &lt;p&gt;I have come across a requirement where, I need to create a form &lt;!-- more --&gt;with ‘required’ validation on File Input type and I also need to display bootstrap form feedback. There are number of &lt;a href=&#34;http://stackoverflow.com/a/20506037/3208697&#34; target=&#34;_blank&#34;&gt;great solutions out there&lt;/a&gt; to make file upload with angular easier but none of them provide easier way to enforce validation.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Angular 1.x - Unit Testing a function that returns Promise</title>
				<link>https://kodebot.com/blog/2015/angular-1x-unit-testing-a-function-that-returns-promise/</link>
				<pubDate>Mon, 08 Jun 2015 00:00:00 +0000</pubDate>
				<guid>https://kodebot.com/blog/2015/angular-1x-unit-testing-a-function-that-returns-promise/</guid>
				<description>&lt;p&gt;I wrote &lt;a href=&#34;../mocking-function-that-returns-promise&#34; target=&#34;_blank&#34;&gt;this&lt;/a&gt; post few months back which show how we can mock a function that returns Promise. In this post, we will see how to test a function that returns Promise.&lt;/p&gt; &lt;p&gt;We will use the following simple controller as our SUT&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-js&#34; data-lang=&#34;js&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kd&#34;&gt;var&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;app&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;angular&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;module&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;app&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;app&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;controller&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;studentController&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;kd&#34;&gt;function&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;$q&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;studentDataService&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;){&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;kd&#34;&gt;var&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;vm&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;this&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;    &#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;vm&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;students&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;kc&#34;&gt;undefined&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;activate&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;();&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;kd&#34;&gt;function&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;activate&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;(){&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;nx&#34;&gt;vm&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;students&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;getAllStudents&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;();&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;kd&#34;&gt;function&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;getAllStudents&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(){&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;studentDataService&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;getAll&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;();&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;});&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This simple controller has &lt;code&gt;getAllStudents()&lt;/code&gt; which returns a promise. The activate method calls &lt;code&gt;getAllStudents()&lt;/code&gt; and assigns the returned promise to &lt;code&gt;vm.students&lt;/code&gt;. In angular, you can directly bind promise, so, this is perfectly valid.&lt;/p&gt;</description>
			</item>
			<item>
				<title>TypeScript - Accessing object with null key</title>
				<link>https://kodebot.com/blog/2015/typescript-accessing-object-with-null-key/</link>
				<pubDate>Wed, 03 Jun 2015 00:00:00 +0000</pubDate>
				<guid>https://kodebot.com/blog/2015/typescript-accessing-object-with-null-key/</guid>
				<description>&lt;p&gt;Objects in JavaScript is just a key value pair and key is usually string and value can be anything. The following is an example of JavaScript object literal&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-js&#34; data-lang=&#34;js&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kd&#34;&gt;var&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;car&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;wheels&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;3&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;colour&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;s1&#34;&gt;&amp;#39;red&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;nx&#34;&gt;drive&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;kd&#34;&gt;function&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(){&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;p&#34;&gt;...&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The key in the object can be null. The default route in AngularJS is associated with null key, for example.&lt;/p&gt;&#xA;&lt;p&gt;We can access the value associated with the null key in JavaScript quite easily like this:&lt;/p&gt;</description>
			</item>
			<item>
				<title>ASP.NET MVC 5 Hosting for Integration / E2E Testing</title>
				<link>https://kodebot.com/blog/2015/aspnet-mvc-5-hosting-for-integration-e2e-testing/</link>
				<pubDate>Sat, 30 May 2015 00:00:00 +0000</pubDate>
				<guid>https://kodebot.com/blog/2015/aspnet-mvc-5-hosting-for-integration-e2e-testing/</guid>
				<description>&lt;h4&gt;Introduction&lt;/h4&gt;&#xA;&lt;p&gt;When we want to do proper Integration or End to End testing of Web API, we can choose any process as host for Web API 2 or higher. This is possible because Web API supports Owin/Katana, which means, &lt;!-- more --&gt;it doesn&amp;rsquo;t have any direct dependency on IIS. On the other hand MVC 5 doesn&amp;rsquo;t have support for Owin/Katana due to the fact that ASP.NET pipeline is depending on IIS. So this leaves us with only one option to host MVC 5, which is IIS, even for integration/e2e testing.&lt;/p&gt;</description>
			</item>
			<item>
				<title>How to isolate AutoMapper in Unit Tests?</title>
				<link>https://kodebot.com/blog/2015/how-to-mock-automapper-in-unit-tests/</link>
				<pubDate>Wed, 20 May 2015 00:00:00 +0000</pubDate>
				<guid>https://kodebot.com/blog/2015/how-to-mock-automapper-in-unit-tests/</guid>
				<description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;When it comes to Unit testing, the rule is to isolate&amp;nbsp;all the dependencies and focus only on the unit of code you are testing. I have been silently ignoring this for &lt;a href=&#34;http://automapper.org/&#34;&gt;AutoMapper&lt;/a&gt; until I &lt;!-- more --&gt;found a proper way to isolate and replace the behavior of mapping.&lt;/p&gt;&#xA;&lt;p&gt;When I was looking for a proper way to do this, I come across many posts but none of them were having full working example without any additional layer between the function/class that wants to use AutoMapper and AutoMapper itself.&lt;/p&gt;</description>
			</item>
			<item>
				<title>ASP.NET 5 - Tag Helpers, the HTML way</title>
				<link>https://kodebot.com/blog/2015/asp-net-5-tag-helpers-the-html-way/</link>
				<pubDate>Thu, 14 May 2015 00:00:00 +0000</pubDate>
				<guid>https://kodebot.com/blog/2015/asp-net-5-tag-helpers-the-html-way/</guid>
				<description>&lt;h4&gt;Introduction&lt;/h4&gt;&#xA;&lt;p&gt;Tag Helper is not a new concept in ASP.NET but they way we use Tag Helpers in razor view is different. In the previous versions of ASP.NET, if we want to use HTML tag helper, we will be switching from HTML&#39;s native declarative style to imperative style of C#.&lt;/p&gt;&lt;!-- more --&gt;&#xA;&lt;p&gt;We loose the tooling support we get when editing HTML document for the most part. For example, the following code creates a label&lt;/p&gt;</description>
			</item>
			<item>
				<title>ASP.NET 5 - Environment specific pipeline configuration</title>
				<link>https://kodebot.com/blog/2015/asp-net-5-environment-specific-pipeline-configuration/</link>
				<pubDate>Fri, 08 May 2015 00:00:00 +0000</pubDate>
				<guid>https://kodebot.com/blog/2015/asp-net-5-environment-specific-pipeline-configuration/</guid>
				<description>&lt;h4&gt;Introduction&lt;/h4&gt;&#xA;&lt;p&gt;In ASP.NET 5, we configure and add middlewares (aka pipelines) using Startup class. The convention is similar to Owin/Katana but not the same.&lt;/p&gt;&#xA;&lt;p&gt;The Configuration method in Owin/Katana Startup class is replaced by Configure method and the parameter type is IApplicationBuilder rather than IAppBuilder and how we create and add&amp;nbsp;middleware is also different to some extend.&amp;nbsp;&lt;/p&gt;&lt;!-- more --&gt;&#xA;&lt;p&gt;ASP.NET 5 Startup class allows us to add and configure services using ConfigureService method, this is not available in Owin/Katana Startup class. The services we add using this method is added to the DependencyInjection container which comes with ASP.NET 5 out of the box.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Owin - Katana core middleware patterns</title>
				<link>https://kodebot.com/blog/2015/owin-katana-core-middleware-patterns/</link>
				<pubDate>Wed, 29 Apr 2015 00:00:00 +0000</pubDate>
				<guid>https://kodebot.com/blog/2015/owin-katana-core-middleware-patterns/</guid>
				<description>&lt;h3&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;Katana supports 4 different convention based patterns for adding middlewares in its lowest level. They are,&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Delegate Pattern&lt;/li&gt;&#xA;&lt;li&gt;Instance Pattern&lt;/li&gt;&#xA;&lt;li&gt;Generator/Nested Delegate Pattern&lt;/li&gt;&#xA;&lt;li&gt;Constructor Type or Type Pattern&lt;/li&gt;&#xA;&lt;/ol&gt;&lt;!-- more --&gt;&#xA;&lt;p&gt;All the other formats/patterns supported through IAppBuilder&#39;s extension methods are implemented using one of these 4 patterns under the hood.&lt;/p&gt;&#xA;&lt;p&gt;I couldn&#39;t find any examples in the web which show how to use these patterns, so I am creating it for my future reference.&lt;/p&gt;</description>
			</item>
			<item>
				<title>TypeScript - &#39;this&#39; reference in AngularJS event handler</title>
				<link>https://kodebot.com/blog/2015/typescript-this-reference-in-angularjs-event-handler/</link>
				<pubDate>Mon, 27 Apr 2015 00:00:00 +0000</pubDate>
				<guid>https://kodebot.com/blog/2015/typescript-this-reference-in-angularjs-event-handler/</guid>
				<description>&lt;p&gt;Let&#39;s have a look at how AngularJS 1.x controller is usually created in TypeScript before we go into details of how AngularJS event handler and how &#39;this&#39; works in the AngularJS event handler context. &lt;/p&gt;&#xA;&lt;p&gt;TypeScript encourages to type anything and everything to take full advantages of the type system and tool supports we get when working with any strongly typed language.&lt;/p&gt;&lt;!-- more --&gt;&#xA;&lt;p&gt;So, when using TypeScript with AngularJS 1.x, class is usually created to represent the implementation of the controllers. Here is an example of how this would look like&lt;/p&gt;</description>
			</item>
			<item>
				<title>TypeScript build automation in ASP.NET 5 (MVC6) using Gulp</title>
				<link>https://kodebot.com/blog/2015/typescript-build-automation-in-asp-net-5-mvc6-using-gulp/</link>
				<pubDate>Sat, 18 Apr 2015 00:00:00 +0000</pubDate>
				<guid>https://kodebot.com/blog/2015/typescript-build-automation-in-asp-net-5-mvc6-using-gulp/</guid>
				<description>&lt;h3&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;ASP.NET 5 introduces some major changes in terms of how we develop applications like no need for project and file association, wwwroot folder, first class support for JSON config files, .NET framework &lt;!-- more --&gt;choice, separation of client side and server side package management and more. You can read more on this &lt;a href=&#34;http://weblogs.asp.net/scottgu/introducing-asp-net-5&#34; target=&#34;_blank&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Above all of these, it supports JavaScript build automation by providing support for the &lt;a href=&#34;https://nodejs.org/&#34; target=&#34;_blank&#34;&gt;nodejs&lt;/a&gt;&amp;nbsp;platform.&amp;nbsp;&lt;/p&gt;&#xA;&lt;p&gt;Visual Studio 2015 has in-built task runner to run grunt or gulp tasks, this is great because we don&#39;t have to leave Visual Studio to run these tasks.&amp;nbsp;&lt;/p&gt;</description>
			</item>
			<item>
				<title>MVC 6 Camel Case JSON</title>
				<link>https://kodebot.com/blog/2015/mvc-6-camel-case-json/</link>
				<pubDate>Mon, 13 Apr 2015 00:00:00 +0000</pubDate>
				<guid>https://kodebot.com/blog/2015/mvc-6-camel-case-json/</guid>
				<description>&lt;p&gt;I am excited with all the new features that are coming with MVC 6. One of the main differences between MVC 6 and previous versions is that it doesn&#39;t have two different libraries and controllers for MVC and Web &lt;!-- more --&gt;API.&amp;nbsp;&lt;/p&gt;&#xA;&lt;p&gt;The previous versions of Asp.Net MVC uses &lt;a href=&#34;https://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptserializer(v=vs.110).aspx&#34; target=&#34;_blank&#34;&gt;JavaScriptSerializer&lt;/a&gt;&amp;nbsp;for MVC controllers and &lt;a href=&#34;http://www.newtonsoft.com/json&#34; target=&#34;_blank&#34;&gt;JSON.NET&lt;/a&gt;&amp;nbsp;for Web API controllers.&lt;/p&gt;&#xA;&lt;p&gt;This means, if you have an application which uses both MVC controllers and Web API controllers then you need to apply any custom JSON serialization configurations twice or you should replace &lt;code&gt;JavaScriptSerializer&lt;/code&gt; with JSON.NET.&lt;/p&gt;</description>
			</item>
			<item>
				<title>TPL Task and Windows Identity Impersonation - The beauty of Closure</title>
				<link>https://kodebot.com/blog/2015/tpl-task-and-windows-identity-impersonation-the-beauty-of-closure/</link>
				<pubDate>Thu, 09 Apr 2015 00:00:00 +0000</pubDate>
				<guid>https://kodebot.com/blog/2015/tpl-task-and-windows-identity-impersonation-the-beauty-of-closure/</guid>
				<description>&lt;p&gt;I have created a web application with Windows Authentication and impersonation is enabled as I need the application connect to SQL Server database using Windows Authentication.&lt;/p&gt;&#xA;&lt;p&gt;I wanted&amp;nbsp;to run a TPL task in the impersonated context, so, I added the following code naively in a&amp;nbsp;action method of one of my controllers&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-cs&#34; data-lang=&#34;cs&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;// naive task code&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;Task&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;Run&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(()&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;=&amp;gt;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;      &lt;span class=&#34;c1&#34;&gt;// Task code here&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;});&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Though, &lt;a href=&#34;https://social.msdn.microsoft.com/Forums/vstudio/en-US/a1da0143-919c-433d-9d50-83795879082d/tasks-and-impersonation?forum=parallelextensions&#34; target=&#34;_blank&#34;&gt;this answer&lt;/a&gt;&amp;nbsp;suggests that tasks will run under the same context under which it was created, it wasn&#39;t working that way in my case.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Selenium and Page Objects</title>
				<link>https://kodebot.com/blog/2015/selenium-and-page-objects/</link>
				<pubDate>Mon, 06 Apr 2015 00:00:00 +0000</pubDate>
				<guid>https://kodebot.com/blog/2015/selenium-and-page-objects/</guid>
				<description>&lt;p&gt;I use&amp;nbsp;&lt;a href=&#34;http://docs.seleniumhq.org/&#34; target=&#34;_blank&#34;&gt;Selenium&lt;/a&gt;&amp;nbsp;or &lt;a href=&#34;http://angular.github.io/protractor/#/&#34; target=&#34;_blank&#34;&gt;Protractor&lt;/a&gt;&amp;nbsp;for E2E tests that require browser automation. I prefer to use Selenium when I want to write my tests in C# and Protractor for AngularJS applications.&lt;/p&gt;&lt;!-- more --&gt;&#xA;&lt;p&gt;It doesn&#39;t matter what tool/framework you use, if you want to bring in structure and make your test code reusable when dealing with any UI automation then Page Object is your friend.&lt;/p&gt;&#xA;&lt;p&gt;I have been creating my Page Objects incorrectly with two major flaws until I read &lt;a href=&#34;http://martinfowler.com/bliki/PageObject.html&#34; target=&#34;_blank&#34;&gt;this&lt;/a&gt;&amp;nbsp;great article from Martin Fowler. The flaws in my Page Objects were&lt;/p&gt;</description>
			</item>
			<item>
				<title>ECMAScript 6 - Sublime Text editor build system</title>
				<link>https://kodebot.com/blog/2015/ecmascript-6-sublime-text-editor-build-system/</link>
				<pubDate>Fri, 27 Mar 2015 00:00:00 +0000</pubDate>
				<guid>https://kodebot.com/blog/2015/ecmascript-6-sublime-text-editor-build-system/</guid>
				<description>&lt;p&gt;The specification for ECMAScript 6 (aka ES6, ECMAScript harmony) is expected to be released in June 2015 and many tools, frameworks and browsers have started implementing the features of ES6. For example, &lt;a href=&#34;https://angular.io/&#34; target=&#34;_blank&#34;&gt;Angular 2.0&lt;/a&gt;&amp;nbsp;and &lt;a href=&#34;http://aurelia.io/&#34; target=&#34;_blank&#34;&gt;Aurelia&lt;/a&gt;&amp;nbsp;allows us to write code in ES6 now. There are transpilers as well out there, which &lt;!-- more --&gt;allows us to write code in ES6 and transpile them into ES5. I have come across two major transpilers&amp;nbsp;&lt;a href=&#34;https://github.com/google/traceur-compiler&#34; target=&#34;_blank&#34;&gt;traceur&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href=&#34;https://babeljs.io/&#34;&gt;babel&lt;/a&gt;, they are equally good.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Six stars of AngularJS - Part 3</title>
				<link>https://kodebot.com/blog/2015/six-stars-of-angularjs-part-3/</link>
				<pubDate>Wed, 25 Mar 2015 00:00:00 +0000</pubDate>
				<guid>https://kodebot.com/blog/2015/six-stars-of-angularjs-part-3/</guid>
				<description>&lt;p&gt;In part &lt;a href=&#34;../six-stars-of-angularjs-part-1&#34; target=&#34;_blank&#34;&gt;1&lt;/a&gt;&amp;nbsp;and &lt;a href=&#34;../six-stars-of-angularjs-part-2&#34; target=&#34;_blank&#34;&gt;2&lt;/a&gt;&amp;nbsp;of this series, we have seen five different ways to create a service in angular.&lt;/p&gt;&lt;!-- more --&gt;&#xA;&lt;p&gt;The last one we are going to look at in this series is &#39;decorate&#39; function of $provide service.&lt;/p&gt;&#xA;&lt;h2&gt;Decorator&lt;/h2&gt;&#xA;&lt;p&gt;The decorate function is NOT used to create a service, instead, this is used to decorate or replace an existing service. Let&#39;s look at this function with an example&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-js&#34; data-lang=&#34;js&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;// sample 1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;app&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;factory&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;movieService&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;movieService&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;kd&#34;&gt;function&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;movieService&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;            &lt;span class=&#34;nx&#34;&gt;getAllMovies&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;getAllMovies&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;kd&#34;&gt;function&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;getAllMovies&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;            &lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;[&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;engMovie1&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;s1&#34;&gt;&amp;#39;engMovie2&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;s1&#34;&gt;&amp;#39;engMovie3&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;];&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In this example, we have movieService which exposes a function to get all the movies. Now, Let&#39;s create a decorator for this service to change the behavior of getAllMovies to return only the first 2 items.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Six stars of AngularJS - Part 2</title>
				<link>https://kodebot.com/blog/2015/six-stars-of-angularjs-part-2/</link>
				<pubDate>Tue, 24 Mar 2015 00:00:00 +0000</pubDate>
				<guid>https://kodebot.com/blog/2015/six-stars-of-angularjs-part-2/</guid>
				<description>&lt;p&gt;In &lt;a href=&#34;../six-stars-of-angularjs-part-1&#34; target=&#34;_blank&#34;&gt;part 1&lt;/a&gt;&amp;nbsp;of this series, we have briefly seen how &lt;code&gt;$provide&lt;/code&gt; and &lt;code&gt;$injector&lt;/code&gt; work and we also took a deep dive on how we create a service using provider function of &lt;code&gt;$provide&lt;/code&gt; service.&lt;/p&gt;&lt;!-- more --&gt;&#xA;&lt;p&gt;Lets continue our journey and look at how and when we can&amp;nbsp;use other&amp;nbsp;functions of &lt;code&gt;$provide&lt;/code&gt; service to create services.&lt;/p&gt;&#xA;&lt;p&gt;The following are the four&amp;nbsp;functions we are going to look at now&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;factory&lt;/li&gt;&#xA;&lt;li&gt;service&lt;/li&gt;&#xA;&lt;li&gt;value&lt;/li&gt;&#xA;&lt;li&gt;constant&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h2&gt;Factory&lt;/h2&gt;&#xA;&lt;p&gt;The factory is one of the functions exposed by $provide service to create services. Here is an example of service created using factory function of &lt;code&gt;$provide&lt;/code&gt; service&lt;/p&gt;</description>
			</item>
			<item>
				<title>Six stars of AngularJS - Part 1</title>
				<link>https://kodebot.com/blog/2015/six-stars-of-angularjs-part-1/</link>
				<pubDate>Mon, 23 Mar 2015 00:00:00 +0000</pubDate>
				<guid>https://kodebot.com/blog/2015/six-stars-of-angularjs-part-1/</guid>
				<description>&lt;h2&gt;Introduction&lt;/h2&gt;&#xA;&lt;p&gt;Services are one of the core buiding blocks of AngularJS. It helps us to create reusable code that can be shared accross the application(s).&lt;/p&gt;&lt;!-- more --&gt;&#xA;&lt;p&gt;AngularJS gives us five different options to create services. We will look at what are those five options and how and when they can be used. But, before that lets take a brief look at couple of built-in angular services and how they works in the context of dependency injection.&lt;/p&gt;</description>
			</item>
			<item>
				<title>NSequenceComparer to compare two sequences</title>
				<link>https://kodebot.com/blog/2015/nsequencecomparer-to-compare-two-sequences/</link>
				<pubDate>Sat, 21 Mar 2015 00:00:00 +0000</pubDate>
				<guid>https://kodebot.com/blog/2015/nsequencecomparer-to-compare-two-sequences/</guid>
				<description>&lt;p&gt;I had a requirement&amp;nbsp;to compare two sequences to find the differences in .NET platform. To compare large sequences, I needed an algorithm that&amp;nbsp;does not use recursion.&amp;nbsp;I could not find anything in &lt;!-- more --&gt;the internet that I can use out of the box, so, I created&amp;nbsp;&lt;a href=&#34;https://www.nuget.org/packages/NSequenceComparer/&#34; target=&#34;_blank&#34;&gt;this nuget package&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This package is very simple to use, you can read usage instructions&amp;nbsp;&lt;a href=&#34;https://github.com/kodebot/NSequenceComparer/blob/master/README.md&#34; target=&#34;_blank&#34;&gt;here&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Feel free to use and contribute.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Mocking function that returns promise</title>
				<link>https://kodebot.com/blog/2015/mocking-function-that-returns-promise/</link>
				<pubDate>Mon, 16 Mar 2015 00:00:00 +0000</pubDate>
				<guid>https://kodebot.com/blog/2015/mocking-function-that-returns-promise/</guid>
				<description>&lt;p&gt;Promises are very useful to develope non-blocking web applications and it also helps to avoid &lt;a href=&#34;http://calculist.org/blog/2011/12/14/why-coroutines-wont-work-on-the-web/&#34; target=&#34;_blank&#34;&gt;pyramid of doom&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;AngularJS supports&amp;nbsp;&lt;a href=&#34;https://github.com/kriskowal/q&#34; target=&#34;_blank&#34;&gt;Q&lt;/a&gt;&amp;nbsp;based promises, this means, we can create functions in AngularJS application that uses promises. When it comes to unit testing functions that returns promises, it is just like unit testing normal functions &lt;!-- more --&gt;only if you remember&amp;nbsp;simulate scope&#39;s life cycle using &lt;code&gt;$apply()&lt;/code&gt; or &lt;code&gt;$digest()&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;Let&#39;s see this with an example. The following controller loads restaurants using promise&lt;/p&gt;</description>
			</item>
			<item>
				<title>Strucuring unit tests</title>
				<link>https://kodebot.com/blog/2015/structuring-unit-tests/</link>
				<pubDate>Mon, 16 Mar 2015 00:00:00 +0000</pubDate>
				<guid>https://kodebot.com/blog/2015/structuring-unit-tests/</guid>
				<description>&lt;p&gt;I have been following the same unit test structure that Phil Haack described &lt;a href=&#34;http://haacked.com/archive/2012/01/02/structuring-unit-tests.aspx/&#34; target=&#34;_blank&#34;&gt;here&lt;/a&gt;. &amp;nbsp;But, I use slightly different version when my tests need too many repeated test setups and cleanups.&amp;nbsp;&lt;/p&gt;&lt;!-- more --&gt;&#xA;&lt;p&gt;I like &lt;a href=&#34;http://jasmine.github.io/&#34; target=&#34;_blank&#34;&gt;jasmine&lt;/a&gt;&amp;nbsp;mainly because it allows to keep the tests &lt;a href=&#34;http://en.wikipedia.org/wiki/Don%27t_repeat_yourself&#34; target=&#34;_blank&#34;&gt;DRY&lt;/a&gt;&amp;nbsp;using nested structure. Ofcourse it is possible in jasmine because method nesting is allowed in JavaScript. I like to structure my C# test files the same way using nested classes&amp;nbsp;without using any additional libraries&lt;/p&gt;</description>
			</item>
			<item>
				<title>Decorator over Inheritance hierarchy</title>
				<link>https://kodebot.com/blog/2015/decorator-over-inheritance-hierarchy/</link>
				<pubDate>Sun, 15 Mar 2015 00:00:00 +0000</pubDate>
				<guid>https://kodebot.com/blog/2015/decorator-over-inheritance-hierarchy/</guid>
				<description>&lt;p&gt;I have used inheritance to solve a problem in many situations - some of them are correct and some of them are not when thinking about it now.&lt;/p&gt;&#xA;&lt;div&gt;&#xA;&lt;p&gt;When you are in a situation where you think you need multi-level inheritance, 9 out of 10 times you can solve the same problem using decorators.&lt;/p&gt;&#xA;&lt;/div&gt;&lt;!-- more --&gt;&#xA;&lt;div&gt;&#xA;&lt;p&gt;One of the problems I have seen recently which fits in this pattern is the implementation of ICommand interface. See the implementation below&lt;/p&gt;</description>
			</item>
			<item>
				<title>Organize AngularJS Tests within a test file</title>
				<link>https://kodebot.com/blog/2015/organize-angularjs-tests-within-a-spec/</link>
				<pubDate>Sun, 15 Mar 2015 00:00:00 +0000</pubDate>
				<guid>https://kodebot.com/blog/2015/organize-angularjs-tests-within-a-spec/</guid>
				<description>&lt;p&gt;I like to have one test file&amp;nbsp;per components of AngularJS application. So, for example, &lt;code&gt;homeController&lt;/code&gt; will have its own test file&amp;nbsp;named &lt;code&gt;homeSpec&lt;/code&gt; or &lt;code&gt;homeControllerSpec.&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;First, create a&amp;nbsp;suite to describe a component at a high level and for each scenario create&amp;nbsp;nested suits. This allows us&amp;nbsp;to define any test setup that are common for &lt;!-- more --&gt;all the tests&amp;nbsp;in one place.&lt;/p&gt;&#xA;&lt;p&gt;For example, loading module, overriding and injecting any dependencies are done in the beforeEach method of outter test suite. The setup is applicable for all the tests defined in the outter and nested test suits, so, if you don&#39;t want any setup for all the tests then do not include them here.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Setup Chutzpah to Run Javascript Tests in VisualStudio</title>
				<link>https://kodebot.com/blog/2015/setup-chutzpah-to-run-javascript-tests-in-visualstudio/</link>
				<pubDate>Sat, 14 Mar 2015 00:00:00 +0000</pubDate>
				<guid>https://kodebot.com/blog/2015/setup-chutzpah-to-run-javascript-tests-in-visualstudio/</guid>
				<description>&lt;p&gt;First thing first, install Chutzpah &lt;a href=&#34;https://visualstudiogallery.msdn.microsoft.com/71a4e9bd-f660-448f-bd92-f5a65d39b7f0&#34; target=&#34;_blank&#34;&gt;Test Runner&lt;/a&gt;&amp;nbsp;and &lt;a href=&#34;https://visualstudiogallery.msdn.microsoft.com/f8741f04-bae4-4900-81c7-7c9bfb9ed1fe&#34; target=&#34;_blank&#34;&gt;Test Adaptor for the Test Explorer&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Next, setup your projects in Visual Studio. I personally like to keep my test code in a separate project for JavaScript as well so my project and folder structure looks like this:&lt;/p&gt;&#xA;&lt;figure&gt;&#xA;&lt;img src=&#34;https://kodebot.com/blog/2015/setup-chutzpah-to-run-javascript-tests-in-visualstudio/images/test-structure-screenshot.png&#34; alt=&#34;&#34; loading=&#34;lazy&#34;&gt;&#xA;&lt;/figure&gt;&#xA;&lt;p style=&#34;text-align: left;&#34;&gt;This allows you&amp;nbsp;to restrict testing frameworks and libraries like Jasmine only to&amp;nbsp;the test project. I use JavaScript&amp;nbsp;libraries directly from the main project when it is needed in test projects as well rather then adding them again in the test project (some people have different view on this but it works for me).&lt;/p&gt;</description>
			</item>
	</channel>
</rss>
