Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4101256
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:40:24+00:00 2026-05-20T20:40:24+00:00

I have a WCF service that accesses the database and adds data to it.

  • 0

I have a WCF service that accesses the database and adds data to it.
now, I want to do some integration and/or system tests (automated).

How do I do it ?

I have to access the database, load initial data, call the service and then verify whether the data expected was actually loaded in the table.

is there any strategy for doing that you would recommend ?

I’m using WCF, Entity Framework, SQL Server, MSTests.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T20:40:25+00:00Added an answer on May 20, 2026 at 8:40 pm

    If you don’t mind your test project taking a dependency on Entity Framework then here’s how I would approach this.

    1. In the test project, create an EF model from the database, using only the table(s) you expect to be testing.
    2. Add a service reference to the WCF service from the test project.
    3. Create a test in the test project. In this test, use the EF context to create your initial test data.
    4. Call your service from the test.
    5. Check the database for the appropriate data, call your Assert(s).
    6. Clean up the database.

    You should also consider using a lightweight file-based/in-memory database such as SQLite for this task. One simple way of achieving this would be to use EF to generate a model from your DB, then use the Update Database From Model tool to generate the SQL that will create the appropriate tables and constraints in your SQLite instance. This means no risk of munting the data in your main/dev DB and potentially faster tests.

    Also regarding steps 3 and 6, some people would advocate using the setup/clean-up/tear-down affordance built in to MSTest. I generally don’t start using these until I can see them helping with reducing code duplication, because in my opinion they make tests less clear and readable, but that’s a personal thing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web application that accesses a database through a wcf service. The
I have a silverlight 2 beta 2 application that accesses a WCF web service.
I have a WCF service that uses basicHttpbinding in development. Now in product we
I have a WCF service that uses a System.ServiceModel.Syndication.SyndicationFeed to create an RSS feed.
We have a Data Access service in our SOA WCF system. This service is
I have a win forms client that accesses a wcf service for a long
I have a WCF service that processes some messages. I use EntityFramework to retrieve
I have a WCF service that returns a stream object. But for some reason
I have a WCF service that I have to reference from a .net 2.0
I have a WCF Service that should not enter the faulted state. If there's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.