Last active
November 8, 2018 16:06
-
-
Save osmyn/ddf9e2b14153a1c136edfa3dd531bf55 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//ASYNC | |
[TestMethod] | |
public void GetTypesByName_WhenNoNameProvided_ThrowsArgumentException() | |
{ | |
//Arrange | |
var builder = new TypeServiceBuilder(); | |
var service = builder.Build(); | |
//Act | |
Func<Task> call = async () => await service.GetTypesByName(null); | |
//Assert | |
call.Should().Throw<ArgumentException>(); | |
} | |
//REGULAR | |
[TestMethod] | |
public void AddTransaction_OnError_AccountUnlocks() | |
{ | |
//Arrange | |
var builder = new RepositoryBuilder(); | |
var context = builder.DefaultAccountDbContext(); | |
var transaction = GetTestableTransaction(context); | |
context.Setup(x => x.SaveChanges()) | |
.Throws(new UnitTestException("Unit test exception")); | |
var service = builder | |
.WithAccountDbContext(context.Object) | |
.Build(); | |
//Act | |
Action action = () => service.AddTransaction(transaction); | |
//Assert | |
action.Should().Throw<UnitTestException>(); | |
transaction.Account.Locked.Should().BeFalse(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment