Sunday, September 09, 2012

Do your unit testing with Rhino Mocks

Mock object can be used with .NET framework and utilize in all kinds of .net unit testing, Normally real object call is slow because of lots other dependency like libraries, db etc.
also if real object is not 100% ready. In all that scenario Rhino Mocks framework can be used.

For functional testing you have to have real object ready and for unit testing Rhino Mock is the best and quick  solution.

Using rhino mock you can simply create mock object and from the caller method you can call mock object instead of calling real object.

to know more about Rhino Mock you can refer following links

Do your unit testing with Rhino Mocks

Mock object can be used with .NET framework and utilize in all kinds of .net unit testing, Normally real object call is slow because of lots other dependency like libraries, db etc.
also if real object is not 100% ready. In all that scenario Rhino Mocks framework can be used.

For functional testing you have to have real object ready and for unit testing Rhino Mock is the best and quick  solution.

Using rhino mock you can simply create mock object and from the caller method you can call mock object instead of calling real object.

to know more about Rhino Mock you can refer following links



Do your unit testing with Rhino Mocks

Mock object can be used with .NET framework and utilize in all kinds of .net unit testing, Normally real object call is slow because of lots other dependency like libraries, db etc.
also if real object is not 100% ready. In all that scenario Rhino Mocks framework can be used.

For functional testing you have to have real object ready and for unit testing Rhino Mock is the best and quick  solution.

Using rhino mock you can simply create mock object and from the caller method you can call mock object instead of calling real object.

to know more about Rhino Mock you can refer following links



Saturday, September 01, 2012

How to write data into the Excel 2010 using C#.Net


How to write data into the Excel 2010 using C#.Net
You can use .Net library to export or write data into the excel 2010 and above, below the code to do the same using C#.NET
Add Reference
Goto .NET tab and addMicrosoft.Office.Interop.Excel” reference in your project
NameSpace
using Excel = Microsoft.Office.Interop.Excel;
C#.Net Source Code
var exApp = new Excel.Application();

// Make the Excel file visible.
exApp.Visible = true; 
//Add one sheet into
exApp.Workbooks.Add(); 
// use only one workSheet.
Excel._Worksheet workSheet = exApp.ActiveSheet;
// column headings in cells A1 and B1.
workSheet.Cells[1, "A"] = "ID";
workSheet.Cells[1, "B"] = "Description";
var row = 1;
for (int i = 0; i <= 10; i++)
{
   row++;
   workSheet.Cells[row, "A"] = "Id_" + i;
   workSheet.Cells[row, "B"] = "Description " + i;
} 
workSheet.Columns[1].AutoFit();
workSheet.Columns[2].AutoFit();
// Call to AutoFormat
workSheet.Range["A1", "B3"].AutoFormat(Excel.XlRangeAutoFormat.xlRangeAutoFormatClassic2);
//Copy into the range
workSheet.Range["A1:B3"].Copy();