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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:13:07+00:00 2026-06-06T00:13:07+00:00

I have this test [Test] public void SaveInventoryItemLoad_Will_Call_WCF_Service_SaveInventoryItemLoad() { adapter.SaveInventoryItemLoad(new List<InventoryItemLoadProxy>()); itemMasterBusinessClientMock.Verify(x => x.SaveInventoryItemLoad(It.IsAny<List<InventoryItemLoadProxy>>()),

  • 0

I have this test

[Test]
public void SaveInventoryItemLoad_Will_Call_WCF_Service_SaveInventoryItemLoad()
{ 
    adapter.SaveInventoryItemLoad(new List<InventoryItemLoadProxy>());
    itemMasterBusinessClientMock.Verify(x => x.SaveInventoryItemLoad(It.IsAny<List<InventoryItemLoadProxy>>()), Times.Once());
}

It was fine because I had tested on the WCF side the the method did what I wanted it to so all I needed was to say “Hey did you call the service? Yeah!”. Now though… I need to break up said list in to chucks of 10 or less i.e. a list of 23 items would be three lists of 10, 10 and then 3. So step one is of course to write a unit test to verify that I haven’t pushed more than ten items to the SaveInventoryItemLoad method. I can of course verify that method was called X amount of times but that isn’t what I want. I want to make sure that the list supplied to the method was <= 10 but I can’t seem to figure out how. I trolled the moq quickstart but don’t see how I would do that.

I though this would do it somehow

// Verify setter with an argument matcher
mock.VerifySet(foo => foo.Value = It.IsInRange(1, 5, Range.Inclusive));

But I can’t seem to make that work. I guess I have never run into this before. Anyone know how to do this?

Thanks

  • 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-06T00:13:08+00:00Added an answer on June 6, 2026 at 12:13 am

    Here is the code:

    itemMasterBusinessClientMock.Verify(x => x.SaveInventoryItemLoad(It.Is<List<InventoryItemLoadProxy>>(l=>l.Count < 100)), Times.Once());
    

    Here are few examples.

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

Sidebar

Related Questions

Say I have this test: [Test] public void SomeTest() { var message = new
I have this test [Fact] public void Get_if_item_is_not_in_cache_return_null_returns_true() { var repo = new Repository<IProduct>(
I have this unit test: public void testDeEscapeResponse() { final String[] inputs = new
I have this test in my test base: public void WorksWithAreaUsers() { using (new
I have this method: public void testJSNI2(){ String x = test; } I can
I have a test in C# that looks like this: public void CanLog() {
I have this test method: public void load(Class<? extends Object> className, XXXX) { Criteria
I have this unit test: [Test] public void ProcessDbFile_should_delete_file_if_it_exists_then_copy_new_file_to_same_location() { // used to create
I have the following test: [Test] public void VerifyThat_WhenInitializingTheLoggingInterceptionFacility_TheLoggingInterceptorIsAdded() { var kernel = new
I have this class: public class Test { public static void main(String[] args) {

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.