I'm trying to retrieve some data but the service I'm trying to reach is behind a closed ip connection so i can't test my code from personal pc. I was told to add the database that service that I can't reach relays to.
I have added the Database, however now i also need to add the service so i can start testing this is where I get stuck all I was given was the following code for the service:
The database is included in the solution and it's working named: PUBS.MDF I now need to add the following service so i can reference it and then test my code.
[ServiceContract]
public interface IPubs
{
[OperationContract]
List<Publication> GetTopTitles();
[OperationContract]
List<Publication> GetTitles(string SearchString);
[OperationContract]
PublicationDetail GetPublicationDetails(string PubID);
}
[DataContract]
public class Publication
{
[DataMember]
public string PubID { get; set; }
[DataMember]
public string Title { get; set; }
}
[DataContract]
public class PublicationDetail
{
[DataMember]
public string PubID { get; set; }
[DataMember]
public string Title { get; set; }
[DataMember]
public List<string> Authors { get; set; }
[DataMember]
public string Description { get; set; }
[DataMember]
public string Publisher { get; set; }
[DataMember]
public DateTime PubDate { get; set; }
}
If you only have the code for IPubs and the database, you could write a Pubs class that implements IPubs, but you would be guessing how it works so it would not be a proper test.
I suggest you go back to the people that supplied the interface and database and ask for a copy of the service classes they have that implement IPubs. If they can't supply that you could ask them to define what inputs should produce what outputs, then create a mock service that you can test your client against.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.