コード例 #1
0
        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();
        }
コード例 #2
0
        public void MethodsAndPropertiesDoSimpleDelagationOntoInjectedMonitor()
        {
            var mockProjectMonitor = new Mock <IProjectMonitor>();

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

            mockProjectMonitor.SetupGet(_monitor => _monitor.ProjectState).Returns(() => null).Verifiable();
            Assert.IsNull(monitor.ProjectState);

            Dictionary <string, string> parameters = new Dictionary <string, string>();

            mockProjectMonitor.Setup(_monitor => _monitor.ForceBuild(parameters, null)).Verifiable();
            monitor.ForceBuild(parameters, null);

            mockProjectMonitor.Setup(_monitor => _monitor.Poll()).Verifiable();
            monitor.Poll();

            mockProjectMonitor.Verify();
        }