Win8/Resources.MissingManifestResourceException

6 posts, 0 answers
  1. Toby
    Toby avatar
    4 posts
    Member since:
    Nov 2011

    Posted 19 Nov 2012 Link to this post

    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?

  2. Ricky
    Admin
    Ricky avatar
    467 posts

    Posted 20 Nov 2012 Link to this post

    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.

  3. DevCraft R3 2016 release webinar banner
  4. Toby
    Toby avatar
    4 posts
    Member since:
    Nov 2011

    Posted 03 Dec 2012 Link to this post

    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?
  5. Toby
    Toby avatar
    4 posts
    Member since:
    Nov 2011

    Posted 03 Dec 2012 Link to this post

    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");
                                }
                );
        }
    }
  6. Ricky
    Admin
    Ricky avatar
    467 posts

    Posted 05 Dec 2012 Link to this post

    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.
  7. Toby
    Toby avatar
    4 posts
    Member since:
    Nov 2011

    Posted 05 Dec 2012 Link to this post

    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
Back to Top
DevCraft R3 2016 release webinar banner