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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:32:02+00:00 2026-05-27T01:32:02+00:00

I am implementing a data store access classes for my WP7.1 application. The general

  • 0

I am implementing a data store access classes for my WP7.1 application.

The general structure of inheritance of classes is the following:

IDataStore – interface that declears logical operations that the application doaim classes use.

abstract class XmlDataStore implements the requesired by the interface functionality via XElement routines, but leaves the base data store configuration to the successor classes.

The abstract methods in XmlDataStore are:

public abstract void CreateDataStore();

public abstract void OpenDataStore();

public abstract void SaveChanges();

Also, an abstract class contains the const strings definitions thare used by successors:

protected const string xmlRoot = "Data";
protected const string booksRoot = "Records";
protected const string settingsRoot = "Settings";

There are two successors to XmlDataStore: IsolatedStorageDataStore and InMemoryDataStore.

The later was created for test purposes, so I can test the correcness of the xml-manipulation routines implemented in abstract XmlDataStore.

I have added a Windows Phone Class Library to my solution. References NUnit via NuGet and have implemented one [TestFixture]:

[TestFixture]
public class XmlDataStoreTest
{
        private IDataStore _store;

        public XmlBookProgressStoreTest()
        {
            _store = new InMemoryXmlDataStore();
        }

        [Test]
        public void TestRegisterBookView()
        {
            _store.RegisterBookView(BookId, "TestBook");
        }
}

An InMemoryDataStore currently is the following class:

public class InMemoryDataStore : XmlDataStore
    {
        private XDocument _inMemDoc;

        public InMemoryDataStore()
        {
            CreateDataStore();
            OpenDataStore();
        }

        public override void CreateDataStore()
        {
            try
            {
                var root = new XElement(xmlRoot);
                root.Add(new XElement(booksRoot));
                root.Add(new XElement(settingsRoot));

                _inMemDoc = new XDocument(root);
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }

        public override void OpenDataStore()
        {
            _deusBookDataFile = _inMemDoc;
        }

        public override void SaveChanges()
        {}
    }
}

Now, when I debug this class in a simple application debug, the InMemoryDataStore instanciates fine, but when I debug my unit test, I get a DivideByZeroExceptionin this line of code: var root = new XElement(xmlRoot);

Clearly the problem only happens in unit test execution so it must be somehow connected to it. Why is the exception there and how can I fix it?

  • 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-27T01:32:02+00:00Added an answer on May 27, 2026 at 1:32 am

    As of now, this is a common problem. For Unit Testing Silverlight apps one should currently use Silverlight Testing Framework and see the results of the tests on the device’s screen.

    Things should change with the release of NUnit 3 which is to feature a Silverlight support.

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

Sidebar

Related Questions

I'm currently implementing a very complex tree structure to allow for near-instant data access,
I am about to start implementing the data access infrastructure of a project that
I have a factory class that populates objects with data. I want to implementing
I am implementing a python application that will connect to our different servers and
My MVC3 application is using an SQL Server 2008 to store data. In particular
I want to store confidential data in a digitally signed file, so that I
I've implemented a data access layer that populates generic entities from a datareader using
I am trying to re-design a data access layer that was originally built using
I'm implementing some classes to handle the common data structures (Tree, BinaryTree, Search Binary
I have a requirement for implementing a data-store. Basically, I just need to be

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.