public void SetUp() { contextMock = new Mock<IGrinderContext>(); contextMock.Setup(c => c.GetLogger(It.IsAny<Type>())).Returns(new Mock<IGrinderLogger>().Object); contextMock.Setup(c => c.ScriptFile).Returns(value: TestUtils.TestsAsScriptFile); loggerMock = new Mock<IGrinderLogger>(); loggerMock.SetupGet(l => l.IsTraceEnabled).Returns(true); loggerMock.SetupGet(l => l.IsDebugEnabled).Returns(true); loggerMock.SetupGet(l => l.IsInfoEnabled).Returns(true); loggerMock.SetupGet(l => l.IsWarnEnabled).Returns(true); loggerMock.SetupGet(l => l.IsErrorEnabled).Returns(true); contextMock.Setup(c => c.GetLogger(typeof(ScenarioWorker))).Returns(loggerMock.Object); contextMock.Setup(c => c.GetProperty(It.IsAny<string>(), It.IsAny<string>())).Returns((string k, string d) => d); scenaroio = new ScenarioWorker { GrinderContext = contextMock.Object, ProcessContext = TestUtils.CreateProcessContext(null, null, null, contextMock.Object)}; }
public void WorkerGroupShouldBeContextAware() { var actual = new ScenarioWorker { GrinderContext = contextMock.Object }; Assert.That(actual, Is.AssignableTo<IGrinderContextAware>()); Assert.That(actual.GrinderContext == contextMock.Object); }