Unit Test this - Simple method but don't know what's to test!
Posted
by user309705
on Stack Overflow
See other posts from Stack Overflow
or by user309705
Published on 2010-04-06T04:17:01Z
Indexed on
2010/04/06
4:23 UTC
Read the original article
Hit count: 203
unit-testing
|rhino-mocks
a very simple method, but don't know what's to test!
I'd like to test this method in Business Logic Layer, and the _dataAccess apparently is from data layer.
public DataSet GetLinksByAnalysisId(int analysisId)
{
DataSet result = new DataSet();
result = _dataAccess.SelectAnalysisLinksOverviewByAnalysisId(analysisId);
return result;
}
All Im testing really is to test _dataAccess.SelectAnalysisLinksOverviewByAnalysisId() is get called!
here's my test code (using Rhino mock)
[TestMethod]
public void Test()
{
var _dataAccess = MockRepository.GenerateMock<IDataAccess>();
_dataAccess.Expect(x => x.SelectAnalysisLinksOverviewByAnalysisId(_settings.UserName, 0, out dateExecuted));
var analysisBusinessLogic = new AnalysisLinksBusinessLogic(_dataAccess);
analysisBusinessLogic.GetLinksByAnalysisId(_settings, 0);
_dataAccess.VerifyAllExpectations();
}
Let me know if you writing the test for this method what would you test against?
Many Thanks!
© Stack Overflow or respective owner