hi,
i'm very new to the world of .net..i have given a task to unit test the methods. some methods i did successfully..here is the method where i'm stuck..can u help me in unit testing the method.
Method goes some thing like the bellow.
public FreeTimeFrame[] GetAllAvailableAppointments(DateTime startDate, DateTime endDate) { FreeTimeFrame [] availableAppointments;
GlossyWebService.GlossyWebService service = new GlossyWebService.GlossyWebService(); service.Url = ServiceDetails.Url; AppointmentServiceRequestMessage appointmentServiceRequestMessage = new AppointmentServiceRequestMessage();
appointmentServiceRequestMessage.StartDate = startDate ; appointmentServiceRequestMessage.EndDate = endDate ;
AppointmentServiceResponseMessage appointmentServiceResponseMessage = service.GetAvailableAppointments(appointmentServiceRequestMessage);
//TODO refactor to proper error handeling of service errors. if (appointmentServiceResponseMessage.ServiceError.ToString() == "no service error") { availableAppointments = appointmentServiceResponseMessage.FreeTimeFrames; } else { throw ExceptionFactory.RaiseSystemException(new CustomException("Service error: ", appointmentServiceResponseMessage.ServiceError));
} return availableAppointments; }