public void InstantiateInContentPlaceHolder () { var mp = new MasterPage (); ITemplate template = new MyTemplate (); AssertExtensions.Throws<NullReferenceException> (() => { mp.InstantiateInContentPlaceHolder (null, template); }, "#A1-1"); Control container = new Control (); AssertExtensions.Throws<NullReferenceException> (() => { mp.InstantiateInContentPlaceHolder (container, null); }, "#A1-2"); #if DOTNET // TODO: why does it throw? Unchecked 'as' type cast? AssertExtensions.Throws<NullReferenceException> (() => { mp.InstantiateInContentPlaceHolder (container, template); }, "#B1-1"); #endif // TODO: Still throws a NREX, probably needs a full web request context, as it works below in the // InstantiateInContentPlaceHolder_WithPage test // //template = new MyContentTemplate (); //mp.InstantiateInContentPlaceHolder (container, template); }