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

Cannot mock simple static functions

4 Answers 118 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Burton Weldy
Top achievements
Rank 1
Burton Weldy asked on 22 Apr 2010, 04:00 PM
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");

4 Answers, 1 is accepted

Sort by
0
Ricky
Telerik team
answered on 22 Apr 2010, 04:16 PM

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.
0
Burton Weldy
Top achievements
Rank 1
answered on 22 Apr 2010, 04:32 PM
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.

0
Chris
Telerik team
answered on 23 Apr 2010, 04:10 PM
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.
0
Chris
Telerik team
answered on 29 Apr 2010, 12:43 PM
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.
Tags
General Discussions
Asked by
Burton Weldy
Top achievements
Rank 1
Answers by
Ricky
Telerik team
Burton Weldy
Top achievements
Rank 1
Chris
Telerik team
Share this question
or