sitecore Diagnostics: Asserts Null/Empty Checks

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

IsNotNull

This is a very simple and popular method to use to check if an item is not null. It simply checks the object that is passed in to see if it is null.

Assert.IsNotNull(database, type, "Name: {0}", item);

IsNotNullOrEmpty

This is the same as IsNotNull above, but works on string values instead of objects.

Assert.IsNotNullOrEmpty(propertyName, "user");

IsNull

This is simply an inverse of the IsNotNull() method. This method asserts that the object is null.

Assert.IsNull(this.StandardValues, "A Standard Values item has already been created for this template ");


Got any sitecore Question?