Messages

How to Unit Test CreateMultiple, UpdateMultiple, and UpsertMultiple messages

Minimum Version: 2.5.0 / 3.5.0

Given the importance of the new buk operations, you don’t need to do anything special to start using them other than updating to the newer versions that support them.

When you setup crud operations in the middleware configuration (by calling .AddCrud() and .UseCrud()) bulk operations will be added automatically.

CreateMultiple

Here’s a quick sample that demonstrates how to unit test that two records get created with create multiple.

You can find the source code here.

Create Multiple Unit Test Example

UpdateMultiple

Here’s a another quick sample that demonstrates how to unit test that updates two records with update multiple.

With UpdateMultiple, records must exist, otherwise an exception will be thrown. You can use either their primary key or an alternate key.

You can find the source code here.

Update Multiple Unit Test Example

UpsertMultiple

With UpsertMultiple you can both create and update records as part of the one operation. Here’s another example that demonstrates an UpsertMultiple request that creates one record and updates another.

You can find the source code here.

Upsert Multiple Unit Test Example