public void Candidate_One(Mock<ISciencePublisher> publisher, Mock<IScienceExperiment<string, string>> experiment, string candResult, Mock<IExperimentSteps<string, string>> steps, string name) { //Setup publisher.SetupAllProperties(); experiment.SetupAllProperties(); steps.SetupAllProperties(); experiment.SetupGet(x => x.Steps).Returns(steps.Object); Func<string> candidate = () => candResult; //Exercise var sut = new Laboratory(publisher.Object, true); sut.CreateExperiment(experiment.Object) .Candidate(name, candidate); //Verify steps.Verify(x => x.AddCandidate(name, candidate), Times.Once); }
public void AreEqual(Mock<ISciencePublisher> publisher, Mock<IScienceExperiment<string, string>> experiment, string ctrlResult, Mock<IExperimentSteps<string, string>> steps) { //Setup publisher.SetupAllProperties(); experiment.SetupAllProperties(); steps.SetupAllProperties(); experiment.SetupGet(x => x.Steps).Returns(steps.Object); Func<string> control = () => ctrlResult; AreEqualDelegate<string> areEqual = (ctrl, cand) => ctrl == cand; //Exercise var sut = new Laboratory(publisher.Object, true); sut.CreateExperiment(experiment.Object) .Control(control) .AreEqual(areEqual); //Verify steps.VerifySet(x => x.AreEqual = areEqual, Times.Once); }
public void Control(Mock <ISciencePublisher> publisher, Mock <IScienceExperiment <string, string> > experiment, string ctrlResult, Mock <IExperimentSteps <string, string> > steps) { //Setup publisher.SetupAllProperties(); experiment.SetupAllProperties(); steps.SetupAllProperties(); experiment.SetupGet(x => x.Steps).Returns(steps.Object); Func <string> control = () => ctrlResult; //Exercise var sut = new Laboratory(publisher.Object, true); sut.CreateExperiment(experiment.Object) .Control(control); //Verify steps.VerifySet(x => x.Control = control, Times.Once); }
public void Candidate_One(Mock <ISciencePublisher> publisher, Mock <IScienceExperiment <string, string> > experiment, string candResult, Mock <IExperimentSteps <string, string> > steps, string name) { //Setup publisher.SetupAllProperties(); experiment.SetupAllProperties(); steps.SetupAllProperties(); experiment.SetupGet(x => x.Steps).Returns(steps.Object); Func <string> candidate = () => candResult; //Exercise var sut = new Laboratory(publisher.Object, true); sut.CreateExperiment(experiment.Object) .Candidate(name, candidate); //Verify steps.Verify(x => x.AddCandidate(name, candidate), Times.Once); }
public void Teardown(Mock <ISciencePublisher> publisher, Mock <IScienceExperiment <string, string> > experiment, string ctrlResult, Mock <IExperimentSteps <string, string> > steps) { //Setup publisher.SetupAllProperties(); experiment.SetupAllProperties(); steps.SetupAllProperties(); experiment.SetupGet(x => x.Steps).Returns(steps.Object); Func <string> control = () => ctrlResult; bool raised = false; EventHandler <ExperimentEventArgs> teardown = (sender, e) => raised = true; //Exercise var sut = new Laboratory(publisher.Object, true); sut.CreateExperiment(experiment.Object) .Control(control) .Teardown(teardown); steps.Raise(x => x.TeardownEvent += null, new ExperimentEventArgs()); //Verify Assert.True(raised); }
public void Teardown(Mock<ISciencePublisher> publisher, Mock<IScienceExperiment<string, string>> experiment, string ctrlResult, Mock<IExperimentSteps<string, string>> steps) { //Setup publisher.SetupAllProperties(); experiment.SetupAllProperties(); steps.SetupAllProperties(); experiment.SetupGet(x => x.Steps).Returns(steps.Object); Func<string> control = () => ctrlResult; bool raised = false; EventHandler<ExperimentEventArgs> teardown = (sender, e) => raised = true; //Exercise var sut = new Laboratory(publisher.Object, true); sut.CreateExperiment(experiment.Object) .Control(control) .Teardown(teardown); steps.Raise(x => x.TeardownEvent += null, new ExperimentEventArgs()); //Verify Assert.True(raised); }
public void SetContext(Mock<ISciencePublisher> publisher, Mock<IScienceExperiment<string, string>> experiment, string ctrlResult, Mock<IExperimentSteps<string, string>> steps) { //Setup publisher.SetupAllProperties(); experiment.SetupAllProperties(); steps.SetupAllProperties(); experiment.SetupGet(x => x.Steps).Returns(steps.Object); Func<string> control = () => ctrlResult; Func<object> setContext = () => true; //Exercise var sut = new Laboratory(publisher.Object, true); sut.CreateExperiment(experiment.Object) .Control(control) .SetContext(setContext); //Verify steps.VerifySet(x => x.SetContext = setContext, Times.Once); }
public void Prepare(Mock<ISciencePublisher> publisher, Mock<IScienceExperiment<string, string>> experiment, string ctrlResult, Mock<IExperimentSteps<string, string>> steps) { //Setup publisher.SetupAllProperties(); experiment.SetupAllProperties(); steps.SetupAllProperties(); experiment.SetupGet(x => x.Steps).Returns(steps.Object); Func<string> control = () => ctrlResult; PrepareDelegate<string, string> prepare = (val) => val; //Exercise var sut = new Laboratory(publisher.Object, true); sut.CreateExperiment(experiment.Object) .Control(control) .Prepare(prepare); //Verify steps.VerifySet(x => x.Prepare = prepare, Times.Once); }