Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RhinoInterceptor"/> class. 
 /// Creates a new <see cref="RhinoInterceptor"/> instance.
 /// </summary>
 /// <param name="repository">
 /// The repository.
 /// </param>
 /// <param name="proxyInstance">
 /// The proxy Instance.
 /// </param>
 /// <param name="invocation_visitors">
 /// The invocation_visitors.
 /// </param>
 public RhinoInterceptor(MockRepository repository, IMockedObject proxyInstance, 
                         IEnumerable<InvocationVisitor> invocation_visitors)
 {
     this.repository = repository;
     this.proxyInstance = proxyInstance;
     this.invocation_visitors = invocation_visitors;
 }
Ejemplo n.º 2
0
        public void WillRememberExceptionInsideOrderRecorderEvenIfInsideCatchBlock()
        {
            MockRepository mockRepository = new MockRepository();
            IInterfaceWithThreeMethods interfaceWithThreeMethods = mockRepository.StrictMock<IInterfaceWithThreeMethods>();

            using (mockRepository.Ordered())
            {
                interfaceWithThreeMethods.A();
                interfaceWithThreeMethods.C();
            }

            mockRepository.ReplayAll();

            interfaceWithThreeMethods.A();
            try
            {
                interfaceWithThreeMethods.B();
            }
            catch { /* valid for code under test to catch all */ }
            interfaceWithThreeMethods.C();

            string expectedMessage="Unordered method call! The expected call is: 'Ordered: { IInterfaceWithThreeMethods.C(); }' but was: 'IInterfaceWithThreeMethods.B();'";
            ExpectationViolationException ex = Assert.Throws<ExpectationViolationException>(
                () => mockRepository.VerifyAll());
            Assert.Equal(expectedMessage, ex.Message);
        }
Ejemplo n.º 3
0
        public void Test_View_Events_WiredUp()
        {
            MockRepository mocks = new MockRepository();

            IView view = mocks.StrictMock<IView>();

            // expect that the model is set on the view
            // NOTE: if I move this Expect.Call above
            // the above Expect.Call, Rhino mocks blows up on with an
            // "This method has already been set to ArgsEqualExpectation."
            // not sure why. Its a side issue.
            Expect.Call(view.Model = Arg<Model>.Is.NotNull);

            // expect the event ClickButton to be wired up
            IEventRaiser clickButtonEvent =
                    Expect.Call(delegate
                    {
                        view.ClickButton += null;
                    }).IgnoreArguments().GetEventRaiser();

            // Q: How do i set an expectation that checks that the controller
            // correctly updates the model in the event handler.
            // i.e. above we know that the controller executes
            // _model.UserName = "******"
            // but how can I verify it?
            // The following wont work, because Model is null:
            // Expect.Call(view.Model.UserName = Arg<String>.Is.Anything);

            mocks.ReplayAll();

            Controller controller = new Controller(view);
            clickButtonEvent.Raise(null, null);

            mocks.VerifyAll();
        }
Ejemplo n.º 4
0
        public DslFactoryFixture()
        {
            factory = new DslFactory();
            mocks = new MockRepository();
            mockedDslEngine = mocks.DynamicMock<DslEngine>();
            mockCache = mocks.DynamicMock<IDslEngineCache>();
        	
			mockCache.WriteLock(null);
        	LastCall.Repeat.Any()
        		.IgnoreArguments()
        		.Do((Action<CacheAction>) ExecuteCachedAction);
			
			mockCache.ReadLock(null);
			LastCall.Repeat.Any()
				.IgnoreArguments()
				.Do((Action<CacheAction>)ExecuteCachedAction);
            
			IDslEngineStorage mockStorage = mocks.DynamicMock<IDslEngineStorage>();
            Assembly assembly = Assembly.GetCallingAssembly();
            context = new CompilerContext();
            context.GeneratedAssembly = assembly;
            mockedDslEngine.Storage = mockStorage;
            mockedDslEngine.Cache = mockCache;

            SetupResult.For(mockStorage.GetMatchingUrlsIn("", ref testUrl)).Return(new string[] { testUrl });
            SetupResult.For(mockStorage.IsUrlIncludeIn(null, null, null))
                .IgnoreArguments()
                .Return(true);
        }
Ejemplo n.º 5
0
        public void The_value_of_a_variable_used_as_an_out_parameter_should_not_be_used_as_a_constraint_on_an_expectation()
        {
            MockRepository mockRepository = new MockRepository();
            ServiceBeingCalled service = mockRepository.StrictMock<ServiceBeingCalled>();
            const int theNumberToReturnFromTheServiceOutParameter = 20;

            using(mockRepository.Record())
            {
                int uninitialized;

                // Uncommenting the following line will make the test pass, because the expectation constraints will match up with the actual call.
                // However, the value of an out parameter cannot be used within a method value before it is set within the method value,
                // so the value going in really is irrelevant, and should therefore be ignored when evaluating constraints.
                // Even ReSharper will tell you "Value assigned is not used in any execution path" for the following line.

                //uninitialized = 42;

                // I understand I can do an IgnoreArguments() or Contraints(Is.Equal("key"), Is.Anything()), but I think the framework should take care of that for me

                Expect.Call(service.PopulateOutParameter("key", out uninitialized)).Return(null).OutRef(theNumberToReturnFromTheServiceOutParameter);
            }
            ObjectBeingTested testObject = new ObjectBeingTested(service);
            int returnedValue = testObject.MethodUnderTest();
            Assert.Equal(theNumberToReturnFromTheServiceOutParameter, returnedValue);
        }
Ejemplo n.º 6
0
 public void IsShouldSuportAddANewTask()
 {
     var task = new Task("Title", "ceva", DateTime.Now, DateTime.Today, "", "home");
     var repository = new MockRepository();
     repository.AddTask(task);
     repository.ShouldNotBeNull();
 }
        public void Delete_HappyPath()
        {
            // obtains a valid patient
            Firestarter.CreateFakePatients(this.db.Doctors.First(), this.db);
            this.db.SaveChanges();
            var patientId = this.db.Patients.First().Id;

            var formModel = new AnamneseViewModel()
            {
                PatientId = patientId,
                Conclusion = "This is my anamnese",
                DiagnosticHypotheses = new List<DiagnosticHypothesisViewModel>() {
                        new DiagnosticHypothesisViewModel() { Text = "Text", Cid10Code = "Q878" },
                        new DiagnosticHypothesisViewModel() { Text = "Text2", Cid10Code = "Q879" }
                   }
            };

            var mr = new MockRepository(true);
            var controller = mr.CreateController<AnamnesesController>();
            controller.Create(new[] { formModel });

            Assert.IsTrue(controller.ModelState.IsValid);

            // get's the newly created anamnese
            var newlyCreatedAnamnese = this.db.Anamnese.First();

            // tries to delete the anamnese
            var result = controller.Delete(newlyCreatedAnamnese.Id);
            JsonDeleteMessage deleteMessage = (JsonDeleteMessage)result.Data;

            Assert.AreEqual(true, deleteMessage.success);
            Assert.AreEqual(0, this.db.Anamnese.Count());
        }
Ejemplo n.º 8
0
        public void MockInternalClass()
        {
            MockRepository mocker = new MockRepository();
            InternalClass mockInternalClass = mocker.StrictMock<InternalClass>();

            Assert.IsNotNull(mockInternalClass);
        }
Ejemplo n.º 9
0
 public void SetupResult_For_writeable_property_on_stub_should_be_ignored()
 {
     MockRepository mocks = new MockRepository();
     TestClass test = mocks.Stub<TestClass>();
     SetupResult.For(test.ReadOnly).Return("foo");
     SetupResult.For(test.ReadWrite).PropertyBehavior();
 }
 public void UsesBranchSpecificConfigOverTopLevelDefaults()
 {
     var config = new Config
     {
         VersioningMode = VersioningMode.ContinuousDelivery,
         Branches =
         {
             {
                 "dev(elop)?(ment)?$", new BranchConfig
                 {
                     VersioningMode = VersioningMode.ContinuousDeployment,
                     Tag = "alpha"
                 }
             }
         }
     };
     ConfigurationProvider.ApplyDefaultsTo(config);
     var develop = new MockBranch("develop") { new MockCommit { CommitterEx = Constants.SignatureNow() } };
     var mockRepository = new MockRepository
     {
         Branches = new MockBranchCollection
         {
             new MockBranch("master") { new MockCommit { CommitterEx = Constants.SignatureNow() } },
             develop
         }
     };
     var context = new GitVersionContext(mockRepository, develop, config);
     context.Configuration.Tag.ShouldBe("alpha");
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StubRecordMockState"/> class.
 /// </summary>
 /// <param name="mockedObject">The proxy that generates the method calls</param>
 /// <param name="repository">Repository.</param>
 /// <param name="isPartial">A flag indicating whether we should behave like a partial stub.</param>
 public StubRecordMockState(IMockedObject mockedObject, MockRepository repository, bool isPartial)
     : base(mockedObject, repository)
 {
     this.isPartial = isPartial;
     Type[] types = mockedObject.ImplementedTypes;
     SetPropertyBehavior(mockedObject, types);
 }
 public CallbackExpectationTests()
 {
     mocks = new MockRepository();
     demo = (IDemo) mocks.StrictMock(typeof (IDemo));
     method = typeof (IDemo).GetMethod("VoidThreeArgs");
     callbackCalled = false;
 }
Ejemplo n.º 13
0
        public void ShouldIgnoreArgumentsOnGenericCallWhenTypeIsStruct()
        {
            // setup
            MockRepository mocks = new MockRepository();
            ISomeService m_SomeServiceMock = mocks.StrictMock<ISomeService>();
            SomeClient sut = new SomeClient(m_SomeServiceMock);

            using (mocks.Ordered())
            {
                Expect.Call(delegate
                {
                    m_SomeServiceMock.DoSomething<string>(null, null);
                });
                LastCall.IgnoreArguments();

                Expect.Call(delegate
                {
                    m_SomeServiceMock.DoSomething<DateTime>(null, default(DateTime));  // can't use null here, because it's a value type!
                });
                LastCall.IgnoreArguments();

            }
            mocks.ReplayAll();

            // test
            sut.DoSomething();

            // verification
            mocks.VerifyAll();

            // cleanup
            m_SomeServiceMock = null;
            sut = null;
        }
Ejemplo n.º 14
0
        public void CanUseExpectSyntax_OnMockWithOrderedExpectations(bool shouldSwitchToReplyImmediately)
        {
            MockRepository mocks = new MockRepository();

            var foo54 = mocks.StrictMock<IFoo54>();
            if (shouldSwitchToReplyImmediately)
                mocks.ReplayAll();

            using (mocks.Ordered())
            {
                foo54
                    .Expect(x => x.DoSomething())
                    .Return(0);

                foo54
                    .Expect(x => x.DoSomethingElse());
            }

            if (!shouldSwitchToReplyImmediately)
                mocks.Replay(foo54);

            foo54.DoSomething();
            foo54.DoSomethingElse();

            foo54.VerifyAllExpectations();
        }
Ejemplo n.º 15
0
        public void WillMerge_UnorderedRecorder_WhenRecorderHasSingleRecorderInside()
        {
            MockRepository mocks = new MockRepository();
            ICustomer customer = mocks.StrictMock<ICustomer>();

            CustomerMapper mapper = new CustomerMapper();

            using (mocks.Record())
            using (mocks.Ordered())
            {
                Expect.Call(customer.Id).Return(0);

                customer.IsPreferred = true;
            }

            ExpectationViolationException ex = Assert.Throws<ExpectationViolationException>(() =>
            {
                using (mocks.Playback())
                {
                    mapper.MarkCustomerAsPreferred(customer);
                }
            });

            Assert.Equal("Unordered method call! The expected call is: 'Ordered: { ICustomer.get_Id(); }' but was: 'ICustomer.set_IsPreferred(True);'", ex.Message);
        }
Ejemplo n.º 16
0
 public void CanMockIE()
 {
     //TODO: Figure out why this does not work.
     MockRepository mockRepository = new MockRepository();
     IHTMLEventObj2 mock = mockRepository.StrictMock<IHTMLEventObj2>();
     Assert.NotNull(mock);
 }
Ejemplo n.º 17
0
 public void CantCallOriginalMethodOnInterface()
 {
     MockRepository mocks = new MockRepository();
     IDemo demo = (IDemo)mocks.StrictMock(typeof(IDemo));
     var ex = Assert.Throws<InvalidOperationException>(() => SetupResult.For(demo.ReturnIntNoArgs()).CallOriginalMethod(OriginalCallOptions.CreateExpectation));
     Assert.Equal("Can't use CallOriginalMethod on method ReturnIntNoArgs because the method is abstract.", ex.Message);
 }
Ejemplo n.º 18
0
 public void CantCallOriginalMethodOnAbstractMethod()
 {
     MockRepository mocks = new MockRepository();
     MockingClassesTests.AbstractDemo demo = (MockingClassesTests.AbstractDemo)mocks.StrictMock(typeof(MockingClassesTests.AbstractDemo));
     var ex = Assert.Throws<InvalidOperationException>(() => SetupResult.For(demo.Six()).CallOriginalMethod(OriginalCallOptions.CreateExpectation));
     Assert.Equal("Can't use CallOriginalMethod on method Six because the method is abstract.", ex.Message);
 }
Ejemplo n.º 19
0
        public void MultiThreadedReplay()
        {
            var mocks = new MockRepository();
            var service = mocks.StrictMock<IService>();
            using (mocks.Record())
            {
                for (int i = 0; i < 100; i++)
                {
                    int i1 = i;

                    Expect.Call(() => service.Do("message" + i1));
                }
            }
            using (mocks.Playback())
            {
                int counter = 0;
                for (int i = 0; i < 100; i++)
                {
                    var i1 = i;
                    ThreadPool.QueueUserWorkItem(delegate
                    {
                        service.Do("message" + i1);
                        Interlocked.Increment(ref counter);
                    });
                }
                while (counter != 100)
                    Thread.Sleep(100);
            }
        }
        public void EditPost_UserIsOwner_WithInvalidData()
        {
            PracticeHomeController homeController;
            var mr = new MockRepository();
            try
            {
                mr.SetCurrentUser_Andre_CorrectPassword();
                mr.SetRouteData_ConsultorioDrHouse_GregoryHouse(typeof(PracticeHomeController), "Edit");

                homeController = mr.CreateController<PracticeHomeController>(callOnActionExecuting: false);
            }
            catch (Exception ex)
            {
                InconclusiveInit(ex);
                return;
            }

            var viewModel = new PracticeHomeControllerViewModel
            {
                PracticeName = "", // Cannot set practice name to empty
                PracticeTimeZone = 3
            };

            Mvc3TestHelper.SetModelStateErrors(homeController, viewModel);

            // Execute test: owner must have access to this view.
            var actionResult = Mvc3TestHelper.RunOnAuthorization(homeController, "Edit", "POST")
                            ?? Mvc3TestHelper.RunOnActionExecuting(homeController, "Edit", "POST")
                            ?? homeController.Edit(viewModel);

            // Asserts
            Assert.IsInstanceOfType(actionResult, typeof(ViewResult));
            Assert.AreEqual(null, ((ViewResult)actionResult).View);
        }
        public void EditPost_UserIsAdministrator()
        {
            PracticeHomeController homeController;
            var mr = new MockRepository();
            try
            {
                mr.SetCurrentUser_Miguel_CorrectPassword();
                mr.SetRouteData_ConsultorioDrHouse_GregoryHouse(typeof(PracticeHomeController), "Edit");

                homeController = mr.CreateController<PracticeHomeController>(callOnActionExecuting: false);
            }
            catch (Exception ex)
            {
                InconclusiveInit(ex);
                return;
            }

            // Execute test: owner must have access to this view.
            var actionResult = Mvc3TestHelper.RunOnAuthorization(homeController, "Edit", "POST")
                            ?? Mvc3TestHelper.RunOnActionExecuting(homeController, "Edit", "POST")
                            ?? homeController.Edit(new PracticeHomeControllerViewModel
                            {
                                PracticeName = "My New Practice Name",
                                PracticeTimeZone = 3
                            });

            // Asserts
            Assert.IsInstanceOfType(actionResult, typeof(RedirectToRouteResult));
            var redirectResult = (RedirectToRouteResult)actionResult;
            Assert.AreEqual(2, redirectResult.RouteValues.Count);
            Assert.AreEqual("practicehome", string.Format("{0}", redirectResult.RouteValues["controller"]), ignoreCase: true);
            Assert.AreEqual("Index", string.Format("{0}", redirectResult.RouteValues["action"]), ignoreCase: true);
        }
Ejemplo n.º 22
0
        public void Ayende_View_On_Mocking()
        {
            MockRepository mocks = new MockRepository();
            ISomeSystem mockSomeSystem = mocks.StrictMock<ISomeSystem>();

            using (mocks.Record())
            {
                Expect.Call(mockSomeSystem.GetFooFor<ExpectedBar>("foo"))
                    .Return(new List<ExpectedBar>());
            }

            ExpectationViolationException ex = Assert.Throws<ExpectationViolationException>(
                () =>
                {
                    using (mocks.Playback())
                    {
                        ExpectedBarPerformer cut = new ExpectedBarPerformer(mockSomeSystem);
                        cut.DoStuffWithExpectedBar("foo");
                    }
                }
                );

            Assert.Equal(@"ISomeSystem.GetFooFor<Rhino.Mocks.Tests.FieldsProblem.UnexpectedBar>(""foo""); Expected #1, Actual #1.
            ISomeSystem.GetFooFor<Rhino.Mocks.Tests.FieldsProblem.ExpectedBar>(""foo""); Expected #1, Actual #0.", ex.Message);
        }
Ejemplo n.º 23
0
 public void Override_using_tag_with_a_prerelease()
 {
     var commit = new MockCommit
     {
         CommitterEx = 2.Seconds().Ago().ToSignature()
     };
     var finder = new MasterVersionFinder();
     var mockBranch = new MockBranch("master")
     {
         commit
     };
     var mockRepository = new MockRepository
     {
         Branches = new MockBranchCollection
         {
             mockBranch
         },
         Tags = new MockTagCollection
         {
             new MockTag
             {
                 NameEx = "0.1.0-beta1",
                 TargetEx = commit
             }
         }
     };
     var version = finder.FindVersion(new GitVersionContext(mockRepository, mockBranch, new Config()));
     Assert.AreEqual(0, version.Patch, "Should set the patch version to the patch of the latest hotfix merge commit");
     ObjectApprover.VerifyWithJson(version, Scrubbers.GuidScrubber);
 }
Ejemplo n.º 24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RecorderChanger"/> class. 
 /// Creates a new <see cref="RecorderChanger"/> instance.
 /// </summary>
 /// <param name="repository">
 /// The repository.
 /// </param>
 /// <param name="recorder">
 /// The recorder.
 /// </param>
 /// <param name="newRecorder">
 /// The new Recorder.
 /// </param>
 public RecorderChanger(MockRepository repository, IMethodRecorder recorder, IMethodRecorder newRecorder)
 {
     this.recorder = recorder;
     this.repository = repository;
     repository.PushRecorder(newRecorder);
     this.recorder.AddRecorder(newRecorder);
 }
        public void Delete_HappyPath()
        {
            // obtains a valid patient
            Firestarter.CreateFakePatients(this.db.Doctors.First(), this.db, 1);
            this.db.SaveChanges();
            var patientId = this.db.Patients.First().Id;

            var formModel = new DiagnosisViewModel
                                {
                                    PatientId = patientId,
                                    Text = "This is my diagnosis",
                                    Cid10Code = "Q878",
                                    Cid10Name = "Doença X"
                                };

            var mr = new MockRepository(true);
            var controller = mr.CreateController<DiagnosisController>();
            controller.Create(new[] { formModel });

            Assert.IsTrue(controller.ModelState.IsValid);

            // get's the newly created diagnosis
            var newlyCreatedDiagnosis = this.db.Diagnoses.First();

            // tries to delete the anamnese
            var result = controller.Delete(newlyCreatedDiagnosis.Id);
            var deleteMessage = (JsonDeleteMessage)result.Data;

            Assert.AreEqual(true, deleteMessage.success);
            Assert.AreEqual(0, this.db.Anamnese.Count());
        }
Ejemplo n.º 26
0
 public void CanMockComInterface()
 {
     MockRepository mocks = new MockRepository();
     IServiceProvider serviceProvider = (IServiceProvider)
                                        mocks.StrictMultiMock(typeof(IServiceProvider), typeof(IHTMLDataTransfer));
     Assert.NotNull(serviceProvider);
 }
Ejemplo n.º 27
0
 public CallbackTests()
 {
     System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
     mocks = new MockRepository();
     demo = (IDemo) mocks.StrictMock(typeof (IDemo));
     callbackCalled = false;
 }
 public static PageTypeUpdater Stub(MockRepository fakesRepository)
 {
     return fakesRepository.Stub<PageTypeUpdater>(
         PageTypeDefinitionLocatorFactory.Stub(), 
         new PageTypeFactory(),
         new PageTypeValueExtractor(),
         new PageTypeLocator(new PageTypeFactory()));
 }
Ejemplo n.º 29
0
 public void CantMoveToReplayStateWithoutclosingLastMethod()
 {
     MockRepository mocks = new MockRepository();
     ProxyInstance proxy = new ProxyInstance(mocks);
     RecordMockState recordState = new RecordMockState(proxy, mocks);
     recordState.MethodCall(new FakeInvocation(method), method, "");
     recordState.Replay();
 }
Ejemplo n.º 30
0
 public void ArgsEqualExpectationUsedForMethodsWithNoOutParameters()
 {
     MockRepository mocks = new MockRepository();
     RecordMockState recordState = new RecordMockState(new ProxyInstance(mocks), mocks);
     Assert.IsNull(recordState.LastExpectation);
     recordState.MethodCall(new FakeInvocation(method), method, "");
     Assert.IsInstanceOfType(typeof(ArgsEqualExpectation), recordState.LastExpectation);
 }
Ejemplo n.º 31
0
 public ToDoListCqrsTest()
 {
     this.mockRepository = new MockRepository(MockBehavior.Strict);
     this.mediatorMock   = this.mockRepository.Create <IMediator>();
     this.controller     = new ToDoListCqrsController(this.mediatorMock.Object);
 }
Ejemplo n.º 32
0
 public PartialMockTests()
 {
     abs = MockRepository.Partial <AbstractClass>();
     abs.SetUnexpectedBehavior(UnexpectedCallBehaviors.BaseOrDefault);
 }
Ejemplo n.º 33
0
 public void CantCreatePartialMockFromInterfaces()
 {
     Assert.Throws <InvalidOperationException>(
         () => MockRepository.Partial <IDemo>());
 }
 public void Setup()
 {
     m_log    = MockRepository.GenerateStub <ILogger>();
     m_config = MockRepository.GenerateStub <IConfig>();
 }
Ejemplo n.º 35
0
 public override void SetUp()
 {
     base.SetUp();
     detector = MockRepository.GenerateStub <IReleaseDetector>();
     mapper   = new ReleaseMapper(scmData, detector);
 }
Ejemplo n.º 36
0
        public ServiceTest()
        {
            var uri = Path.Combine(Environment.CurrentDirectory, "testdata.xml");

            Mocks = new MockRepository(uri);
        }
Ejemplo n.º 37
0
 public new void Setup()
 {
     _customerSettings     = new CustomerSettings();
     _stateProvinceService = MockRepository.GenerateMock <IStateProvinceService>();
     _validator            = new RegisterValidator(_localizationService, _stateProvinceService, _customerSettings);
 }
Ejemplo n.º 38
0
        public void TryToMockClassWithProtectedAbstractClass()
        {
            MockRepository mockRepository = new MockRepository();

            mockRepository.StrictMock <SomeClassWithProtectedAbstractClass>();
        }
Ejemplo n.º 39
0
        public void Test_AddWrongCodecName()
        {
            MockRepository mocks = new MockRepository();

            Esapi.Encoder.AddCodec(null, mocks.StrictMock <ICodec>());
        }
Ejemplo n.º 40
0
 void InitMocks()
 {
     _mocks = new MockRepository();
     _meta  = _mocks.StrictMock <IPersistentMap>();
     _mocks.ReplayAll();
 }
Ejemplo n.º 41
0
        public static void InitialiseServiceLocator()
        {
            provider = MockRepository.GenerateStub <IServiceLocator>();

            ServiceLocator.SetLocatorProvider(() => provider);
        }
Ejemplo n.º 42
0
 public EtagSynchronizerTests()
 {
     storage = MockRepository.GenerateStub <ITransactionalStorage>();
     storage.Stub(x => x.Batch(Arg <Action <IStorageActionsAccessor> > .Is.Anything)).WhenCalled(x => numberOfCalls++);
 }
 public void SetUp()
 {
     m_repository = new MockRepository(MockBehavior.Strict);
 }
Ejemplo n.º 44
0
 public AgenteTests()
 {
     this.mockRepository = new MockRepository(MockBehavior.Strict);
 }
 public void SetUp()
 {
     mocks = new MockRepository();
 }
Ejemplo n.º 46
0
 public void Init()
 {
     _benchmarkService = MockRepository.GenerateStub <IProteinBenchmarkService>();
 }
Ejemplo n.º 47
0
 void CreateClass()
 {
     classKindUpdater = MockRepository.GenerateStub <IClassKindUpdater>();
     codeClass        = new CodeClass2(helper.ProjectContentHelper.ProjectContent, helper.Class, classKindUpdater);
 }
Ejemplo n.º 48
0
 private AssemblyContext CreateAssemblyContext()
 {
     return(new AssemblyContext(
                MockRepository.GenerateStrictMock <IMutableTypeBatchCodeGenerator>(),
                MockRepository.GenerateStrictMock <IGeneratedCodeFlusher>()));
 }
Ejemplo n.º 49
0
 protected TType CreateDependency <TType>()
     where TType : class
 {
     return(MockRepository.GenerateMock <TType>());
 }
Ejemplo n.º 50
0
 public void Init()
 {
     _mockRepository = new MockRepository();
     InternalInit();
 }
Ejemplo n.º 51
0
 public MockHelper(MockRepository mockRepository)
 {
     MockRepository = mockRepository;
 }
Ejemplo n.º 52
0
 protected TType CreateStub <TType>() where TType : class
 {
     return(MockRepository.GenerateStub <TType>());
 }
Ejemplo n.º 53
0
 public void SetUpContext()
 {
     _fakeStepProvider = MockRepository.GenerateStub<IStepProvider>();
     _fakeStepDescriber = MockRepository.GenerateStub<IStepDescriber>();
     Job = new StorEvilGlossaryJob(_fakeStepProvider, _fakeStepDescriber, new EventBus(), new NoOpGlossaryFormatter());
 }
Ejemplo n.º 54
0
 /// <summary>
 /// Sets up the mock objects of the derived unit test class
 /// </summary>
 public override void SetupMockObjectsForPlugin()
 {
     Plugin.OrganizationServiceContext = MockRepository.GenerateStub <CrmServiceContext>(Plugin.OrganizationService);
     Plugin.CrmService = MockRepository.GenerateMock <CrmService>(Plugin.OrganizationServiceContext, Plugin.TracingService);
     Plugin.ManageDeleteEntityService = MockRepository.GenerateMock <ManageDeleteEntityService>(Plugin.CrmService, Plugin.OrganizationServiceContext, Plugin.PluginExecutionContext, Plugin.TracingService);
 }
Ejemplo n.º 55
0
        public HomeControllerTests()
        {
            this.mockRepository = new MockRepository(MockBehavior.Strict);

            this.mockLogger = this.mockRepository.Create <ILogger <HomeController> >();
        }
Ejemplo n.º 56
0
 public void Setup()
 {
     mr      = new MockRepository();
     program = new Program();
 }