本文整理汇总了C#中Step类的典型用法代码示例。如果您正苦于以下问题:C# Step类的具体用法?C# Step怎么用?C# Step使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Step类属于命名空间,在下文中一共展示了Step类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Matches
public bool Matches(MethodInfo Method, Step Step)
{
this.Method = Method;
this.Step = Step;
return MatchesName && MatchesArgs;
}
示例2: ReportOnStep
void ReportOnStep(Scenario scenario, Step step)
{
var message =
string.Format
("\t{0} [{1}] ",
PrefixWithSpaceIfRequired(step).PadRight(_longestStepSentence + 5),
Configurator.Scanners.Humanize(step.Result.ToString()));
// if all the steps have passed, there is no reason to make noise
if (scenario.Result == Result.Passed)
message = "\t" + PrefixWithSpaceIfRequired(step);
if (step.Exception != null)
{
_exceptions.Add(step.Exception);
var exceptionReference = string.Format("[Details at {0} below]", _exceptions.Count);
if (!string.IsNullOrEmpty(step.Exception.Message))
message += string.Format("[{0}] {1}", FlattenExceptionMessage(step.Exception.Message), exceptionReference);
else
message += string.Format("{0}", exceptionReference);
}
if (step.Result == Result.Inconclusive || step.Result == Result.NotImplemented)
Console.ForegroundColor = ConsoleColor.Yellow;
else if (step.Result == Result.Failed)
Console.ForegroundColor = ConsoleColor.Red;
else if (step.Result == Result.NotExecuted)
Console.ForegroundColor = ConsoleColor.Gray;
Console.WriteLine(message);
Console.ForegroundColor = ConsoleColor.White;
}
示例3: AssertStep
private static void AssertStep(Step step, string stepTitle, ExecutionOrder order, bool asserts = false, bool shouldReport = true)
{
Assert.That(step.Title.Trim(), Is.EqualTo(stepTitle));
Assert.That(step.Asserts, Is.EqualTo(asserts));
Assert.That(step.ExecutionOrder, Is.EqualTo(order));
Assert.That(step.ShouldReport, Is.EqualTo(shouldReport));
}
示例4: ThenSingleScenarioWithStepsAddedSuccessfully
public void ThenSingleScenarioWithStepsAddedSuccessfully()
{
var excelScenarioFormatter = Container.Resolve<ExcelScenarioFormatter>();
var scenario = new Scenario
{
Name = "Test Feature",
Description =
"In order to test this feature,\nAs a developer\nI want to test this feature"
};
var given = new Step {NativeKeyword = "Given", Name = "a precondition"};
var when = new Step {NativeKeyword = "When", Name = "an event occurs"};
var then = new Step {NativeKeyword = "Then", Name = "a postcondition"};
scenario.Steps = new List<Step>(new[] {given, when, then});
using (var workbook = new XLWorkbook())
{
IXLWorksheet worksheet = workbook.AddWorksheet("SHEET1");
int row = 3;
excelScenarioFormatter.Format(worksheet, scenario, ref row);
worksheet.Cell("B3").Value.ShouldEqual(scenario.Name);
worksheet.Cell("C4").Value.ShouldEqual(scenario.Description);
row.ShouldEqual(8);
}
}
示例5: Start
void Start()
{
mDownloader = new AssetDownloader();
mPreStep = Step.None;
mStep = Step.HashmapHash;
// 读取本地的配置列表
string localFiles = UrlUtil.Combine(Settings.UNITY_RAW_FOLDER, "files");
if (File.Exists(localFiles))
{
string[] array = File.ReadAllLines(localFiles);
mLocalCfgMap = new Dictionary<string, AssetCfg>(array.Length);
for (int i = 0; i < array.Length; i++)
{
string line = array[i];
if (string.IsNullOrEmpty(line))
continue;
string[] cells = line.Split('|');
if (cells == null || cells.Length == 0)
continue;
AssetCfg cfg = new AssetCfg(cells);
mLocalCfgMap.Add(cfg.key, cfg);
}
}
else
{
mLocalCfgMap = new Dictionary<string, AssetCfg>();
}
}
示例6: GetMatch
public StepMatch GetMatch(Step step, ActionStepMethod stepMethod)
{
if (step.StepType != stepMethod.StepType) return StepMatch.NoMatch(step);
var stepTokens = Tokenize(step.Text);
var methodTokens = Tokenize(stepMethod.Text);
if (stepTokens.Length != methodTokens.Length) return StepMatch.NoMatch(step);
var tokens = new List<Token>();
for (var index = 0; index < stepTokens.Length; index++)
{
var tok1 = stepTokens[index];
var tok2 = methodTokens[index];
if (tok2 is VariableToken)
{
((VariableToken) tok2).Value = tok1.Text;
tokens.Add(tok2);
continue;
}
if (tok1.Text != tok2.Text)
{
return StepMatch.NoMatch(step);
}
tokens.Add(tok1);
}
return new StepMatch(step) {IsMatch = true, Tokens = tokens};
}
示例7: Apply
public override void Apply(Step step)
{
var databaseExists = DatabaseExists();
foreach (var script in step.Scripts)
{
if (!script.HasContent()) continue;
try
{
if (databaseExists)
{
var executeScriptResult = ExecuteScript(script);
ExamineForScriptError(executeScriptResult);
}
else
{
var executeScriptOnMasterResult = ExecuteScriptOnMaster(script);
ExamineForScriptError(executeScriptOnMasterResult);
}
}
catch (Exception scriptException)
{
RaiseOnScriptFailure(script, scriptException);
}
RaiseOnScriptSuccess(script);
}
}
示例8: EnsureComplete_should_throw_if_minimum_count_not_met
public void EnsureComplete_should_throw_if_minimum_count_not_met()
{
var step = new Step(Times.Once());
Assert.Throws<SequenceException>(() => step.EnsureComplete(""));
Assert.That(step.Complete, Is.False);
}
示例9: ExecuteAction
protected override void ExecuteAction(Context context, Step step)
{
Action<IDataReader> action = DisplayRow;
context.AddPublishedItem("Row Action", step.Id, action);
context.AddPublishedItem("String", step.Id, queryName);
context.AddPublishedItem("Configuration Info", step.Id, this);
}
示例10: ExecuteAction
protected override void ExecuteAction(Context context, Step step)
{
string first = step.GetParameterValue<string>("String", 1);
string second = step.GetParameterValue<string>("String", 2);
ServiceAgent.Currency from = (ServiceAgent.Currency)Enum.Parse(typeof(ServiceAgent.Currency), first, true);
ServiceAgent.Currency to = (ServiceAgent.Currency)Enum.Parse(typeof(ServiceAgent.Currency), second, true);
ConfigurationChannelFactory<ServiceAgent.CurrencyConvertorSoap> channelFactory = null;
double rate;
try
{
channelFactory = new ConfigurationChannelFactory<ServiceAgent.CurrencyConvertorSoap>("CurrencyConvertorSoap", conf.Configuration, null);
var client = channelFactory.CreateChannel();
rate = client.ConversionRate(from, to);
}
catch (Exception)
{
rate = double.NaN;
}
finally
{
if (channelFactory != null)
channelFactory.Close();
}
context.AddPublishedItem("Number", step.Id, rate);
}
示例11: AssertStep
private static void AssertStep(Step step, string stepTitle, ExecutionOrder order, bool asserts = false, bool shouldReport = true)
{
step.Title.Trim().ShouldBe(stepTitle);
step.Asserts.ShouldBe(asserts);
step.ExecutionOrder.ShouldBe(order);
step.ShouldReport.ShouldBe(shouldReport);
}
示例12: Move
public Move(Step step, Board board)
{
_board = board;
Step = new Step(step);
oldFrom = _board[(step.FromX << 3) + step.FromY];
oldTo = _board[(step.ToX << 3) + step.ToY];
}
示例13: CodeFunctionForUnimplemented
static CodeFunction CodeFunctionForUnimplemented(this Project project, Step Step)
{
return project.Classes()
.Where(x => x.Name == Step.Feature.Name)
.SelectMany(x => x.Functions())
.FirstOrDefault(x => x.EqualsTo(Step));
}
示例14: Waiter
public Waiter(Step step, Action completed = null, int timesToComplete = 1)
{
_time = new WaiterTime();
_step = step;
_timesToComplete = timesToComplete;
_completed = completed;
}
示例15: Action
/// <summary>
/// Creates instance of the <see cref="Action"></see> class with properties initialized with specified parameters.
/// </summary>
/// <param name="returnType">The return type of the action.</param>
/// <param name="when"><see cref="T:WixSharp.When"/> the action should be executed with respect to the <paramref name="step"/> parameter.</param>
/// <param name="step"><see cref="T:WixSharp.Step"/> the action should be executed before/after during the installation.</param>
/// <param name="condition">The launch condition for the <see cref="Action"/>.</param>
protected Action(Return returnType, When when, Step step, Condition condition)
{
Return = returnType;
Step = step;
When = when;
Condition = condition;
}