Unit testing custom property on a MCMS posting

I needed to unit test a method that retrives a value from a custom property on a Microsoft Content Management Server posting. This is how I did it:

public void GetLanguage_GetLanguageFromPosting()
    using(CmsApplicationContext appCtx = 
new CmsApplicationContext()) { appCtx.AuthenticateAsCurrentUser(
try { Template templ = appCtx.Searches.GetByGuid
as Template;
            Posting p
               appCtx.RootChannel.CreatePosting(templ); CustomProperty prop
= "est"; Assert.AreEqual("est",
               NavigationHelper.GetLanguage(p)); }
finally { appCtx.RollbackAll(); } } }