Tags

TypeScript Rest Parameters

TypeScript Rest parameters allows a function to take unlimited parameters. Rest parameters are used when we are designing a function and we do not know how many parameters are required. Rest parameters feature group parameters into a single variable and we can access parameters inside a function just like an array of parameters. There is only one rest parameter allowed in a function. Syntax...

Continue Reading

Typescript Optional Parameters

TypeScript is a strong typed language. When we declare parameters for a function then all the parameters are required and client has to pass values to every parameter. When client has no value for any parameter then he can pass null value. TypeScript provides a Optional parameters feature. By using Optional parameters featuers, we can declare some paramters in the function optional, so that clien...

Continue Reading

TypeScript Switch Case

Switch case statement is used when we have to choose between different blocks of code based on an expression. It replaces the need of multiple if...elseif conditions and provides more clean code. Switch evaluates an expression and then match with different case clauses. If any value matches with case clause then it execute associated code block statement else execute default case statement. ...

Continue Reading

TypeScript Union Type

TypeScript Union Type is a hint of possible data types of a variable. We used union types when we are not sure about the possible variable data type but we know about possible data types are limited. For example we have a variable discount. We know a discount variable is always be a number data type. But we are using external JavaScript libraries and that libraries can send discount value in a...

Continue Reading

Typescript Data Types

In this TypeScript tutorial, we will learn about TypeScripts data types. Data types helps you to write code just like you write in other OOPS languages like C# and Java. Data Types provides strongly typed code. A strongly typed code means all variables data types are known at compile time. Strongly typed code helps compiler to throw error when it's see a mismatch of assigned variable values li...

Continue Reading

TypeScript Environment Setup

There are two popular options available for writing TypeScript code: Use an online playground Use Visual Studio 2015 and above Online Playground Typescriptlang.org provides a web page where we can immediately write and see javascript output in a web page. You can click on Playground link. In the left section of page we can write our TypeScript code and right section automat...

Continue Reading

Introduction - TypeScript Tutorial

JavaScript is everywhere. It is used in every website you visit. JavaScript is an easy language to learn and program. But difficulty comes when we have to write large and complex programs. The first challenge we face is that JavaScript is an interpreted language and does not compile. We does not know the error in program until runtime. Second challenge, JavaScript is not an object oriented langu...

Continue Reading

NUnit Assert Examples - How to Use?

NUnit Assert class is used to determine whether a particular test method gives expected result or not. In a test method, we write code the check the business object behavior. That business object returns a result. In Assert method we match the actual result with our expected result. If result comes according to our expected result then our test case is passed else failed. Constraint Mo...

Continue Reading

NUnit TestCase - Array and Execution Order - NUnit Tutorial

In this C# NUnit tutorial, we'll learn about how to pass same type of objects array into test method and how to control the execution order of test methods. NUnit TestCase Array Below is the example of passing array to a test method. [TestCase(new int[] { 2, 4, 6 })] public void When_AllNumberAreEven_Expects_AreAllNumbersEvenAsTrue(int[] numbers) { Number number = new Number...

Continue Reading

NUnit TestCase C# Tutorial

In our last tutorial, we learned about NUNit TestFixture attribute. In this tutorial, we learn about NUnit TestCase attribute and its usage. TestCase attribute is used for two purposes. It marks a method to Test Method. Pass arguments / parameters to Test Method. Test Method When we assign TestCase attribute to any method that lets NUnit test runner to discover this method ...

Continue Reading