Tutorial .NET : Dos Project – very short demo

Open the book.sln
solution and add a new project of type ConsoleApplication (name it  BookDos)

Add reference to the
BookObjects project and add an app.config file and write to this file the same
as in the corresponding app.config file from BookWin application.

The post build event
on project – properties must be the same as for the BookWin

copy
$(ProjectDir)..\BookData\*.mdb $(TargetDir)

 

In Program.cs file
please enter the following code:

using System;

using System.Collections.Generic;

using System.Text;

using BookObjects;

 

namespace BookDos

{

    class Program

    {

        static void Main(string[]
args)

        {

            ColPublisher
col = new ColPublisher();

            col.Load();

            Console.WriteLine(“Records Number:” + col.Count);

            foreach (Publisher p in col)

            {

                Console.WriteLine(p.Name);

            }

        }

    }

}

 

 

And, of course, the number
of records will be 0 – as we do not have any records.

In the following we will show how to
perform some automated tests with NUnit .

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *