public IApiAssertStrategy Create(ApiAssert apiAssert) { var apiAssertStrategy = _stepStrategies.FirstOrDefault(x => x.IsFor(apiAssert.GetType())); if (apiAssertStrategy == null) throw new NotImplementedException( string.Format("No step strategies were available to handle the '{0}' strategy type.", apiAssert.GetType().Name)); return apiAssertStrategy; }
public void Run(ScenarioContext context, ApiAssert apiAssert) { var assertStep = ((JavascriptAssert) apiAssert); string result = _valueRetriever.Retrieve(assertStep.JavascriptExpression, context.Payloads.ToArray()).ToString(); if (result != "True") { throw new StepException( string.Format("The javascript expression did not evaluate to true. Result was: {0}", result)); } }