Skip to content

Instantly share code, notes, and snippets.

@vkhorikov
Last active August 22, 2019 12:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vkhorikov/1fd737123e10dc60f163d24c95ffb84c to your computer and use it in GitHub Desktop.
Save vkhorikov/1fd737123e10dc60f163d24c95ffb84c to your computer and use it in GitHub Desktop.
You are naming your tests wrong
[MethodUnderTest]_[Scenario]_[ExpectedResult]
public void Delivery_with_a_past_date_is_invalid()
public class CalculatorTests
{
[Fact]
public void Sum_of_two_numbers()
{
double first = 10;
double second = 20;
var sut = new Calculator();
double result = sut.Sum(first, second);
Assert.Equal(30, result);
}
}
public void Sum_TwoNumbers_ReturnsSum()
public void Sum_of_two_numbers()
public void Sum_TwoNumbers_ReturnsSum()
[Fact]
public void IsDeliveryValid_InvalidDate_ReturnsFalse()
{
DeliveryService sut = new DeliveryService();
DateTime pastDate = DateTime.Now.AddDays(-1);
Delivery delivery = new Delivery
{
Date = pastDate
};
bool isValid = sut.IsDeliveryValid(delivery);
Assert.False(isValid);
}
public void Delivery_with_invalid_date_should_be_considered_invalid()
public void Delivery_with_past_date_should_be_considered_invalid()
public void Delivery_with_past_date_should_be_invalid()
public void Delivery_with_past_date_is_invalid()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment