public void StartCruiseServerProject()
		{
			ConsoleRunnerArguments consoleArgs = new ConsoleRunnerArguments();
			Mock mockCruiseServer = new DynamicMock(typeof(ICruiseServer));
			mockCruiseServer.Expect("Start");
			mockCruiseServer.Expect("WaitForExit");
			Mock mockCruiseServerFactory = new DynamicMock(typeof(ICruiseServerFactory));
			mockCruiseServerFactory.ExpectAndReturn("Create", mockCruiseServer.MockInstance, consoleArgs.UseRemoting, consoleArgs.ConfigFile);

			new ConsoleRunner(consoleArgs, (ICruiseServerFactory)mockCruiseServerFactory.MockInstance).Run();

			mockCruiseServer.Verify();
		}
Пример #2
0
        public void CanMockOverloadedMethods()
        {
            IMock mock = new DynamicMock(typeof(IOverloadedMethods));

            mock.Expect("DoStuff", "one", 2);
            mock.Expect("DoStuff", "one");

            IOverloadedMethods instance = (IOverloadedMethods)mock.MockInstance;

            instance.DoStuff("one", 2);
            instance.DoStuff("one");
            mock.Verify();
        }
		public void KillContainer()
		{
			Mock mockPicoContainer = new DynamicMock(typeof(IMutablePicoContainer));
			IMutablePicoContainer picoContainer = mockPicoContainer.MockInstance as IMutablePicoContainer;
			mockPicoContainer.Expect("Stop");
			mockPicoContainer.Expect("Dispose");
			mockPicoContainer.ExpectAndReturn("Parent", new DefaultPicoContainer(picoContainer));
			mockPicoContainer.Strict = true;

			LifeCycleContainerBuilder lifeCycleContainerBuilder = new StubLifeCycleContainerBuilder();
			SimpleReference reference = new SimpleReference();
			reference.Set(mockPicoContainer.MockInstance);

			lifeCycleContainerBuilder.KillContainer(reference);
			mockPicoContainer.Verify();
		}
Пример #4
0
		public void Init()
		{
			m_mock = new DynamicMock(typeof(IIgnoreOrderTest));
			m_mock.Expect("Method",
				new object[] { new IgnoreOrderConstraint(0, 1, 2 )},
				new string[] { typeof(int[]).FullName });
		}
		public void TestSimpleSmtpNegotiation()
		{
			SmtpServer smtpserver=new SmtpServer("localhost");
			EmailMessage emailMessage=GetTestHtmlAndTextMessage();

			IMock mockSmtpProxy = new DynamicMock(typeof(ISmtpProxy));
			mockSmtpProxy.ExpectAndReturn("Open", new SmtpResponse(220, "welcome to the mock object server"), null);
			mockSmtpProxy.ExpectAndReturn("Helo", new SmtpResponse(250, "helo"), Dns.GetHostName());
			mockSmtpProxy.ExpectAndReturn("MailFrom", new SmtpResponse(250, "mail from"), emailMessage.FromAddress);
			foreach (EmailAddress rcpttoaddr in emailMessage.ToAddresses) 
			{
				mockSmtpProxy.ExpectAndReturn("RcptTo", new SmtpResponse(250, "receipt to"), rcpttoaddr);
			}
			mockSmtpProxy.ExpectAndReturn("Data", new SmtpResponse(354, "data open"), null);
			mockSmtpProxy.ExpectAndReturn("WriteData", new SmtpResponse(250, "data"), emailMessage.ToDataString());
			
			mockSmtpProxy.ExpectAndReturn("Quit", new SmtpResponse(221, "quit"), null);
			mockSmtpProxy.Expect("Close", null);

			ISmtpProxy smtpProxy= (ISmtpProxy) mockSmtpProxy.MockInstance;
			

			smtpserver.OverrideSmtpProxy(smtpProxy);

			
			emailMessage.Send(smtpserver);


		}
        public void ViewManagerCreateView()
        {
            #region Mock intialization

            DynamicMock useCase = new DynamicMock(typeof(IUseCase));
            DynamicMock engine = new DynamicMock(typeof(IRegexEngine));
            DynamicMock view = new DynamicMock(typeof(IRegexView));

            IRegexView viewMockInstance = (IRegexView)view.MockInstance;
            IUseCase useCaseMockInstance = (IUseCase)useCase.MockInstance;
            IRegexEngine engineMockInstance = (IRegexEngine)engine.MockInstance;

            #endregion

            useCase.ExpectAndReturn("CreateNewView", viewMockInstance);
            useCase.ExpectAndReturn("CreateNewEngine", engineMockInstance);
            engine.Expect("AttachView", withSameObjectAs(viewMockInstance));
            view.Expect("Init", withSameObjectAs(engineMockInstance));

            ViewManager factory = new ViewManager();
            IRegexView newView = factory.CreateView(useCaseMockInstance);

            useCase.Verify();
            engine.Verify();
            view.Verify();

            Assert.AreSame(newView, viewMockInstance,"Returned view is not the same instance as expected");
        }
		public void SetupAndTeardownRemotingInfrastructure()
		{
			string configFile = CreateTemporaryConfigurationFile();

			IMock mockCruiseManager = new RemotingMock(typeof (ICruiseManager));
			IMock mockCruiseServer = new DynamicMock(typeof (ICruiseServer));
			mockCruiseServer.ExpectAndReturn("CruiseManager", mockCruiseManager.MockInstance);
			mockCruiseServer.ExpectAndReturn("CruiseManager", mockCruiseManager.MockInstance);
			mockCruiseServer.Expect("Dispose");

			using (new RemoteCruiseServer((ICruiseServer) mockCruiseServer.MockInstance, configFile))
			{
				Assert.AreEqual(2, ChannelServices.RegisteredChannels.Length);
				Assert.IsNotNull(ChannelServices.GetChannel("ccnet"), "ccnet channel is missing");
				Assert.IsNotNull(ChannelServices.GetChannel("ccnet2"), "ccnet2 channel is missing");

				ICruiseManager remoteManager = (ICruiseManager) RemotingServices.Connect(typeof (ICruiseManager), "tcp://localhost:35354/" + RemoteCruiseServer.ManagerUri);
				Assert.IsNotNull(remoteManager, "cruiseserver should be registered on tcp channel");

				remoteManager = (ICruiseManager) RemotingServices.Connect(typeof (ICruiseManager), "http://localhost:35355/" + RemoteCruiseServer.ManagerUri);
				Assert.IsNotNull(remoteManager, "cruiseserver should be registered on http channel");
			}
			Assert.AreEqual(0, ChannelServices.RegisteredChannels.Length, "all registered channels should be closed.");
			mockCruiseServer.Verify();
			mockCruiseManager.Verify();
		}
Пример #8
0
		public void Init()
		{
			m_mock = new DynamicMock(typeof(IIgnoreOrderTest));
			m_mock.Expect("Method",
				new object[] { new IgnoreOrderConstraint(0, 1, 2 )},
				new string[] { typeof(int[]).FullName });
			m_mock.AdditionalReferences = new string[] { "COMInterfacesTests.dll" };
		}
Пример #9
0
		public void PublishersShouldBeTasks()
		{
			IMock mock = new DynamicMock(typeof (ITask));
			IntegrationResult result = new IntegrationResult();
			mock.Expect("Run", result);

			ITask publisher = (ITask) mock.MockInstance;
			publisher.Run(result);
		}
		public void MethodsAndPropertiesDoSimpleDelagationOntoInjectedMonitor()
		{
			DynamicMock mockProjectMonitor = new DynamicMock(typeof (IProjectMonitor));

			SynchronizedProjectMonitor monitor = new SynchronizedProjectMonitor(
				(IProjectMonitor) mockProjectMonitor.MockInstance, null);

			mockProjectMonitor.ExpectAndReturn("ProjectState", null);
			Assert.IsNull(monitor.ProjectState);

            Dictionary<string, string> parameters = new Dictionary<string, string>();
			mockProjectMonitor.Expect("ForceBuild", parameters, (string)null);
			monitor.ForceBuild(parameters, null);

			mockProjectMonitor.Expect("Poll");
			monitor.Poll();

			mockProjectMonitor.Verify();
		}
Пример #11
0
        public void CannotYetMockMembersWithOnlyAParamsArgument()
        {
            IMock mock = new DynamicMock(typeof(IWithParams));

            mock.Expect("WithoutLeadingParameter", new Object[] { 1, 2, 3 });

            IWithParams p = (IWithParams)mock.MockInstance;

            p.WithoutLeadingParameter(1, 2, 3);
            mock.Verify();
        }
Пример #12
0
        [Test] public void CanSetAndGetPropertiesOnAMockedInterface()
        {
            DynamicMock   mock         = new DynamicMock(typeof(IWithProperty));
            IWithProperty withProperty = (IWithProperty)mock.MockInstance;

            mock.ExpectAndReturn("Name", "fred");
            mock.Expect("Name", "joe");

            AssertEquals("Should be property Name", "fred", withProperty.Name);
            withProperty.Name = "joe";

            mock.Verify();
        }
Пример #13
0
        [Test] public void SetAndGetPropertiesDoesNotWorkWithSetupReturn()
        {
            DynamicMock   mock         = new DynamicMock(typeof(IWithProperty));
            IWithProperty withProperty = (IWithProperty)mock.MockInstance;

            mock.SetupResult("Name", "fred");
            mock.Expect("Name", "jim");

            AssertEquals("Should be property Name", "fred", withProperty.Name);
            withProperty.Name = "jim";

            mock.Verify();
        }
Пример #14
0
        [Test] public void CanMockMethodWithConstraint()
        {
            IMock mock = new DynamicMock(typeof(TwoMethods));

            mock.Expect("Foo", new StartsWith("Hello"));
            mock.ExpectAndReturn("Bar", 5, new NotNull());

            TwoMethods instance = (TwoMethods)mock.MockInstance;

            instance.Foo("Hello World");
            Assertion.AssertEquals("Should get a result", 5, instance.Bar("not null"));

            mock.Verify();
        }
Пример #15
0
        public void FailWhenMockedPropertyNotVirtual()
        {
            IMock otherFull = new DynamicMock(typeof(OtherFull));

            try
            {
                otherFull.Expect("Bar", "test");
                Fail();
            }
            catch (ArgumentException e)
            {
                AssertEquals("Property <Bar> is not virtual", e.Message);
            }
        }
		public void ShouldOnlyDisposeOnce()
		{
			string configFile = CreateTemporaryConfigurationFile();
			IMock mockCruiseManager = new RemotingMock(typeof (ICruiseManager));
			IMock mockCruiseServer = new DynamicMock(typeof (ICruiseServer));
			mockCruiseServer.ExpectAndReturn("CruiseManager", mockCruiseManager.MockInstance);
			mockCruiseServer.ExpectAndReturn("CruiseManager", mockCruiseManager.MockInstance);
			mockCruiseServer.Expect("Dispose");

			RemoteCruiseServer server = new RemoteCruiseServer((ICruiseServer) mockCruiseServer.MockInstance, configFile);
			((IDisposable)server).Dispose();

			mockCruiseServer.ExpectNoCall("Dispose");
			((IDisposable)server).Dispose();
			mockCruiseServer.Verify();
		}
		public void WhenBuildOccurredIsFiredTheDelegateIsInvokedThroughISynchronisedInvoke()
		{
			DynamicMock mockSynchronizeInvoke = new DynamicMock(typeof (ISynchronizeInvoke));
			StubServerMonitor containedMonitor = new StubServerMonitor(@"tcp://blah/");

			SynchronizedServerMonitor monitor = new SynchronizedServerMonitor(
				containedMonitor,
				(ISynchronizeInvoke) mockSynchronizeInvoke.MockInstance);

			MonitorServerQueueChangedEventHandler delegateToQueueChanged = new MonitorServerQueueChangedEventHandler(Monitor_QueueChanged);
			monitor.QueueChanged += delegateToQueueChanged;

			mockSynchronizeInvoke.Expect("BeginInvoke", delegateToQueueChanged, new IsTypeOf(typeof (object[])));
			containedMonitor.OnQueueChanged(new MonitorServerQueueChangedEventArgs(null));

			mockSynchronizeInvoke.Verify();
		}
		public void WhenPolledIsFiredTheDelegateIsInvokedThroughISynchronisedInvoke()
		{
			DynamicMock mockSynchronizeInvoke = new DynamicMock(typeof (ISynchronizeInvoke));
			StubProjectMonitor containedMonitor = new StubProjectMonitor("test");

			SynchronizedProjectMonitor monitor = new SynchronizedProjectMonitor(
				containedMonitor,
				(ISynchronizeInvoke) mockSynchronizeInvoke.MockInstance);

			MonitorPolledEventHandler delegateToPolledMethod = new MonitorPolledEventHandler(Monitor_Polled);
			monitor.Polled += delegateToPolledMethod;

			mockSynchronizeInvoke.Expect("BeginInvoke", delegateToPolledMethod, new IsTypeOf(typeof (object[])));
			containedMonitor.OnPolled(new MonitorPolledEventArgs(containedMonitor));

			mockSynchronizeInvoke.Verify();
		}
		public void WhenBuildOccurredIsFiredTheDelegateIsInvokedThroughISynchronisedInvoke()
		{
			DynamicMock mockSynchronizeInvoke = new DynamicMock(typeof (ISynchronizeInvoke));
			StubProjectMonitor containedMonitor = new StubProjectMonitor("test");

			SynchronizedProjectMonitor monitor = new SynchronizedProjectMonitor(
				containedMonitor,
				(ISynchronizeInvoke) mockSynchronizeInvoke.MockInstance);

			MonitorBuildOccurredEventHandler delegateToBuildOccurred = new MonitorBuildOccurredEventHandler(Monitor_BuildOccurred);
			monitor.BuildOccurred += delegateToBuildOccurred;

			mockSynchronizeInvoke.Expect("BeginInvoke", delegateToBuildOccurred, new IsTypeOf(typeof (object[])));
			containedMonitor.OnBuildOccurred(new MonitorBuildOccurredEventArgs(null, BuildTransition.StillFailing));

			mockSynchronizeInvoke.Verify();
		}
Пример #20
0
        public void RunForceBuild()
        {
            Workflow project = new Workflow();
            IMock taskMock1 = new DynamicMock(typeof (ITask));
            taskMock1.Expect("Run", new NotNull());

            IMock taskMock2 = new DynamicMock(typeof (ITask));
            taskMock2.Expect("Run", new NotNull());

            project.Tasks.Add(taskMock1.MockInstance);
            project.Tasks.Add(taskMock2.MockInstance);

            project.Integrate(ForceBuildRequest());

            taskMock1.Verify();
            taskMock2.Verify();
        }
		public void MethodsAndPropertiesDoSimpleDelagationOntoInjectedMonitor()
		{
			DynamicMock mockServerMonitor = new DynamicMock(typeof (ISingleServerMonitor));

			SynchronizedServerMonitor monitor = new SynchronizedServerMonitor(
				(ISingleServerMonitor) mockServerMonitor.MockInstance, null);

			mockServerMonitor.ExpectAndReturn("ServerUrl", @"tcp://blah/");
			Assert.AreEqual(@"tcp://blah/", monitor.ServerUrl);

			mockServerMonitor.ExpectAndReturn("IsConnected", true);
			Assert.AreEqual(true, monitor.IsConnected);

			mockServerMonitor.Expect("Poll");
			monitor.Poll();

			mockServerMonitor.Verify();
		}
Пример #22
0
		public void ForceBuildCruiseServerProject()
		{
			ConsoleRunnerArguments consoleArgs = new ConsoleRunnerArguments();
			consoleArgs.Project = "test";
			
			Mock mockCruiseServer = new DynamicMock(typeof(ICruiseServer));
            var projectConstraint = new ProjectRequestConstraint
            {
                ProjectName = "test"
            };
            mockCruiseServer.ExpectAndReturn("ForceBuild", new Response { Result = ResponseResult.Success }, projectConstraint);
            mockCruiseServer.ExpectAndReturn("Stop", new Response { Result = ResponseResult.Success }, projectConstraint);
            mockCruiseServer.Expect("WaitForExit", projectConstraint);
			Mock mockCruiseServerFactory = new DynamicMock(typeof(ICruiseServerFactory));
			mockCruiseServerFactory.ExpectAndReturn("Create", mockCruiseServer.MockInstance, consoleArgs.UseRemoting, consoleArgs.ConfigFile);

			new ConsoleRunner(consoleArgs, (ICruiseServerFactory)mockCruiseServerFactory.MockInstance).Run();

			mockCruiseServer.Verify();
		}	
		public void PassesThroughLabelSourceControl()
		{
			//// SETUP
			IntegrationResult result = new IntegrationResult();

			DynamicMock mockSC1 = new DynamicMock(typeof (ISourceControl));
			mockSC1.Expect("LabelSourceControl", result);

			DynamicMock mockSC2 = new DynamicMock(typeof (ISourceControl));
			mockSC2.Expect("LabelSourceControl", result);

			ISourceControl[] sourceControls = new ISourceControl[] {(ISourceControl) mockSC1.MockInstance, (ISourceControl) mockSC2.MockInstance};

			MultiSourceControl multiSourceControl = new MultiSourceControl();
			multiSourceControl.SourceControls = sourceControls;

			//// EXECUTE
			multiSourceControl.LabelSourceControl(result);

			//// VERIFY
			mockSC1.Verify();
			mockSC2.Verify();
		}
Пример #24
0
        public void Run()
        {
            Workflow project = new Workflow();
            IMock taskMock1 = new DynamicMock(typeof (ITask));
            taskMock1.Expect("Run", new NotNull());

            IMock taskMock2 = new DynamicMock(typeof (ITask));
            taskMock2.Expect("Run", new NotNull());

            IMock taskMock3 = new DynamicMock(typeof (ITask));
            taskMock3.Expect("Run", new NotNull());

            project.Tasks.Add(taskMock1.MockInstance);
            project.Tasks.Add(taskMock2.MockInstance);
            project.Integrate(ModificationExistRequest());

            Assert.IsNotNull(project.CurrentIntegration);
            Assert.IsNotNull(project.CurrentIntegration.StartTime);
            Assert.IsNotNull(project.CurrentIntegration.EndTime);
            Assert.IsNotNull(project.CurrentIntegration.EndTime > project.CurrentIntegration.StartTime);
            Assert.AreEqual(project.CurrentIntegration.Status, project.LatestBuildStatus);
            taskMock1.Verify();
            taskMock2.Verify();
        }
Пример #25
0
		[Test] public void SetAndGetPropertiesDoesNotWorkWithSetupReturn()
		{
			DynamicMock mock = new DynamicMock(typeof(IWithProperty));
			IWithProperty withProperty = (IWithProperty)mock.MockInstance;

			mock.SetupResult("Name", "fred");
			mock.Expect("Name", "jim");

			AssertEquals("Should be property Name", "fred", withProperty.Name);
			withProperty.Name = "jim";

			mock.Verify();
		}
Пример #26
0
		[Test] public void CanSetAndGetPropertiesOnAMockedInterface()
		{
			DynamicMock mock = new DynamicMock(typeof(IWithProperty));
			IWithProperty withProperty = (IWithProperty)mock.MockInstance;

			mock.ExpectAndReturn("Name", "fred");
			mock.Expect("Name", "joe");

			AssertEquals("Should be property Name", "fred", withProperty.Name);
			withProperty.Name = "joe";

			mock.Verify();
		}
Пример #27
0
		[Test] public void CanMockMethodWithConstraint()
		{
			IMock mock = new DynamicMock(typeof(TwoMethods));
			mock.Expect("Foo", new StartsWith("Hello"));
			mock.ExpectAndReturn("Bar", 5, new NotNull());

			TwoMethods instance = (TwoMethods)mock.MockInstance;
			instance.Foo("Hello World");
			Assertion.AssertEquals("Should get a result", 5, instance.Bar("not null"));

			mock.Verify();
		}
Пример #28
0
		public void CanMockOverloadedMethods()
		{
			IMock mock = new DynamicMock(typeof(IOverloadedMethods));
			mock.Expect("DoStuff", "one", 2);
			mock.Expect("DoStuff", "one");

			IOverloadedMethods instance = (IOverloadedMethods)mock.MockInstance;
			instance.DoStuff("one", 2);
			instance.DoStuff("one");
			mock.Verify();
		}
Пример #29
0
		public void CannotYetMockMembersWithOnlyAParamsArgument()
		{
			IMock mock = new DynamicMock(typeof(IWithParams));
			mock.Expect("WithoutLeadingParameter", new Object[] {1, 2, 3});

			IWithParams p = (IWithParams)mock.MockInstance;
			p.WithoutLeadingParameter(1, 2, 3);
			mock.Verify();
		}
		public override void TestSetup()
		{
			base.TestSetup();

			m_styleSheet = new DynamicMock(typeof(IVwStylesheet));
			m_styleSheet.Strict = true;

			// Set up a default selection helper. Tests may choose to create a different one.
			m_selHelper = new DynamicMock(typeof(SelectionHelper));
			m_selHelper.Strict = true;
			m_selHelper.SetupResult("NumberOfLevels", 4);
			m_selHelper.SetupResult("RestoreSelectionAndScrollPos", true);
			BTInsertVerseAndFootnoteTests.InitializeVwSelection(m_selHelper);
			SelectionHelper.s_mockedSelectionHelper = (SelectionHelper)m_selHelper.MockInstance;

			m_draftView = new DummyDraftView(Cache, false, 0);
			m_draftView.BookFilter.Add(m_book);

			m_draftView.RootBox = SetupRootBox();
			m_draftView.Graphics = SetupGraphics();
			m_draftView.MakeRoot();
			m_draftView.StyleSheet = (IVwStylesheet)m_styleSheet.MockInstance;
			m_draftView.ActivateView();

			m_rootBox.Strict = true;

			SelLevInfo[] selLevInfo = new SelLevInfo[4];
			selLevInfo[3].tag = m_draftView.BookFilter.Tag;
			selLevInfo[2].tag = ScrBookTags.kflidSections;
			selLevInfo[2].ihvo = 0;
			selLevInfo[0].ihvo = 0;
			selLevInfo[0].tag = StTextTags.kflidParagraphs;
			m_selHelper.SetupResult("LevelInfo", selLevInfo);
			m_selHelper.SetupResult("GetLevelInfo", selLevInfo,
				new Type[] { typeof(SelectionHelper.SelLimitType) });
			m_selHelper.Expect("SetIPAfterUOW");
		}
Пример #31
0
		internal DummyICU()
		{
			m_icu = new DynamicMock(typeof(IUnicodeCharacters));
			m_mockICU = (IUnicodeCharacters)m_icu.MockInstance;
			m_icu.Expect("Init");
		}
Пример #32
0
		public void AddHyperlink()
		{
			ITsStrBldr strBldr = TsStrBldrClass.Create();
			DynamicMock mockStylesheet = new DynamicMock(typeof(FwStyleSheet));
			mockStylesheet.Strict = true;
			DynamicMock mockHyperlinkStyle = new DynamicMock(typeof(StStyle));
			mockHyperlinkStyle.Strict = true;
			mockHyperlinkStyle.Expect("InUse", true);
			mockStylesheet.ExpectAndReturn("FindStyle", (IStStyle)mockHyperlinkStyle.MockInstance, StStyle.Hyperlink);
			FwStyleSheet styleSheet = (FwStyleSheet)mockStylesheet.MockInstance;

			Assert.IsTrue(EditingHelper.AddHyperlink(strBldr, Cache.DefaultAnalWs, "Click Here",
				"www.google.com", styleSheet));
			Assert.AreEqual(1, strBldr.RunCount);
			Assert.AreEqual("Click Here", strBldr.get_RunText(0));
			ITsTextProps props = strBldr.get_Properties(0);
			StStyleTests.AssertHyperlinkPropsAreCorrect(props, Cache.DefaultAnalWs, "www.google.com");
			mockHyperlinkStyle.Verify();
			mockStylesheet.Verify();
		}
		public void ShouldInstructAggregatedSourceControlsToGetSource()
		{
			IntegrationResult result = new IntegrationResult();
			IMock mockSC1 = new DynamicMock(typeof (ISourceControl));
			IMock mockSC2 = new DynamicMock(typeof (ISourceControl));
			mockSC1.Expect("GetSource", result);
			mockSC2.Expect("GetSource", result);

			MultiSourceControl multiSourceControl = new MultiSourceControl();
			multiSourceControl.SourceControls = new ISourceControl[] {(ISourceControl) mockSC1.MockInstance, (ISourceControl) mockSC2.MockInstance};
			multiSourceControl.GetSource(result);

			mockSC1.Verify();
			mockSC2.Verify();
		}
Пример #34
0
        public void RunWhereFirstTaskThrowsException()
        {
            Workflow project = new Workflow();
            Exception ex = new CruiseControlException("foo");
            IMock taskMock1 = new DynamicMock(typeof (ITask));
            taskMock1.ExpectAndThrow("Run", ex, new NotNull());

            IMock taskMock2 = new DynamicMock(typeof (ITask));
            taskMock2.Expect("Run", new NotNull());

            project.Tasks.Add(taskMock1.MockInstance);
            project.Tasks.Add(taskMock2.MockInstance);

            IIntegrationResult result = project.Integrate(ModificationExistRequest());

            taskMock1.Verify();
            taskMock2.Verify();
            Assert.AreEqual(IntegrationStatus.Exception, result.Status);
            Assert.AreEqual(ex, result.ExceptionResult);
        }
Пример #35
0
		public void IFwTool_NewMainWndWithSel()
		{
			CheckDisposed();

			int pidNew;
			DummyRootSite.s_mockVwRootSite = new DynamicMock(typeof(IVwRootSite));
			DynamicMock rootBox = new DynamicMock(typeof(IVwRootBox));

			DummyRootSite.s_mockVwRootSite.ExpectAndReturn("RootBox", rootBox.MockInstance);
			rootBox.Expect("MakeTextSelection", new object[] {4711, 0, null, 3001001, 0, 10,
				10, 0, true, -1, null, true }, new string[] {"System.Int32", "System.Int32",
				typeof(SelLevInfo[]).FullName, "System.Int32", "System.Int32", "System.Int32",
				"System.Int32", "System.Int32", "System.Boolean", "System.Int32",
				typeof(ITsTextProps).FullName, "System.Boolean" });

			int hTool = m_app.NewMainWndWithSel(MiscUtils.LocalServerName, "TestLangProj",
				1, 0, 0, 0, 0, new int[] { 4711 }, 1, new int[] { 3001001 }, 1, 10, -1,
				out pidNew);

			DummyRootSite.s_mockVwRootSite.Verify();
			rootBox.Verify();
			DummyRootSite.s_mockVwRootSite = null;
		}
Пример #36
0
		public void FailWhenMockedPropertyNotVirtual()
		{
			IMock otherFull = new DynamicMock(typeof(OtherFull));

			try
			{
				otherFull.Expect("Bar", "test");
				Fail();
			}
			catch(ArgumentException e)
			{
				AssertEquals("Property <Bar> is not virtual", e.Message);
			}
		}