Interview Q&A

Master technical and career interviews with structured answers—short definition, real examples, pitfalls, and how to answer in 60–90 seconds.

4608 total questions 4508 technical 100 career & HR 4272 from PDF library

Showing 4501–4525 of 4608

Career & HR topics

By tech stack

Popular tracks

Mid PDF
How do you handle dependencies in unit testing?

Short answer: Use mocking or stubbing frameworks (e.g., Moq, NSubstitute) to replace real dependencies with controlled test doubles, allowing tests to focus on the unit under test. Say this in the interview Define — one…

Testing Read answer
Mid PDF
What are the benefits of automated unit testing?

Short answer: Fast feedback on code changes. Detect regressions early. Supports continuous integration and delivery. Improves code quality and confidence. Enables safer refactoring. Real-world example (ShopNest) ShopNest…

Testing Read answer
Mid PDF
How do you run unit tests in Visual Studio?

Short answer: Use Test Explorer to discover and run tests. Tests can be run individually or in bulk. Use keyboard shortcuts (e.g., Ctrl+R, A to run all tests). Integrate with CI pipelines for automated test runs. Say thi…

Testing Read answer
Junior PDF
What is the role of assertions in unit testing?

Short answer: Assertions verify that the actual outcome of a test matches the expected result, determining if a test passes or fails. Real-world example (ShopNest) Arrange a cart with 2 items → Act Checkout() → Assert to…

Testing Read answer
Junior PDF
What is code coverage and how useful is it?

Short answer: Code coverage measures the percentage of code executed by tests. It helps identify untested parts but doesn’t guarantee test quality. High coverage with meaningful tests improves confidence in code correctn…

Testing Read answer
Junior PDF
What is xUnit and why is it popular in .NET testing?

Short answer: xUnit is a free, open-source unit testing framework for .NET, designed by the original authors of NUnit. It’s popular because it supports modern testing practices, is lightweight, extensible, integrates wel…

Testing Read answer
Mid PDF
How does xUnit differ from NUnit and MSTest?

Short answer: xUnit encourages constructor injection for setup instead of [SetUp] methods. It uses [Fact] and [Theory] attributes for test methods, while NUnit/MSTest use [Test] and [TestMethod]. xUnit does not use [Test…

Testing Read answer
Junior PDF
How do you write a basic test case using xUnit?

Short answer: public class CalculatorTests { [Fact] public void Add_ReturnsSum() { var calculator = new Calculator(); var result = calculator.Add(2, 3); Assert.Equal(5, result); } } Example code public class CalculatorTe…

Testing Read answer
Mid PDF
What are [Fact] and [Theory] attributes in xUnit?

Short answer: [Fact]: Defines a parameterless test method representing a single test case. [Theory]: Defines a parameterized test that runs multiple times with different data inputs, provided by [InlineData] or other dat…

Testing Read answer
Mid PDF
How do you pass parameters to tests in xUnit?

Short answer: Using [Theory] and data attributes like [InlineData]: [Theory] [InlineData(2, 3, 5)] [InlineData(10, 20, 30)] public void Add_ReturnsSum(int a, int b, int expected) { var calculator = new Calculator(); var…

Testing Read answer
Mid PDF
How do you handle setup and teardown in xUnit tests?

Short answer: Use the constructor for setup code. Implement IDisposable interface for teardown (cleanup) code. Example: public class DatabaseTests : IDisposable Example code { public DatabaseTests() { // Setup } [Fact] p…

Testing Read answer
Mid PDF
How do you skip or ignore tests in xUnit?

Short answer: Use the Skip property on [Fact] or [Theory]: [Fact(Skip = "Reason for skipping")] public void SkippedTest() { } Real-world example (ShopNest) ShopNest unit tests cover pricing and discount rules s…

Testing Read answer
Mid PDF
How do you organize test classes and test collections in xUnit?

Short answer: Group related tests in the same class. Use Collection attribute to group classes that share setup/teardown or should not run in parallel. [Collection("Database collection")] public class TestClass…

Testing Read answer
Mid PDF
Can you explain the concept of test fixtures in xUnit?

Short answer: Test fixtures provide a way to share setup and cleanup code between tests. xUnit supports: Class Fixtures: Shared across all tests in a class. Collection Fixtures: Shared across multiple test classes. They…

Testing Read answer
Mid PDF
How do you run xUnit tests from the command line?

Short answer: Use the dotnet test CLI command: dotnet test YourTestProject.csproj This runs all tests in the project and outputs results in the console. Additional options allow filtering and outputting reports. NUnit Fr…

Testing Read answer
Junior PDF
What is NUnit and how does it work in .NET testing?

Short answer: NUnit is a popular open-source unit testing framework for .NET. It allows developers to write and run automated tests by marking test methods with attributes. NUnit discovers and executes these tests, verif…

Testing Read answer
Mid PDF
How do NUnit test attributes differ from xUnit’s?

Short answer: NUnit uses [Test] for test methods, whereas xUnit uses [Fact]. NUnit uses [SetUp] and [TearDown] for setup and cleanup, while xUnit uses constructors and IDisposable. NUnit supports [TestCase] for parameter…

Testing Read answer
Mid PDF
How do you write parameterized tests in NUnit?

Short answer: [TestCase(2, 3, 5)] [TestCase(10, 20, 30)] public void Add_ReturnsSum(int a, int b, int expected) Example code { var calculator = new Calculator(); var result = calculator.Add(a, b); Assert.AreEqual(expecte…

Testing Read answer
Junior PDF
What is the purpose of the [SetUp] and [TearDown] attributes?

Short answer: [SetUp] runs code before each test method to prepare test environment. [TearDown] runs code after each test to clean up resources or reset state. Real-world example (ShopNest) ShopNest unit tests cover pric…

Testing Read answer
Mid PDF
How do you assert exceptions in NUnit?

Short answer: [Test] public void Divide_ByZero_ThrowsException() Example code { var calculator = new Calculator(); Assert.Throws<DivideByZeroException>(() => calculator.Divide(10, 0)); } Real-world example (Shop…

Testing Read answer
Mid PDF
How do you categorize tests in NUnit?

Short answer: Use the [Category("CategoryName")] attribute to group tests, allowing filtering by category during test runs. [Test, Category("Integration")] public void IntegrationTest() { } Real-world…

Testing Read answer
Junior PDF
What is the difference between [Test] and [TestCase] in NUnit?

Short answer: [Test] marks a standard test method without parameters. [TestCase] provides inline parameter values to run the test multiple times with different inputs. Real-world example (ShopNest) ShopNest unit tests co…

Testing Read answer
Mid PDF
How do you ignore tests conditionally in NUnit?

Short answer: Use [Ignore("Reason")] to skip tests unconditionally, or [Category] combined with test runner filters. For conditional ignoring, you can use Assume statements or custom logic inside tests. Real-wo…

Testing Read answer
Mid PDF
How do you run NUnit tests using the NUnit console runner?

Short answer: Download and use nunit3-console.exe from NUnit site: nunit3-console.exe YourTestAssembly.dll It runs all tests in the assembly and outputs results. Real-world example (ShopNest) ShopNest unit tests cover pr…

Testing Read answer
Mid PDF
Can NUnit tests be integrated with CI/CD pipelines?

Short answer: Yes, NUnit integrates seamlessly with CI/CD tools like Azure DevOps, Jenkins, GitHub Actions, and others using command-line runners or plugins, allowing automated test execution during builds and deployment…

Testing Read answer

Unit Testing C# Programming Tutorial · Testing

Short answer: Use mocking or stubbing frameworks (e.g., Moq, NSubstitute) to replace real dependencies with controlled test doubles, allowing tests to focus on the unit under test.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Unit Testing C# Programming Tutorial · Testing

Short answer: Fast feedback on code changes. Detect regressions early. Supports continuous integration and delivery. Improves code quality and confidence. Enables safer refactoring.

Real-world example (ShopNest)

ShopNest unit tests cover pricing and discount rules so a bad coupon change fails in CI before customers see it.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Unit Testing C# Programming Tutorial · Testing

Short answer: Use Test Explorer to discover and run tests. Tests can be run individually or in bulk. Use keyboard shortcuts (e.g., Ctrl+R, A to run all tests). Integrate with CI pipelines for automated test runs.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Unit Testing C# Programming Tutorial · Testing

Short answer: Assertions verify that the actual outcome of a test matches the expected result, determining if a test passes or fails.

Real-world example (ShopNest)

Arrange a cart with 2 items → Act Checkout() → Assert total and that payment was called once.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Unit Testing C# Programming Tutorial · Testing

Short answer: Code coverage measures the percentage of code executed by tests. It helps identify untested parts but doesn’t guarantee test quality. High coverage with meaningful tests improves confidence in code correctness. xUnit Framework

Real-world example (ShopNest)

ShopNest unit tests cover pricing and discount rules so a bad coupon change fails in CI before customers see it.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Unit Testing C# Programming Tutorial · Testing

Short answer: xUnit is a free, open-source unit testing framework for .NET, designed by the original authors of NUnit. It’s popular because it supports modern testing practices, is lightweight, extensible, integrates well with .NET Core and Visual Studio, and encourages clean, maintainable test code.

Real-world example (ShopNest)

ShopNest unit tests cover pricing and discount rules so a bad coupon change fails in CI before customers see it.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Unit Testing C# Programming Tutorial · Testing

Short answer: xUnit encourages constructor injection for setup instead of [SetUp] methods. It uses [Fact] and [Theory] attributes for test methods, while NUnit/MSTest use [Test] and [TestMethod]. xUnit does not use [TestInitialize]/[TestCleanup] but favors class fixtures and constructor/dispose patterns. xUnit is better integrated with .NET Core and supports parallel test execution by default.

Real-world example (ShopNest)

ShopNest unit tests cover pricing and discount rules so a bad coupon change fails in CI before customers see it.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Unit Testing C# Programming Tutorial · Testing

Short answer: public class CalculatorTests { [Fact] public void Add_ReturnsSum() { var calculator = new Calculator(); var result = calculator.Add(2, 3); Assert.Equal(5, result); } }

Example code

public class CalculatorTests
{ [Fact] public void Add_ReturnsSum()
{
var calculator = new Calculator();
var result = calculator.Add(2, 3); Assert.Equal(5, result); }
}

Real-world example (ShopNest)

ShopNest unit tests cover pricing and discount rules so a bad coupon change fails in CI before customers see it.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Unit Testing C# Programming Tutorial · Testing

Short answer: [Fact]: Defines a parameterless test method representing a single test case. [Theory]: Defines a parameterized test that runs multiple times with different data inputs, provided by [InlineData] or other data sources.

Real-world example (ShopNest)

Arrange a cart with 2 items → Act Checkout() → Assert total and that payment was called once.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Unit Testing C# Programming Tutorial · Testing

Short answer: Using [Theory] and data attributes like [InlineData]: [Theory] [InlineData(2, 3, 5)] [InlineData(10, 20, 30)] public void Add_ReturnsSum(int a, int b, int expected) { var calculator = new Calculator(); var result = calculator.Add(a, b); Assert.Equal(expected, result); }

Example code

Using [Theory] and data attributes like [InlineData]: [Theory] [InlineData(2, 3, 5)] [InlineData(10, 20, 30)] public void Add_ReturnsSum(int a, int b, int expected)
{
var calculator = new Calculator();
var result = calculator.Add(a, b); Assert.Equal(expected, result); }

Real-world example (ShopNest)

ShopNest unit tests cover pricing and discount rules so a bad coupon change fails in CI before customers see it.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Unit Testing C# Programming Tutorial · Testing

Short answer: Use the constructor for setup code. Implement IDisposable interface for teardown (cleanup) code. Example: public class DatabaseTests : IDisposable

Example code

{
public DatabaseTests()
{ // Setup } [Fact] public void TestMethod() { }
public void Dispose()
{ // Cleanup }
}
For shared context across multiple tests, use class fixtures or collection fixtures.

Real-world example (ShopNest)

ShopNest unit tests cover pricing and discount rules so a bad coupon change fails in CI before customers see it.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Unit Testing C# Programming Tutorial · Testing

Short answer: Use the Skip property on [Fact] or [Theory]: [Fact(Skip = "Reason for skipping")] public void SkippedTest() { }

Real-world example (ShopNest)

ShopNest unit tests cover pricing and discount rules so a bad coupon change fails in CI before customers see it.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Unit Testing C# Programming Tutorial · Testing

Short answer: Group related tests in the same class. Use Collection attribute to group classes that share setup/teardown or should not run in parallel. [Collection("Database collection")] public class TestClass1 { } [Collection("Database collection")] public class TestClass2 { }

Real-world example (ShopNest)

ShopNest unit tests cover pricing and discount rules so a bad coupon change fails in CI before customers see it.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Unit Testing C# Programming Tutorial · Testing

Short answer: Test fixtures provide a way to share setup and cleanup code between tests. xUnit supports: Class Fixtures: Shared across all tests in a class. Collection Fixtures: Shared across multiple test classes. They are implemented by creating a fixture class and injecting it into test classes via constructor.

Real-world example (ShopNest)

ShopNest unit tests cover pricing and discount rules so a bad coupon change fails in CI before customers see it.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Unit Testing C# Programming Tutorial · Testing

Short answer: Use the dotnet test CLI command: dotnet test YourTestProject.csproj This runs all tests in the project and outputs results in the console. Additional options allow filtering and outputting reports. NUnit Framework

Real-world example (ShopNest)

ShopNest unit tests cover pricing and discount rules so a bad coupon change fails in CI before customers see it.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Unit Testing C# Programming Tutorial · Testing

Short answer: NUnit is a popular open-source unit testing framework for .NET. It allows developers to write and run automated tests by marking test methods with attributes. NUnit discovers and executes these tests, verifying that the code behaves as expected.

Real-world example (ShopNest)

ShopNest unit tests cover pricing and discount rules so a bad coupon change fails in CI before customers see it.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Unit Testing C# Programming Tutorial · Testing

Short answer: NUnit uses [Test] for test methods, whereas xUnit uses [Fact]. NUnit uses [SetUp] and [TearDown] for setup and cleanup, while xUnit uses constructors and IDisposable. NUnit supports [TestCase] for parameterized tests, xUnit uses [Theory] with [InlineData]. NUnit has more built-in attributes like [Category] for grouping tests.

Real-world example (ShopNest)

ShopNest unit tests cover pricing and discount rules so a bad coupon change fails in CI before customers see it.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Unit Testing C# Programming Tutorial · Testing

Short answer: [TestCase(2, 3, 5)] [TestCase(10, 20, 30)] public void Add_ReturnsSum(int a, int b, int expected)

Example code

{
var calculator = new Calculator();
var result = calculator.Add(a, b); Assert.AreEqual(expected, result); }

Real-world example (ShopNest)

ShopNest unit tests cover pricing and discount rules so a bad coupon change fails in CI before customers see it.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Unit Testing C# Programming Tutorial · Testing

Short answer: [SetUp] runs code before each test method to prepare test environment. [TearDown] runs code after each test to clean up resources or reset state.

Real-world example (ShopNest)

ShopNest unit tests cover pricing and discount rules so a bad coupon change fails in CI before customers see it.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Unit Testing C# Programming Tutorial · Testing

Short answer: [Test] public void Divide_ByZero_ThrowsException()

Example code

{
var calculator = new Calculator(); Assert.Throws<DivideByZeroException>(() => calculator.Divide(10, 0)); }

Real-world example (ShopNest)

Arrange a cart with 2 items → Act Checkout() → Assert total and that payment was called once.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Unit Testing C# Programming Tutorial · Testing

Short answer: Use the [Category("CategoryName")] attribute to group tests, allowing filtering by category during test runs. [Test, Category("Integration")] public void IntegrationTest() { }

Real-world example (ShopNest)

ShopNest unit tests cover pricing and discount rules so a bad coupon change fails in CI before customers see it.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Unit Testing C# Programming Tutorial · Testing

Short answer: [Test] marks a standard test method without parameters. [TestCase] provides inline parameter values to run the test multiple times with different inputs.

Real-world example (ShopNest)

ShopNest unit tests cover pricing and discount rules so a bad coupon change fails in CI before customers see it.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Unit Testing C# Programming Tutorial · Testing

Short answer: Use [Ignore("Reason")] to skip tests unconditionally, or [Category] combined with test runner filters. For conditional ignoring, you can use Assume statements or custom logic inside tests.

Real-world example (ShopNest)

ShopNest unit tests cover pricing and discount rules so a bad coupon change fails in CI before customers see it.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Unit Testing C# Programming Tutorial · Testing

Short answer: Download and use nunit3-console.exe from NUnit site: nunit3-console.exe YourTestAssembly.dll It runs all tests in the assembly and outputs results.

Real-world example (ShopNest)

ShopNest unit tests cover pricing and discount rules so a bad coupon change fails in CI before customers see it.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share

Unit Testing C# Programming Tutorial · Testing

Short answer: Yes, NUnit integrates seamlessly with CI/CD tools like Azure DevOps, Jenkins, GitHub Actions, and others using command-line runners or plugins, allowing automated test execution during builds and deployments. MSTest Framework

Real-world example (ShopNest)

ShopNest unit tests cover pricing and discount rules so a bad coupon change fails in CI before customers see it.

Say this in the interview

  1. Define — one clear sentence (the short answer above).
  2. Example — relate it to a project like ShopNest or your real work.
  3. Trade-off — when you would not use it.
Permalink & share
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details