Cannot mock simple static functions

5 posts, 0 answers
  1. Burton Weldy
    Burton Weldy avatar
    7 posts
    Member since:
    Jan 2010

    Posted 22 Apr 2010 Link to this post

    Environment:  VS2010 Premium official release, framework 3.5
    Trying to mock a simple static function generates an exception "Ambiguous match found.".  This seems like basic functionality but we have only been able to mock Interfaces.  I tried searching for known issues, but couldn't seem to find bug reporting or anything on JustMock.

    Below is the sample code:

        public class Foo
        {
            public static string StaticFunction(int x)
            {
                return x.ToString();
            }
        }

                Mock.CreateStatic<Foo>();

                Mock.Arrange(() => Foo.StaticFunction(10)).Returns("ten");
                //above line generates "Ambiguous match found" exception

                string s = Foo.StaticFunction(1);
                Assert.IsTrue(s == "ten");
  2. Ricky
    Admin
    Ricky avatar
    467 posts

    Posted 22 Apr 2010 Link to this post

    Hi Burton,

    Thanks for letting us know. We are aware of this issue and you will get it fixed by tomorrow in the internal build.  Actually, this is an issue with VS 2010 for that runs test under .net 4.0 client profile which has an overload for a particular call in JustMock.

    Regards,
    Mehfuz
    the Telerik team

     

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. DevCraft R3 2016 release webinar banner
  4. Burton Weldy
    Burton Weldy avatar
    7 posts
    Member since:
    Jan 2010

    Posted 22 Apr 2010 Link to this post

    Thanks.

    How will I know when the next build/fix is publicly available and where to download it.  Currently I only see one download link and cannot tell if that download is any newer than what I have.

    We like the idea and implementation behind JustMock.  Look forward to possibly using it when its more stable.

  5. Chris
    Admin
    Chris avatar
    221 posts

    Posted 23 Apr 2010 Link to this post

    Hi Burton,
    Unfortunately we won't be ready with the new build today due to some unexpected last minute issues which we would definitely want to fix before we release a new build. We'll try hard to release the build next week on Monday / Tuesday at the latest.
    Sorry for the inconvenience.
    I will send a follow up once the new build is available or if you're twitter user you could also watch for tweets tagged with #JustCode :).

    Regards,
    Chris
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  6. Chris
    Admin
    Chris avatar
    221 posts

    Posted 29 Apr 2010 Link to this post

    Hi Burton,
    Just wanted to drop you a line and say we've just released a new JustMock build and now it supports VS 2010 (both RC and RTM):
    http://blogs.telerik.com/hristokosev/posts/10-04-29/new_justmock_build_available_for_download.aspx

    Should you have some other questions or problems, please don't hesitate to contact us.

    Greetings,
    Chris
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top
DevCraft R3 2016 release webinar banner