“Peppermint” MIX demo sources

At MIX, during my talk on unit testing Silverlight and Windows Phone applications, I demoed a simple application called ‘Peppermint’. Here’s the source; I’ll be writing up a full tutorial on Windows Phone later, so these are just ‘bleeding-edge bits’.

Peppermint-Demo.zip [Zip, 1.2 MB]

Silverlight:

Requires Visual Studio 2010 (or express)
Requires the Silverlight Toolkit
Requires the test framework binaries included in the zip

Windows Phone:

Requires the Windows Phone development tools CTP
Requires the test framework binaries included in the zip

  • http://N/A Brian

    I try to running ‘PhonePeppermint’ Project.

    1. install Windows7(32bit), ‘Visual Studio 2010′, WP7 CTP
    1. run ‘PhonePeppermint.sln’
    2. add references to peppermintTests Project
    => Microsoft.Silverlight.Testing.dll in TestFramework_Preview.zip
    => Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll in TestFramework_Preview.zip
    3. Build

    ==========================================================
    but, i have some errors like this :
    Error 1 The “ValidateXaml” task failed unexpectedly.
    System.IO.FileLoadException: Could not load file or assembly ‘file:///C:\Users\duti\Desktop\Peppermint-Demo_MIX10\Peppermint.Phone\peppermintTests\Microsoft.Silverlight.Testing.dll’ or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0×80131515)
    File name: ‘file:///C:\Users\duti\Desktop\Peppermint-Demo_MIX10\Peppermint.Phone\peppermintTests\Microsoft.Silverlight.Testing.dll’ —> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.

    at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
    at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
    at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)
    at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
    at System.Reflection.Assembly.LoadFrom(String assemblyFile)
    at Microsoft.Silverlight.Build.Tasks.ValidateXaml.XamlValidator.Execute(ITask task)
    at Microsoft.Silverlight.Build.Tasks.ValidateXaml.XamlValidator.Execute(ITask task)
    at Microsoft.Silverlight.Build.Tasks.ValidateXaml.Execute()
    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult)
    =========================================================

    i think that it can’t loading ‘Microsoft.Silverlight.Testing.dll’
    is that right ? any solution ?

    Thanks a lot for your help!!

  • http://www.jeff.wilcox.name/ Jeff Wilcox

    @Brian,
    You need to Unlock the files from the .Zip – it’s a standard security feature on Vista/Win7. Right-click on both of the test DLLs, then Unlock in the properties page.

    This isn’t something easy for me to overcome since it’s part of the OS, sorry it’s hard to discover.

    (CHM files are the same way)

  • http://N/A Brian

    Jeff, thanks a lot for your very fast answer!!

    i solved it. => unlock all test dll.

  • Ben

    You put a link to ManyTests.cs on your desktop.

  • http://www.jeff.wilcox.name/ Jeff Wilcox

    @Ben,
    Feel free to just remove that file from the project, it was full of a bunch of simple API assertion tests. I don’t have that Windows install still, I wiped it :-( .

  • Dave

    Does that silverlight app needed to be a class library to run the unit test? I create a silverlight windows phone application and a silverlight unit test application. When I tried to add the project as the reference to the unit test app, it gives You can only add project references to other silverlight projects in the solution.
    Do you know how to solve this problem?

    Thanks a lot for the help!

  • http://N/A Brian

    I’m sorry for my so many question.

    I’m searching for code coverage tools to WP7.
    I read this topic :
    => http://www.jeff.wilcox.name/2009/11/november-walkthrough/

    In the ‘peppermintTests Project’, i try that. but failed.
    1)
    2) msbuild /t:coveragetest

    To get code coverage information, what can i do ?
    1) make my components(WP7) within ‘a desktop class library project’
    2) get code coverage using visual studio test feature
    is that right ?

    In the future, do you have some plan for code coverage ?

    Always, Thanks for you comment!!