public void InitializeShouldLogFirstAndLastElementAndRandom() { contextMock.Setup(c => c.GetProperty(ScenarioWorker.GetPropertyKey("random"), It.IsAny <string>())).Returns(bool.TrueString); contextMock.Setup(c => c.GetProperty(ScenarioWorker.GetPropertyKey("seed"), It.IsAny <string>())).Returns("345"); scenaroio.Initialize(); loggerMock.Verify(l => l.Info("OnInitialize: FirstElement = 1, LastElement = 100, IsRandom = True, Seed = 345")); }
public void InitializeShouldNotInitializeRandomWhenRandomPropertyIsFalse() { contextMock.Setup(c => c.GetProperty(ScenarioWorker.GetPropertyKey("random"), It.IsAny <string>())).Returns(bool.FalseString); scenaroio.Initialize(); Assert.That(scenaroio.Random, Is.Null); }
public void InitializeShouldUseRandomValueWhenRandomPropertyIsProvided() { contextMock.Setup(c => c.GetProperty(ScenarioWorker.GetPropertyKey("random"), It.IsAny <string>())).Returns(bool.FalseString); scenaroio.Initialize(); Assert.That(scenaroio.IsRandom, Is.False); }
public void LastElementPropertyShouldBeNotBeLessThanFirstElement() { contextMock.Setup(c => c.GetProperty(ScenarioWorker.GetPropertyKey("lastElement"), "100")).Returns("0"); Assert.Throws(Is.TypeOf <ArgumentException>().And.Message.EqualTo("Property 'grinderscript-dotnet.scenarioWorker.lastElement' can not be < 'grinderscript-dotnet.scenarioWorker.firstElement' (1), but was 0"), () => scenaroio.Initialize()); }
public void InitializeShouldUseDefaultLastElementWhenPropertyIsMissing() { scenaroio.Initialize(); contextMock.Verify(c => c.GetProperty(ScenarioWorker.GetElementPropertyKey(100, "workerType"))); }
public void InitializeShouldUseLastElementValueWhenPropertyIsProvided() { contextMock.Setup(c => c.GetProperty(ScenarioWorker.GetPropertyKey("lastElement"), "100")).Returns("3"); scenaroio.Initialize(); contextMock.Verify(c => c.GetProperty(ScenarioWorker.GetElementPropertyKey(100, "workerType")), Times.Never()); }