Skip to content

Example repo for testing MassTransit with an in memory harness

Notifications You must be signed in to change notification settings

pdevito3/MessageBusTestingInMemHarness

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MessageBusTestingInMemHarness

This project was created with Craftsman.

Get Started

Go to your solution directory:

cd MessageBusTestingInMemHarness

Run your solution:

dotnet run --project YourBoundedContextName

Running Integration Tests

To run integration tests:

  1. Ensure that you have docker installed.
  2. Go to your src directory for the bounded context that you want to test.
  3. Confirm that you have migrations in your infrastructure project. If you need to add them, see the instructions below.
  4. Run the tests

⏳ If you don't have the database image pulled down to your machine, they will take some time on the first run.

Troubleshooting

-If you have trouble with your tests, try removing the container and volume marked for your integration tests.

  • If your entity has foreign keys, you'll likely need to adjust some of your tests after scaffolding to accomodate them.

Running Migrations

To create a new migration, make sure your environment is not set to Development:

Powershell

$Env:ASPNETCORE_ENVIRONMENT = "anything"

Bash

export ASPNETCORE_ENVIRONMENT=anything

Then run the following:

cd YourBoundedContextName/src/YourBoundedContextName
dotnet ef migrations add "your-description-here"

To apply your migrations to your local db, run the following:

cd YourBoundedContextName/src
dotnet ef database update --project YourBoundedContextName

About

Example repo for testing MassTransit with an in memory harness

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages