locked
Test driven development RRS feed

  • Question

  •  I  am new to Test driven development and Unit testing.
    I wonder  we use Test driven development for 3 tier or n tier application like Asp.net or win form.(Any example or video welcome).

    But we use ASP.Net MVC as Pattern for ASp.net and winform application. and we can use TDD and unit testing.

    How can we use test driven development for simple ASP.Net 4.0 Entity framework and linq.

    Please suggest any articles or videos.

    Thanks


    • Edited by CRM2011_guy Saturday, February 8, 2014 9:13 AM
    Saturday, February 8, 2014 9:12 AM

Answers

  • To answer your questions:
    But we use ASP.Net MVC as Pattern for ASp.net and winform application. and we can use TDD and unit testing.

    Ans: You can add separate project in your solution and mark it as Test Project. You have choice to leverage MS Unit Test or you can use NUnit also. For NUnit, you can find it's documentation at, very simple to use

    http://www.nunit.org/index.php?p=docHome&r=2.6.3

    For videos you can refer youtube video:

    http://www.youtube.com/watch?v=5gMBGVNR8wE

    How can we use test driven development for simple ASP.Net 4.0 Entity framework and linq.

    for linq, to create mock structures you can add fixtures (Test data), e.g., say you're getting data of employee from database, so create structure like this:

    Dictionary <int, string> emp=new Dictionary<int,string>;

    emp.Add (101, 'ABC');emp.Add (104, 'XYZ');emp.Add (102, 'LKK');emp.Add (103, 'DEF');

    now you can apply Linq like 

    var employee=emp.Where(x=> x==101);

    for EF you can create separate test database to connect. 

    Wednesday, February 12, 2014 2:47 PM

All replies

  • Hello,

    TDD (Test Driven Development) is a process of developing software and it's applicable almost to any kind of software development, I'm using it extensively myself.

    TDD is a development methodology and the process is always the same regardless to the technologies you use so the way you do it either in WinForms or ASP.NET WebForms or MVC or any other is just the same.

    You can watch these series of videos authored by James Shore, the program itself is written in Java but you can learn how he's doing TDD and apply it almost in the same way with different set of tools in .NET.

    Books that you may want to read.

    1. The Art of Unit Testing: with examples in C#
    2. Applying Domain-Driven Design and Patterns: With Examples in C# and .NET

    Regards, Eyal Shilony

    Saturday, February 8, 2014 5:47 PM
  • To answer your questions:
    But we use ASP.Net MVC as Pattern for ASp.net and winform application. and we can use TDD and unit testing.

    Ans: You can add separate project in your solution and mark it as Test Project. You have choice to leverage MS Unit Test or you can use NUnit also. For NUnit, you can find it's documentation at, very simple to use

    http://www.nunit.org/index.php?p=docHome&r=2.6.3

    For videos you can refer youtube video:

    http://www.youtube.com/watch?v=5gMBGVNR8wE

    How can we use test driven development for simple ASP.Net 4.0 Entity framework and linq.

    for linq, to create mock structures you can add fixtures (Test data), e.g., say you're getting data of employee from database, so create structure like this:

    Dictionary <int, string> emp=new Dictionary<int,string>;

    emp.Add (101, 'ABC');emp.Add (104, 'XYZ');emp.Add (102, 'LKK');emp.Add (103, 'DEF');

    now you can apply Linq like 

    var employee=emp.Where(x=> x==101);

    for EF you can create separate test database to connect. 

    Wednesday, February 12, 2014 2:47 PM