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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T04:52:57+00:00 2026-06-02T04:52:57+00:00

I’ve got a class that takes a string for the path to an xml

  • 0

I’ve got a class that takes a string for the path to an xml file and outputs an object. I want to test the class using NUnit with some pre generated test scripts.

I have the scripts in a zip file and included in the project. I want to do something like this:

// Not sure how to do this
List<byte[]> scripts = GetTheScriptsSomehow();

foreach(var script in scripts )
{
  var parsedScript = ScriptParser.Parse(script);
  Assert.AreEqual(parsedScript.Blah, "BLAH");
}

The part I’m most concerned with is how to access the scripts that are zipped and part of the project.

Thanks!

Edit: To address some of the comments, the zip file is part of a unit test project, not the released codebase. It contains test scripts that should produce a known output that is testable. They’re zipped because the scripts are rather large (100mb each)

  • 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-06-02T04:52:58+00:00Added an answer on June 2, 2026 at 4:52 am

    Add this zip file in resources (project properties / resources / Add Resource / Add existing file), and use SharpZipLib to extract it from zip, let’s say that your zip file is

    scripts.zip

    code to extract scripts in string :

    ZipInputStream zip = new ZipInputStream(new MemoryStream(Properties.Resources.scripts));
    while (zip.GetNextEntry() != null)
    {
      MemoryStream data = new MemoryStream();
      zip.CopyTo(data);
      data.Position = 0;
      string scriptContents = new StreamReader(data).ReadToEnd();
      /// do something with scriptContents variable
    }
    

    Here are some examples of SharpZipLib usage :

    http://wiki.sharpdevelop.net/SharpZipLib-Zip-Samples.ashx

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

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
i got an object with contents of html markup in it, for example: string
I want to count how many characters a certain string has in PHP, but
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
In my XML file chapters tag has more chapter tag.i need to display chapters
I am doing a simple coin flipping experiment for class that involves flipping a

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.