Exemple #1
0
        public void StuffCallsVisitor()
        {
            var mockVisitor = new Moq.Mock <IVisitor>();
            var sb          = new StuffBase(null, null);

            sb.Accept(mockVisitor.Object);
            mockVisitor.Verify(i => i.Visit(sb));
        }
Exemple #2
0
        public void StuffBaseUsesSource()
        {
            var srcMock = new Moq.Mock <ISource>();

            srcMock.Setup(i => i.GetValue()).Returns(3);
            var sb = new StuffBase(srcMock.Object, null);

            Assert.AreEqual(3, sb.GetValueFromInternalSource());
        }
Exemple #3
0
        public void StuffCallsCommand()
        {
            var mockCmd = new Moq.Mock <ICommand>();
            var mockSrc = new Moq.Mock <ISource>();

            mockSrc.Setup(i => i.GetValue()).Returns(1);
            var sb = new StuffBase(mockSrc.Object, mockCmd.Object);

            sb.ExecuteCommandIfSourceIsNonzero();
            mockCmd.Verify(i => i.Execute());
        }
Exemple #4
0
 public void StuffBaseInstantiates()
 {
     var sb = new StuffBase(null, null);
 }