Skip to content

Instantly share code, notes, and snippets.

@vkhorikov vkhorikov/1.cs
Last active Aug 22, 2019

Embed
What would you like to do?
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
You can’t perform that action at this time.