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 6242821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:01:34+00:00 2026-05-24T12:01:34+00:00

I have a method that calculates intraclass correlation based off a datatable of values.

  • 0

I have a method that calculates intraclass correlation based off a datatable of values. I wanted to write a unit test for this method that would read in the results from a CSV file and pass the datatable to the method I’ve written. I thought I could use the DataSourceAttribute on the method to pass in the entire dataset, but I guess using this method only passes in one row at a time.

[TestMethod()]
    [DeploymentItem("IntraclassCorrelationValues.csv")]
    [DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "|DataDirectory|\\IntraclassCorrelationValues.csv", "IntraclassCorrelationValues#csv", Microsoft.VisualStudio.TestTools.UnitTesting.DataAccessMethod.Sequential)]
    public void TestCorrelation() {}

Is there another method or attribute that will pass in the entire dataset instead of row by row to a test method or am I stuck writing code to read each line and build the datatable myself?

  • 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-24T12:01:35+00:00Added an answer on May 24, 2026 at 12:01 pm

    Note that the DataSource and DeploymentItem attributes for TestMethod are provided for the purposes of running multiple tests under a single test method. This can be compared to data driven tests, or parameterized tests. The idea is to allow you to specify multiple sets of parameters, each set for a single test run. For this reason, your test is reading in one row at a time, as it is designed to run one test per row.

    If the input to ‘each test run’ is instead a table or rows, and not just one row, I can see that you could flatten a table to one row and then expand it again in the test (this is simply one option, allowing you to devise the custom flatten/expand code). I can think of other options, but I suppose it depends on your goals. If you need the input to the test to be easily changed without rebuilding the tests, then this data driven model is best. If you simply want to drive the test with a table of data (that won’t change in the future runs of the test), then consider something more static, hard coded in with the test. Besides, that could make the test more readable. You can always write code to fake the source later.

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

Sidebar

Related Questions

I have a ticket model which has a method inside called closes_in that calculates
I have a method that calculates the time offset between the user's time and
Let's have a method that would cache results it calculates. If approach : def
I have following method that that calculates distance and returns it in miles: public
I have a method that takes 3 double s and calculates the roots via
Write a program that calculates Euler’s number e. To do this, first write a
I have the following method that calculates the top 20 numbers in a list
I have a long piece of code that calculates two values ( doubles )
I have a method , that calculates distance between two xyz cords, and return
I have class method that returns a list of employees that I can iterate

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.