# Assumptions

Sometimes, unit tests can be relevant only when certain conditions are met. This is often the case with [parameterized tests](/unit-testing-csharp/nunit/parameterized-tests.md).

In these cases, mapping these conditions as assertions would mark as failed tests that simply received invalid data. To obviate this issue, NUnit offers the possibility to make *assumptions* on the incoming data. Unlike assertions, unmet assumptions make the runner mark the test as *Invalid* instead of *Failed*.

```csharp
[Test]
public void A_test_with_assumptions (
    [Values(2020, 2025, 2030)] int year,
    [Range(1, 12)] int month,
    [Range(1, 31)] int day)
{
    Assume.That(day, Is.LessOrEqualThan(DateTime.DaysInMonth(year, month)));

    ...
}
```

In the example above, test runs with invalid day/month/year combinations (like June 31st) are ignored.

Please note that assumptions make use of the `Assume` static class. `Assume.That` has the same set of overloads as `Assert.That`.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.educationsmediagroup.com/unit-testing-csharp/nunit/assumptions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
