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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:34:54+00:00 2026-05-18T01:34:54+00:00

this error is trown by the following TEST. If i test the DataLayer, the

  • 0

this error is trown by the following TEST. If i test the DataLayer, the database gets updated and everything works. however the mock keeps sending out this error. i have a similar test that does work with almost the exact code (on the InsertRPAData). the only diffrence i can see is that the XMLDataEntity is a diffrent entity in the test compared to the Verify but both of them use the barcode = 1 though.

this test needs to be worked on and the XMLDataEntity is just there to allow me to verefy the Test. also ignore the return for now.

[TestInitialize]
public void TestInitialize()
{
    _mockRepository = new Mock<IRPADataLayer>();

    UnityUtil.UnityContainer = new UnityContainer();

    UnityUtil.UnityContainer.RegisterInstance(typeof(IRPADataLayer), _mockRepository.Object);
}


[TestMethod]
public void TestDoSuppressions()
{
    //Arange
    var suppressiontest = new Suppression();

    //Import the XML File
    XElement newElement = XElement.Parse(get090XML());
    XDocument testdoc = new XDocument();
    testdoc.Add(newElement);
    String string2Stream = String.Concat("1");
    Stream reader = new MemoryStream(ASCIIEncoding.Default.GetBytes(string2Stream));
    RPADataEntity rpa = new RPADataEntity();
    XMLDataEntity test = new XMLDataEntity();
    test.barcode = 1;
    rpa.RPAID = 1;
    rpa.XMLData = testdoc;
    //Act
    Int32 success = suppressiontest.DoSuppressions(reader, rpa);

    //Assert
    _mockRepository.Verify(x => x.UploadPreprocData(rpa, test));
}

The method being called is this one.

   public Int32 DoSuppressions(Stream reader, RPADataEntity rpa)
   {
       XMLDataEntity test = new XMLDataEntity();
       test.barcode = 1;

       _IRPADataLayer.UploadPreprocData(rpa, test);

       return 1;
   }

and the interface is this

public interface IRPADataLayer
{
    void InsertPreProcData(PreProcDataEntity PreProcDataEntity);
    void InsertRpaData(RPADataEntity RPADataEntity);

    RPATypeEntity GetRPAType(String type);

    void UploadPreprocData(RPADataEntity rpa, XMLDataEntity xml);
}
  • 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-18T01:34:55+00:00Added an answer on May 18, 2026 at 1:34 am

    Your verify is expecting a certain instance of XMLDataEntity, (the one your instantiating in your test).

    However the method that is being tested creates it’s own XMLDataEntity and calls UploadPreprocData.

    So the verification fails because the method hasn’t been called with the expected instance of XMLDataEntity.

    Most mocking frameworks provide a way to to specify that the expected parameter can be of any instance, so that might be what your wanting here.

    Hope that helps.

    Edit:
    In Moq, verifying and excepting any parameter of a given type is done by using:

    It.IsAny<T>()
    

    Where T is the type of the expected instance.

    In your case this can be done like so:

    _mockRepository.Verify(x => x.UploadPreprocData(rpa, It.IsAny<XMLDataEntity>()));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting the following error thrown in a test of mine: unknown file: error:
This is the error that is thrown by our automated build suite on Windows
This has me thrown for a loop: $s = ERROR: 5 - [RecordN...blah blah
This error come in log. from='kutbi1@360degree/Smack' to='akash@360degree/Smack' type='error' id='hK1L6-5'> <si xmlns='http://jabber.org/protocol/si' id='jsi_191216212994140179' mime-type='image/png' profile='http://jabber.org/protocol/si/profile/file-transfer'>
this error is always fired, when i'm try to free my allocated struct the
Getting this error: 2009-09-03 12:44:02.307 xcodebuild[307:10b] warning: compiler 'com.apple.compilers.llvm.clang.1_0.analyzer' is based on missing compiler
Getting this error with jquery & jquery.form. Site has been live for awhile..upgraded to
Got this error on a big $_GET query in size ~9 000 symbols (they
Getting this error when try to add an item to my repositories/context: Collection has
Got this error message while trying to configure an entitydatasource in the designer: My

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.