sitecore Diagnostics: Asserts Null/Empty Checks



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);


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

Assert.IsNotNullOrEmpty(propertyName, "user");


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 ");