GetData method gets the data from the database and then I assign the data to Package class hierarchy. I'm creating the instance of Package inside the method. So how Rhino will test such things. My question was not only for this method. In general it is very common we create instances of custom classes, .Net classes inside the method. (Basically local variables). In such case how do test the method using Rhino?
On Nov 9, 10:33 am, Patrick Steele <[email protected]> wrote: > What does GetData do? You probably need to stub that out, but without > knowing what it does, I can't say for sure. > > --- > Patrick Steelehttp://weblogs.asp.net/psteele > > > > > > > > On Wed, Nov 9, 2011 at 11:20 AM, Laksh <[email protected]> wrote: > > I have the following method. I'm creating a instance of Package class > > inside the method, setting some of its proeprties and then returning > > it. How do i unit test this method using Rhino? > > > public class Manifest : IManifest<Package> > > { > > private IContext _context = null; > > > publicManifest(IContext context) > > { > > > _context = context; > > } > > > public Package BuildManifest() > > { > > // Data object is class which holds the data from > > datasource. > > DataObject data = GetData(_context); > > > Package package = new Package(); > > package.BatchID = data.BatchId; > > package.Title = data.Title; > > package.Name = data.Name; > > package.City = data.City; > > > IList<PackageDocument> documents = new > > List<PackageDocument>(); > > foreach (Document document in data.ConvertedDocuments) > > { > > PackageDocument packageDocument = new > > PackageDocument(); > > packageDocument.FileName = document.DocumentName; > > packageDocument.PrintOrder = > > document.SequenceNumber.Value; > > packageDocument.PaperType = > > PackageDocumentPaperType.White; > > documents.Add(packageDocument); > > } > > package.Documents = documents.ToArray(); > > return package; > > } > > } > > > -- > > You received this message because you are subscribed to the Google Groups > > "Rhino.Mocks" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > For more options, visit this group > > athttp://groups.google.com/group/rhinomocks?hl=en. -- You received this message because you are subscribed to the Google Groups "Rhino.Mocks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rhinomocks?hl=en.
