---
title: "Poll: Do you use NUnit’s fluent API?"
url: "https://osherove.com/blog/2010/1/11/poll-do-you-use-nunits-fluent-api.md"
canonical: "https://osherove.com/blog/2010/1/11/poll-do-you-use-nunits-fluent-api.html"
published: "2010-01-11T16:39:02"
updated: "2010-01-11T16:39:02"
tags: [".NET", "Agile"]
author: "Roy Osherove"
description: "if you use NUnit, did you know it has a fluent API option? Do you use it? you can write the following: Assert.That( someString, Is.Not.Null .And.Not.Empty .And.EqualTo(\"foo\") .And.Not.EqualTo(\"bar\")…"
usage: "Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page)."
license: "https://creativecommons.org/licenses/by/4.0/"
---

# Poll: Do you use NUnit’s fluent API?

By Roy Osherove January 11, 2010 In [.NET](https://osherove.com/blog/category/net), [Agile](https://osherove.com/blog/category/agile)

**Historical article** · Originally published January 11, 2010; technical details may be outdated.

if you use NUnit, did you know it has a fluent API option? Do you use it?

you can write the following:

Assert.That( someString,
      Is.Not.Null

      .And.Not.Empty
      .And.EqualTo("foo")
      .And.Not.EqualTo("bar")
      .And.StartsWith("f"));

Assert.That(someEnumerable,
    Has.Count.EqualTo(2),
    .And.Contains.Some.Matches(x => x.FirstName == "Jim")
    .And.Contains.None.Matches(x => x.LastName == "Jones"));

Assert.That( x => <some code>,

    Throws.TypeOf<ArgumentException>().With.Message.EqualTo("Too Bad!");

## More in .NET

[All posts in .NET](https://osherove.com/blog/category/net)

- Jan 14, 2010

    ### [The difference between continuous Integration tools and automated build tools](https://osherove.com/blog/2010/1/14/the-difference-between-continuous-integration-tools-and-auto.html)

- Jan 12, 2010

    ### [Unit Testing Biztalk : Two possible frameworks](https://osherove.com/blog/2010/1/12/unit-testing-biztalk-two-possible-frameworks.html)

- Jan 6, 2010

    ### [TDD: 4 questions that will help you create the simplest thing that could possibly work](https://osherove.com/blog/2010/1/6/tdd-4-questions-that-will-help-you-create-the-simplest-thing.html)

- Jan 3, 2010

    ### [Oslo TDD Course – First day canceled](https://osherove.com/blog/2010/1/3/oslo-tdd-course-first-day-canceled.html)


---

## About the author

**Roy Osherove**: Senior Solutions Architect at AWS working on AI for production and AI-driven development; author of The Art of Unit Testing and Elastic Leadership, with about 20 years of consulting and training on unit testing, TDD, team leadership and continuous delivery.

### Sites

- [RobotPaper](https://robotpaper.ai/): This blog: AI patterns and anti-patterns, AI and coding agents, and engineering leadership.
- [osherove.com](https://osherove.com): Roy's personal site. Author of The Art of Unit Testing and Elastic Leadership; consulting and training on unit testing, TDD, team leadership and continuous delivery, plus about 20 years of blog posts.
- [The Art of Unit Testing](https://www.artofunittesting.com): The Art of Unit Testing, 3rd Edition (Manning): readable, maintainable, trustworthy unit tests, plus TDD workshops in C#, JavaScript, Java and Kotlin.
- [5whys.com](https://www.5whys.com): Roy's writing on software team leadership: self-organizing teams, surviving chaos, learning mode and the Elastic Leadership model.
- [Pipeline Driven](https://pipelinedriven.org): Continuous delivery and DevOps practices: build patterns, pipeline-friendly testing, DevOps metrics and enterprise DevOps.
- [Elastic Leadership](https://www.elasticleadership.com): Elastic Leadership, Roy's framework for software team leaders (survival, learning and self-organizing modes).

### Social

- X: https://x.com/royosherove
- LinkedIn: https://www.linkedin.com/in/osherove/

### Contact

- Contact form: https://forms.gle/jQSx5KoXvrVA1JCK7

### License

Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page). License: https://creativecommons.org/licenses/by/4.0/
