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

  • Home
  • SEARCH
  • 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 1087633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:57:53+00:00 2026-05-16T22:57:53+00:00

I am working on an application which would take an XHTML. <documents> <document> <span

  • 0

I am working on an application which would take an XHTML.

<documents>
<document>
    <span class="style1"> This is some text1 </span>
    <span class="style2"> This is some text2 </span>
    <span class="style3"> This is some text2 </span>
</document>
</documents>

The values for class attribute are basically styles. Those styles are mapped to certain actions in database. The actions tells my application what to do with those span tags when my application sees those styles.

Style – Action – ReplaceText

Style1 – Remove – NULL

Style2 – Keep – NULL

Style3 – Replace – H1

The application has the following output :-

<documents>
<document>
     This is some text1 
    <span class="style2"> This is some text2 </span>
    <h1> This is some text2 </h1>
</document>
</documents>

Following is kinda pseudocode I am thinking of:-

foreach(XmlNode documentNode in documentNodes)
{
    XmlNode[] spanNodes =documentNode.SelectNodes("//span") ;
 foreach(XmlNode spanNode in spanNodes)
 {
  if(spanNode .Attributes["class"]!=null && !string.IsNullOrEmpty(spanNode .Attributes["class"].value)))
  {
   string styleName = spanNode.Attributes["class"].value;
   string styleActionMapping =  GetActionMappingForStyle (styleName);
   switch (styleActionMapping)
   {

    case StyleActionMapping.Remove
                            RemoveSpanNode(spanNode);
    break;
    case StyleActionMapping.ReplaceWith
                            ReplaceSpanNode(spanNode);
    break;
    case StyleActionMapping.Keep
    break;

   }

  }
 }
}

The input could be quite more complex than what I showed above and the application could be very prone to bugs. S, I wanted to use unit testing so that when one makes any changes to the app, i can run the unit tests and be confident of them being working still. So, I wanted to have a simple table like this with pre-populated data:-


Id – Scenario – Input – ExpectedOutput

and I want to test with my app code with this unit testing data using Visual studio.NET 2010. Could anybody provide me directions on this.

Sorry for this long question. I am a newbie in unit testing and I just wanted to be as much clear as possible. Feel free to ask questions.

  • 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-16T22:57:53+00:00Added an answer on May 16, 2026 at 10:57 pm

    I’m assuming the final part of the post is really the question: how to write data-driven tests in .NET.

    I like having simple files which are embedded into the unit test assembly (Build action: embedded resource). You can then use Assembly.GetManifestResourceStream to fetch the data. Sometimes I’ll have one file for input and one for output; in other cases I can have one single file which contains multiple inputs and outputs. That would certainly be doable for XML:

    <tests>
      <test id="FooBar">
         <input>
           ...
         </input>
         <expected-output>
           ...
         </expected-output>
      </test>
    <tests>
    

    Then you could just load a single document, then fetch the input and output for a single test; transform it into a standalone document if necessary, then pass it to your production code, and finally compare the output. Admittedly comparing the output can be tricky – it will depend on things like white space compression… but it’s usually doable.

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

Sidebar

Related Questions

I am working on an application which draws a simple dot grid. I would
I'm working on an application that displays some child windows which can either be
I'm currently working on desktop application which calls third party API. After authorizing against
I'm working profesionally on a php web application which contains contacts, among other data.
I'm working on a .Net application which uses Asp.net 3.5 and Lucene.Net I am
I am working on a WPF application which has a treeview that represents an
I'm working on an asp.net application which uses Lucene.net I need to highlight the
Currently i am working on a desktop application which consists mathematical analysiss.I am using
I am working on a web-application in which dynamically-created images are used to display
I am working on a web application in Java which gets data from servlets

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.