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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:24:52+00:00 2026-05-28T15:24:52+00:00

I am new to TDD and trying to solve a problem. In my task,

  • 0

I am new to TDD and trying to solve a problem.

In my task, I have to read a bunch of strings from console and add them to a list of string type. In my test method, I have written a for loop to read strings and passing to a method to add. I don’t know how to test this process, a bit confused. Any help will be appreciated. Thanks.

Loop in the test method.

   for(int i=0;i<robot.noOfCommands;i++)
        {
            robot.readCommand(Console.ReadLine());

        } 

I am writing code in C#.Net

  • 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-28T15:24:52+00:00Added an answer on May 28, 2026 at 3:24 pm

    Unit tests should never require human interaction, so using Console.ReadLine() is a major no-no.

    What you probably want, is to feed your robot object with some predefined input. Then you can test (Assert), that the outcome is what you expect. That is the essence of unit testing.

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

Sidebar

Related Questions

I'm really new in TDD and, actually, I'm trying to follow the sample from
I'm new to rails and am trying to give TDD a try. I have
I'm very new to TDD world. I have a few questions regarding TDD. Do
I'm trying out TDD on a greenfield hobby app in ASP.NET MVC, and have
I'm relatively new to TDD, and still trying to learn to apply some of
I am 'relatively new' to unit-testing and TDD. Only more recently have I completed
I have been trying to get more in to TDD. Currently keeping it simple
I am trying to learn and implement TDD specifically using Moq and I have
I am fairly new to TDD but have been using it for long enough
Building a new website at work and I'm trying to learn some TDD so

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.