internal static GivenBlock <Factory, Factory> AndRulesNotNul <TInput>(this GivenBlock <TInput, Factory> givenBlock) { return(givenBlock.And("Rules not null", factory => { Assert.IsNotNull(factory.Rules, "Rules cannot be null"); return factory; })); }
protected virtual GivenBlock <TResult> Given <TResult>(string description, Func <TResult> func) { LoggingHelper.Info($"[given] (start) {description}"); var given = new GivenBlock <TResult> { Result = func() }; LoggingHelper.Info($"[given] (end) {description}"); return(given); }
/// <summary> /// Given block for add rules. /// </summary> /// <typeparam name="TInput">Input type</typeparam> /// <typeparam name="TFactory">Fact factory type.</typeparam> /// <param name="givenBlock">Previous given block</param> /// <param name="factRules">Fact rules</param> /// <returns>Given block.</returns> public static GivenBlock <TFactory, TFactory> AndAddRules <TInput, TFactory>(this GivenBlock <TInput, TFactory> givenBlock, FactRuleCollectionBase <FactRule> factRules) where TFactory : FactFactoryBase <FactRule, FactRuleCollection, WantAction, FactContainer> { return(givenBlock.And("Add rules", factory => factory.Rules.AddRange(factRules))); }
/// <summary> /// Check error code and reason. /// </summary> /// <param name="givenBlock"></param> /// <param name="code"></param> /// <param name="reason"></param> /// <returns></returns> public static GivenBlock <GetcuReoneException, GetcuReoneException> AndAssertError <TIn>(this GivenBlock <TIn, GetcuReoneException> givenBlock, string code, string reason) { return(givenBlock.And($"Check error. Code <{code}>, Reason <{reason}>.", error => AssertError(error, code, reason))); }
public static GivenBlock <IFact, IFactType> AndCreateFactType <TInput>(this GivenBlock <TInput, IFact> givenBlock) { return(givenBlock.And("Create factInfo", fact => fact.GetFactType())); }