public void ShouldThrowCodeContractViolationException() { //Arrange var notifier = new ExceptionNotifier(); //Act and assert Assert.Throws<CodeContractViolationException>(() => notifier.Notify(TestDataFactory.CreateViolationData())); }
public void ShouldThrowCodeContractViolationException() { //Arrange var notifier = new ExceptionNotifier(); //Act and assert Assert.Throws <CodeContractViolationException>(() => notifier.Notify(TestDataFactory.CreateViolationData())); }
public void ThrownExceptionShouldHaveValueFromData() { //Arrange const int expectedValue = 123456; var notifier = new ExceptionNotifier(); //Act var exception = Assert.Throws<CodeContractViolationException>(() => notifier.Notify(TestDataFactory.CreateViolationData(expectedValue))); //Assert Assert.Equal(expectedValue, exception.Value); }
public void ThrownExceptionShouldHaveNameFromData() { //Arrange const string expectedName = "VariableName"; var notifier = new ExceptionNotifier(); //Act var exception = Assert.Throws<CodeContractViolationException>(() => notifier.Notify(TestDataFactory.CreateViolationData(name: expectedName))); //Assert Assert.Equal(expectedName, exception.Name); }
public void ThrownExceptionShouldHaveMessageFromData() { //Arrange const string expectedErrorMessage = "ExpectedErrorMessage"; var notifier = new ExceptionNotifier(); //Act var exception = Assert.Throws<CodeContractViolationException>(() => notifier.Notify(TestDataFactory.CreateViolationData(errorMessage: expectedErrorMessage))); //Assert Assert.Equal(expectedErrorMessage, exception.Message); }
public void ThrownExceptionShouldHaveNameFromData() { //Arrange const string expectedName = "VariableName"; var notifier = new ExceptionNotifier(); //Act var exception = Assert.Throws <CodeContractViolationException>(() => notifier.Notify(TestDataFactory.CreateViolationData(name: expectedName))); //Assert Assert.Equal(expectedName, exception.Name); }
public void ThrownExceptionShouldHaveValueFromData() { //Arrange const int expectedValue = 123456; var notifier = new ExceptionNotifier(); //Act var exception = Assert.Throws <CodeContractViolationException>(() => notifier.Notify(TestDataFactory.CreateViolationData(expectedValue))); //Assert Assert.Equal(expectedValue, exception.Value); }
public void ThrownExceptionShouldHaveMessageFromData() { //Arrange const string expectedErrorMessage = "ExpectedErrorMessage"; var notifier = new ExceptionNotifier(); //Act var exception = Assert.Throws <CodeContractViolationException>(() => notifier.Notify(TestDataFactory.CreateViolationData(errorMessage: expectedErrorMessage))); //Assert Assert.Equal(expectedErrorMessage, exception.Message); }