Does Telerik JustMock work for Windows 8.1 environment? We have a solution targeting Windows 8.1. I haven't been able to use Telerik JustMock. Is there any workaround to make it work or some planned release for this framework. Best regards, Sebas
Any plans to support Windows 10 UWP/UAP projects? I tried the existing version but ran into several roadblocks: Attempt #1 (does not work): Cannot add JustMockLite to a Windows 10 Unit Test project via NuGet because UAP projects are not supported. Attempt #2 (does not work) Add a reference to the pre-compiled binaries. The Win10 project allows the reference, but when the tests run, it results in a bunch of 'Could not find assembly System.Core v3.5.0.0' exceptions. Tried installing .Net 3.5 but didnt help. Tried building from source and retargeting the framework to 4, 4.5, 4.5.2, and 4.6, but that didnt work (see Attempt #3). Just a note: when Visual Studio 2015 was in RC status, we had this working. We simply added a reference to the pre-compiled Telerik.JustMocks assembly and things worked. Updating to VS RTM though broke things. Attempt #3 (does not work) Compile JustMockLite from source. VS complains that the Win10 Unit Test project is of type NetCore and the JustMock assembly targets NetFramework. Attempt #4 (does not work) Add reference to Telerik.JustMock.Portable to Windows 10 Unit Test project. This allows the project to compile and run, but any tests using Mock.Create() fail because System.Diagnostics.StackTrace.ctor is not supported.
eg // Act testSUT.Execute(1); // Assert myMockThing.Assert(x => x.Foo, Occurs.Once(), "calling Execute() with 1 should execute Foo due to blah");
Integrate with Simple Injector: https://simpleinjector.org/index.html similar to https://www.nuget.org/packages/JustMock.Unity and https://www.nuget.org/packages/JustMock.Mef/
I'd like to be able to intercept and arrange access to fields on any class. public class Dependency { public int A; } .. var dep = new Dependency(); Mock.Arrange(() => dep.A).Returns(5); Mock.ArrangeSet(() => dep.A = Arg.AnyInt).DoInstead(...);
Remove obfuscation of exceptions thrown by JustMock, because they can cause failing builds on Jenkins
I want to be able to arrange the return value of `new` expressions, like Mock.Arrange(() => new FileInfo()).Returns(mockFileInfo). Then, I expect that `new FileInfo()` will always return my mock instance.
If possible, update Microsoft.Practices.ServiceLocation to 1.2 or change NuGet package to > 1.0 instead of = 1.0.
Allow future mocking of an entire class, including a default of DoNothing() for all methods in the class, rather than requiring each method to be future mocked separately.
1. Load the attached project in Visual Studio 2013. 2. Update the NuGet packages (NUnit). 3. Update the reference to JustMock to point to the correct path to a retail version of Telerik.JustMock.dll. 4. Run tests in NUnit runner (or any other runner that will run them in the same process/sequentially. 5. --> Notice that the first TestCase will pass, the second will fail. 6. Run the two test cases separately. 7. --> Notice that they both pass. 8. Remove the reference to Telerik.JustMock.dll. 9. Use NuGet to get the latest JustMock Lite. 10. Run the tests again. 11. --> Notice that they both pass. This appears to be a bug with JustMock (retail) 2013.3.1119.2. The bug does not reproduce when using JustMock Lite from NuGet. If you drop into a debugger and step through both tests in a row you see the following behavior: 1. When the first test is started (after SetUp has been called) FlagA is correctly set to true and FlagB is defaulted to false. 2. When you step over the Mock.Arrange, FlagA is still true and FlagB is set to the value of input (order of running tests doesn't appear to matter, second always fails). 3. When the second test starts (after SetUp has been called again) Flag A is correctly set to true and FlagB is defaulted to false. 4. When you step over the Mock.Arrange, FlagB is set to the value of input but FlagA has been reverted to default! If you add several other properties to the interface they will all be reset to default (no matter how many you arrange) when the second test executes the Mock.Arrange. This bug reproduces without the JustMock profiler attached, and also with the profiler attached. The version of JustMock Lite that was tested against is 2014.1.1217.4. When I run the Telerik Control Panel I am not prompted to update my version of JustMock beyond 2013.3.1119.2 (perhaps this bug is already fixed and I just need to figure out how to upgrade).
this nuts, forcing me to answer a dialog for JustMock and JustTrace to turn off sending usage to Telerik. Very poor UX. Stop doing this.
Hi, Since I upgraded my JustMock I was unable to debug ASP.NET projects. I accidentally found a resolution to the problem here: http://stackoverflow.com/questions/19415275/asp-net-mvc4-code-not-running "If you are using Telerik JustMock as a mocking framework and have recently updated it to the 2013 Q3 version, it causes this exact problem. I was able to resolve this issue by uninstalling the mocking framework and installing the 2013 Q2 version." So I uninstalled JustMock and everything came to normal. Regards, Ovidiu
using NUnit.Framework; using Telerik.JustMock; namespace Example { public class MyClass { public MyClass(int a = 5) { } } [TestFixture] public class TestMyClass { [Test] public void test_MyClass() { Mock.Create<MyClass>(Behavior.CallOriginal); } } } Telerik.JustMock.MockException : Can not instantiate proxy of class: Example.MyClass. Could not find a parameterless constructor. at Telerik.JustMock.Core.MocksRepository.Create(Type type, MockCreationSettings settings) at Telerik.JustMock.MockBuilder.Create(MocksRepository repository, Type type, Object[] constructorArgs, Nullable`1 behavior, Type[] additionalMockedInterfaces, Nullable`1 mockConstructorCall, IEnumerable`1 additionalProxyTypeAttributes, List`1 supplementaryBehaviors, List`1 fallbackBehaviors, List`1 mixins) at Telerik.JustMock.Mock.<>c__DisplayClass5b`1.<Create>b__5a() at Telerik.JustMock.Core.ProfilerInterceptor.GuardInternal[T](Func`1 guardedAction) at Telerik.JustMock.Mock.Create[T](Behavior behavior, Object[] args) at Example.TestMyClass.test_MyClass() in c:\users\micah\Documents\Source\Test\Test\Class1.cs:line 17#0 This appears to be related to the recent fix for "Improve exception message for Mock.Create". Without Behavior.CallOriginal it works. Supplying a parameter also works.
Given: public abstract class Foo { } [Test] public void test_foo() { Mock.Create<Foo>(Behavior.Strict, Constructor.Mocked); } An exception is thrown at runtime saying "Abstract Type is not Accessible for Inheritance". This doesn't lead you to the actual problem which is that I accidentally swapped the Behavior and the Constructor in the parameter order. The same problem can occur if you attempt to call a constructor on an abstract object with the wrong number of parameters like so: public abstract class Foo { public Foo(int a, string b) { } } [Test] public void test_foo() { Mock.Create<Foo>(1, "foo", null); } This seems to be a problem with the compiler choosing the wrong overload to call and unfortunately there aren't a lot of solutions without changing the Create API. Perhaps having an alternative to Mock.Create that is more explicit that we can use to avoid typos leading to exceptions that are difficult to make sense of or a hint in the exception message that suggests what the root cause might be?