I am using Prism in my application and I am using NUnit to test my code. I like using NUnit, because it lets me test things like my ViewModels without the overhead of the entire Silverlight runtime being executed.
The problem I am running in to is that DelegateCommand.RaiseCanExecuteChanged calls into Deployment.Current which throws an exception in my unit test environment... I'm not surprised, since there is no current application in a unit test.
Aside from removing it from the DelegateCommand.Silverlight.cs:OnExecuteChanged(), does anyone know a way around this?
Here is my stack trace:
failed: System.Exception : Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))
at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
at MS.Internal.XcpImports.Deployment_GetCurrent(IntPtr& pDeployment)
C:\Users\BRIAN GENISIO\Documents\Visual Studio 2008\Projects\RecipeBox\RecipeBox\RecipeList\RecipeListViewModel.cs(82,0): at RecipeBox.RecipeList.RecipeListViewModel.set_SearchText(String
C:\Users\BRIAN GENISIO\Documents\Visual Studio 2008\Projects\RecipeBox\RecipeBoxTests\RecipeBox\RecipeListViewModelTests.cs(132,0): at RecipeBoxTests.RecipeBox.RecipeListViewModelTests.Search_With_Two_Pages_Requests_Second_Page()