Skip to content

Instantly share code, notes, and snippets.

@sdanna
Last active October 23, 2015 21:58
Show Gist options
  • Save sdanna/99586bcc7c07852698d6 to your computer and use it in GitHub Desktop.
Save sdanna/99586bcc7c07852698d6 to your computer and use it in GitHub Desktop.
using System.Linq;
using IntegrationTests.Fixtures;
using Xunit;
using Zomg.Features.Company;
namespace IntegrationTests.Features.Company
{
public class CreateHandlerTests
{
[Collection("IntegrationTests.Features.Company.CreateHandlerTests")]
public class TheHandleMethod : IClassFixture<DbFixture<CreateHandlerTests>>
{
private readonly DbFixture<CreateHandlerTests> _dbFixture;
private Create.Command _handledCommand;
private Create.CommandHandler _handler;
public TheHandleMethod(IntegrationTestFixture<CreateHandlerTests> dbFixture)
{
_handledCommand = new Create.Command
{
CompanyName = "HandledCompany",
Email = "[email protected]"
};
}
[Fact]
public void ShouldCreateCompany()
{
_handler.Handle(_handledCommand);
int count = _dbFixture.Context.Companies.Count(x => x.Name == _handledCommand.CompanyName);
Assert.Equal(1, count);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment