or
MESSAGE: Test method STB.EP.RBS.Test.TransportBooking.DriverComponentTest.testCheckExistDriver threw exception: Telerik.JustMock.MockException: Profiler must be enabled to mock/assert target SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated) method. +++++++++++++++++++ STACK TRACE: at Telerik.JustMock.Handlers.InterceptorHandler.Create(Object target, MethodInfo methodInfo, Boolean privateMethod) at Telerik.JustMock.MockContext`1.SetupMock(MockExpression`1 expression) at Telerik.JustMock.Mock.<>c__DisplayClassd.<Arrange>b__c(MockContext`1 x) at Telerik.JustMock.MockContext.Setup[TDelgate,TReturn](Instruction instruction, Func`2 function) at Telerik.JustMock.Mock.Arrange(Expression`1 expression) at STB.EP.RBS.Test.TransportBooking.DriverComponentTest.testCheckExistDriver() in C:\Project\STB\RBS\Tests\STB.EP.RBS.Test\TransportBooking\DriverComponentTest.cs:line 58 Thanks! Regards Suyi

public class JustMockFixture{ [Fact] public void CallOriginal_UnmockedGenericMethod_CallOriginalMock_ThrowsException() { var obj = Mock.Create<TestClass>(Behavior.CallOriginal); Should.NotThrow(() => obj.Load<string>(new[] { "1", "2", "3" })); }}internal class TestClass{ public T[] Load<T>(string[] ids) { throw new NotImplementedException(); }}

public class FooFactory { public static IFoo CreateFoo(int barKey) { using (FooBarModel foom = new FooBarModel()) { Bar barEntity = foom.Bars.Where(n => n.BarKey == barKey).FirstOrDefault(); // For this example, I will assume the bar record always exists. if (barEntity.IsIron) { return new IronFoo(); } else if (barEntity.IsGold) { return new GoldenFoo(); } else { return new LeadFoo(); } } }}System.InvalidCastException:
'System.Collections.Generic.List`1[My.Models.Person]' to type 'System.Data.Linq.Table`1[My.Models.Person]'var logic = new PersonLogic();var context = Mock.Create<DataContext>();var persons= new List<Person>();persons.Add(new Person());Mock.Arrange(() => (IEnumerable<Person>)context.Persons).Returns(persons);Mock.NonPublic.Arrange<DataContext>(logic, "context").Returns(context);Person returned = logic.GetPerson(1);Assert.Equals(returned.ID, 1);
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>Mock.Replace<System.Drawing.Printing.PrintDocument>(p => p.Print()).In<PrintJobTest>(t => t.Ensure_Print_Job_Folder_Name());var printDocument = new System.Drawing.Printing.PrintDocument();Mock.Arrange(() => printDocument.Print()).IgnoreInstance().DoNothing();

private PendingListViewModel _vm; [TestInitialize] public void Setup() { var view = Mock.Create<IPendingListView>(); var repository = Mock.Create<ISubmissionRepository>(); repository.Arrange(x => x.GetPendingSubmissions()).Returns(GetSubmissionSet()); var subscribedEvent = Mock.Create<RefreshPendingSubmissions>(); subscribedEvent.Arrange(x => x.Subscribe(Arg.IsAny<Action<string>>())).DoNothing(); var events = Mock.Create<IEventAggregator>(); events.Arrange(x => x.GetEvent<RefreshPendingSubmissions>()).Returns(subscribedEvent); _vm = new PendingListViewModel(view, repository, events); } [TestMethod] public void ExecuteSortByCountyCommand_CollectionShouldContainOneSortDescriptor() { _vm.SortCountyCommand.Execute("ASC"); Assert.IsTrue(_vm.SubmissionsCollection.SortDescriptions.Count == 1); }_events.GetEvent<RefreshPendingSubmissions>().Subscribe(a => OnRefresh());