Programming Index Cards

August 3, 2008

Test Driven Development Using NUnit in C#

Filed under: Unit Testing, c#, programming — apcig @ 3:56 pm

Read the full article

Test Driven Development emphasizes the … need to prepare test scenarios or test cases before writing the code itself… It requires that the programmer be very clear about what tests the program should pass and what test it should fail, bringing such concerns to the forefront of the software design process… An automated job is one that’s always very, very easy to do. These automated tests are meant to be run every time there’s a code change and are referred to as unit tests.

Unit testing with NUnit is useful for testing class libraries that makeup an ASP.NET application, but is not designed to test the UI portions of an ASP.NET application. There is, however, an additional free tool, NUnitAsp, that is designed to provide unit testing for the GUI portion of a Web application.

July 29, 2008

Abstract Class versus Interface

Filed under: OOP, c# — apcig @ 3:52 am

Abstract Class
An abstract class is a special kind of class that cannot be instantiated…
An abstract class is only to be sub-classed/inherited from…
Core identity/objects of same/similar type
Can have fields and constants defined

public abstract class Employee {
...
}

Interface
An entity that … has no implementation; it only has the signature, just the definition of the methods without the body.
Peripheral abilities/IMovable inherited by Human and Vehicle
If implementations, only share method signatures
No fields can be defined

public interface IEmployee {
...
}

Source

June 26, 2008

Accessibility Modifiers

Filed under: OOP, c#, programming — apcig @ 7:36 pm

public
- Access is not restricted.
- Allows the members to be globally accessible.

protected
- Access is limited to the containing class or types derived from the containing class.

internal
- Access is limited to the current assembly.
- Internal members are accessible only within files in the same assembly.

protected internal
- Access is limited to the current assembly or types derived from the containing class.

private
- Access is limited to the containing type.


sealed
- prevents inheritance

Sources: Accessibility Levels (MSDN), Difference between internal and private

Blog at WordPress.com.