This is a migrated thread and some comments may be shown as answers.

Win8/Resources.MissingManifestResourceException

5 Answers 113 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Toby
Top achievements
Rank 1
Toby asked on 19 Nov 2012, 04:17 PM
Hi guys,

I'm pleased to say that JustMock is the only mocking framework I've actually got to work with Win8 Store/"Metro" projects

However, whenever there is a problem, instead of a detailed error I get:
Test method Win8Proto.Tests.WhenUserIsNotAuthenticated.ThenTryParseOAuthCallbackUrlIsCalled threw exception: <br>System.Resources.MissingManifestResourceException:
Unable to load resources for resource file "Telerik.JustMock.Messages" in package "97A458C7-A0AA-4BC7-B8FA-D9F82394A7BE".<
br>   
at System.Resources.ResourceManager.GetString(String name, CultureInfo culture)<
br>   at Telerik.JustMock.Messages.get_ExpectedCallIsNeverInvoked()<br>   
at Telerik.JustMock.MockAssertion.AssertValidator.ValidateExpectations(MethodInstance methodInstance, Int32 numberofTimeExecuted)<
br>   
at Telerik.JustMock.MockAssertion.AssertValidator.ToExceptionString(MethodInstance methodInstance)<
br>   
at Telerik.JustMock.MockAssertion.AssertValidator.Validate()<
br>   at Telerik.JustMock.MockAssertion.Assert(MethodInstance instance, Filter filter)<br>   
at Telerik.JustMock.Mock.AssertInternal(Occurs occurs)<
br>   at Telerik.JustMock.Helpers.FluentHelper.<>c__DisplayClass7`2.<Assert>b__6(MockContext`1 x)<br>   
at Telerik.JustMock.MockContext.Setup(Instruction instruction, Action`1 action)<
br>   at Telerik.JustMock.Helpers.FluentHelper.Assert(T obj, Expression`1 expression, Occurs occurs)<br>   
at Telerik.JustMock.Helpers.FluentHelper.Assert(T obj, Expression`1 action)<
br>   at Win8Proto.Tests.WhenUserIsNotAuthenticated.ThenTryParseOAuthCallbackUrlIsCalled() in WithMockFacebookClient.cs: line 104<br>
<
div></div>


and so on. It doesn't matter what the error actually is

I've got the sample Just Mock projects working fine, and I can generally debug to work out what the actual problem/test failure is

what do you reckon?

5 Answers, 1 is accepted

Sort by
0
Ricky
Telerik team
answered on 20 Nov 2012, 05:26 PM
Hi Toby,

It's great to hear that you’ve got JustMock running in your Windows 8 projects. However in order to let us investigate the missing manifest issue, I would request you to send us a copy of your project.

 

Kind Regards
Ricky
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Toby
Top achievements
Rank 1
answered on 03 Dec 2012, 01:22 PM
Hi there,

I've created a new project, with the same test code in both Desktop and Store. In it, I'm mocking the System.Net.Http.HttpClient object and it's GetByteArrayAsync method. 

As I hope you can see, the Desktop one runs fine, but the Store version fails on 
httpClient.Arrange(client => client.GetByteArrayAsync(Arg.AnyString)).Returns(GetByteArray());


with the error:
Unable to load resources for resource file "Telerik.JustMock.Messages" in package "b56f7b53-edda-4fa2-89a4-214c7a0bc58b".


As far as I can see, the code is identical in both, except for one is a Windows Store app. I was really hoping that the Desktop version would fail with a useful error, but it wasn't to be ...

ah - can't attach the zipped project - where can I send it please?
0
Toby
Top achievements
Rank 1
answered on 03 Dec 2012, 01:24 PM
ok, here's the test class - it works fine in Desktop unit test, but not Windows Store

[TestClass]
public class StoreUnitTests
{
    protected byte[] _response;
 
    private async void Act()
    {
        HttpClient httpClient = Mock.Create<HttpClient>();
        httpClient.Arrange(client => client.GetByteArrayAsync(Arg.AnyString)).Returns(GetByteArray());
        _response = await httpClient.GetByteArrayAsync("url");
    }
 
    [TestMethod]
    public void TestMockHttp()
    {
        Act();
        new ManualResetEvent(false).WaitOne(1000);
        Assert.IsNotNull(_response);
    }
 
 
    public Task<byte[]> GetByteArray()
    {
        return Task.Run(()
                        =>
                            {
                                var encoding = new UTF8Encoding();
                                return encoding.GetBytes("hello world");
                            }
            );
    }
}
0
Ricky
Telerik team
answered on 05 Dec 2012, 06:05 PM
Hi Toby,

Thanks again for contacting us.

If you are using portable library then elevated or commercial feature is not yet officially supported. However, you will still be able to mock interfaces and virtual members or in other words use JustMock lite features.

We are however working on this and keep you posted once we are ready.

Kind Regards
Ricky
the Telerik team

Share what you think about JustTrace & JustMock with us, so we can become even better! You can use the built-in feedback tool inside JustTrace, our forums, or our JustTrace or JustMock portals.
0
Toby
Top achievements
Rank 1
answered on 05 Dec 2012, 07:13 PM
cheers Ricky,

JustMock is the only mocking framework I've got to run on WinRT, so I'm happy with what I've got!

I pushed the HttpClient down into a implementation of an interface that handles all the relevant operations and mocked that instead - it's not what I've got used to using JustMock on Desktop, but that only makes me appreciate that more, and there's always a way around

look forward to seeing the update, good luck because the work involved looks horrendous!

Toby
Tags
General Discussions
Asked by
Toby
Top achievements
Rank 1
Answers by
Ricky
Telerik team
Toby
Top achievements
Rank 1
Share this question
or