小编cco*_*ker的帖子

SpecFlow:场景大纲示例

我刚开始使用SpecFlow并且非常喜欢这个工具.但是,我正在讨论与方案大纲中的示例数据输入相关的一些问题.

只是想知道我所面对的是正常的还是有一个技巧.

我正在使用C#Visual Studio 2013并使用下划线样式的步骤定义编写MVC应用程序.我也尝试过正则表达式样式,但仍然遇到类似的问题.

所以问题是我提供了用户名,密码等作为参数,并在我的示例中包含了示例数据.看来会发生以下情况: -

  1. 当第一次生成场景时,我必须在参数周围放置"",否则它根本不会被作为参数拾取.但是当从示例中传入数据时,我在传入数据的末尾得到一个"/".当我回到场景时,然后删除参数周围的"".这有点令人沮丧,但如果这是处理它的最佳方式,我可以忍受.只是想知道是否有人对这一点有任何建议.

  2. 下一个问题与数据本身有关.如果我的数据中有任何字符(如@或&等),那么它会在该点分割该数据并将其提供给下一个参数,这样我就会得到不正确的数据.

我已经在下面包含了我的代码 - 如果有人有任何建议或资源可以看,我将不胜感激.

功能文件 功能:AccountRegistration为了在我的组织中使用Mojito服务作为访客用户,我想创建一个具有管理privelages的帐户

Scenario Outline: Register with valid details
    Given I am on the registration page
        And I have completed the form with <email> <organisation> <password> and <passwordConfirmation>
    When I have clicked on the register button
    Then I will be logged in as <username>
        And my account will be assigned the role of <role>

        Examples: 
        | email     | organisation | password  | passwordConfirmation | username  | role  |
        | …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc acceptance-testing specflow gherkin

12
推荐指数
2
解决办法
5万
查看次数

Angular 2 rc.5原始例外:没有FormBuilder的提供者

我遇到了下面的表单生成器问题,一旦我将fb:FormBuilder放入身份验证组件的构造函数中,问题就出现在构造函数中,我得到以下错误:

错误

EXCEPTION: Error: Uncaught (in promise): EXCEPTION: Error in ./AuthenticationComponent class AuthenticationComponent_Host - inline template:0:0
ORIGINAL EXCEPTION: No provider for FormBuilder!
ORIGINAL STACKTRACE:
Error: DI Exception
    at NoProviderError.BaseException [as constructor] (http://localhost:4200/main.bundle.js:2013:23)
    at NoProviderError.AbstractProviderError [as constructor] (http://localhost:4200/main.bundle.js:32250:16)
    at new NoProviderError (http://localhost:4200/main.bundle.js:32287:16)
    at ReflectiveInjector_._throwOrNull (http://localhost:4200/main.bundle.js:62666:19)
    at ReflectiveInjector_._getByKeyDefault (http://localhost:4200/main.bundle.js:62694:25)
    at ReflectiveInjector_._getByKey (http://localhost:4200/main.bundle.js:62657:25)
    at ReflectiveInjector_.get (http://localhost:4200/main.bundle.js:62466:21)
    at NgModuleInjector.get (http://localhost:4200/main.bundle.js:45719:52)
    at ElementInjector.get (http://localhost:4200/main.bundle.js:62827:48)
    at ElementInjector.get (http://localhost:4200/main.bundle.js:62827:48)
ERROR CONTEXT:
Run Code Online (Sandbox Code Playgroud)

环境

  • Windows 10专业版
  • 节点6.5.0
  • angular-cli@1.0.0-beta.11-webpack.8
  • typescript@2.1.0-dev.20160
  • typings@1.3.3

的package.json

    {
  "name": "mojito",
  "version": "0.0.0",
  "license": "MIT",
  "angular-cli": …
Run Code Online (Sandbox Code Playgroud)

angular

10
推荐指数
1
解决办法
8005
查看次数

从Github Angular 4项目中排除环境文件

如何从Angular 4项目的github中排除环境文件。

我已经将.gitignore更新为以下内容,但是我的环境文件仍在同步到github:/ src / environments / **

# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp
/out-tsc

# dependencies
/node_modules

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
testem.log
/typings
/src/environments/**

# e2e
/e2e/*.js
/e2e/*.map

# System Files
.DS_Store
Thumbs.db
Run Code Online (Sandbox Code Playgroud)

git github angular-cli angular

7
推荐指数
1
解决办法
3253
查看次数

角动态形式和角材料

我在 Angular 5 中构建了一个动态表单组件(基于https://angular.io/guide/dynamic-form的文档和示例)。

一切正常,直到我尝试使用有角材料。

我在这里读过很多关于类似问题的文章,但它们似乎都是因为人们没有导入正确的模块或使用 mdInput 或 mat-Input 而不是 matInput。我遇到的问题并非如此。

任何想法或建议将不胜感激。

更改代码 - 因错误而中断 -

*mat-form-field 必须包含 MatFormFieldControl。***

动态表单控件组件模板

我对下面的工作代码所做的唯一更改是将输入字段包装起来并将 matInput 属性添加到输入字段。

我通过核心模块导入所有材质模块(MatFormFieldModule 和 MatInputModule 等)。我的所有材质输入和表单字段都在应用程序中的所有其他组件中工作,所以我不认为问题是我在导入中丢失了任何内容。

<div [formGroup]="form">

    <div [ngSwitch]="control.controlType">
        <mat-form-field>
            <input matInput placeholder="{{control.label}}" *ngSwitchCase="'textbox'" [formControlName]="control.key" [id]="control.key"
                [type]="control.type">
        </mat-form-field>
        <select [id]="control.label" *ngSwitchCase="'dropdown'" [formControlName]="control.key">
            <option value="">Select {{control.label}}</option>
            <option *ngFor="let opt of control.options" [value]="opt.key">{{opt.value}}</option>
        </select>
    </div>

    <div class="errorMessage" *ngIf="!isValid">{{control.label}} is required</div>
</div>
Run Code Online (Sandbox Code Playgroud)

当前代码-这工作完美,但我没有得到角度材料格式

选择器

<mi-dynamic-form [controls]="controls"></mi-dynamic-form>
Run Code Online (Sandbox Code Playgroud)

动态表单组件

    import { Component, Input } from '@angular/core';
import { FormGroup, FormControl } …
Run Code Online (Sandbox Code Playgroud)

dynamic-forms angular-material angular

5
推荐指数
1
解决办法
1万
查看次数

ToOADate(); 转换儒略日期 Excel

我正在使用 OpenXML 读取和 Excel 电子表格,并将日期存储为数字。据我了解,这是一种朱利安格式,我在谷歌上搜索的每个地方都说要使用 ToOADate(); 将这些数字转换为日期。

我遇到的问题是 ToOADate(); 在我的编译中没有解决。我正在使用 Visual Basic 2013,C# Asp.net MVC 应用程序。

看来这是在系统命名空间中,但我已经有一个 using System 语句。

我显然错过了一些非常基本的东西 - 有人可以帮忙吗?

 var test = 41725;
DateTime test2 = test.ToOADate();
Run Code Online (Sandbox Code Playgroud)

我得到的编译错误是

错误 4“int”不包含“ToOADate”的定义,并且找不到接受“int”类型的第一个参数的扩展方法“ToOADate”(您是否缺少 using 指令或程序集引用?)

c# excel datetime ms-office openxml

1
推荐指数
1
解决办法
2145
查看次数

Angular2 Firebase获取当前用户

我真的很难理解如何获取登录用户的当前用户ID并按该用户ID过滤列表.

我可以很容易地获得用户ID,但是在获得客户列表的电话时似乎没有.

如果有人可以协助或指出我正确的方向,我将不胜感激.

验证服务

import { Injectable } from "@angular/core";
import { AngularFire, AuthProviders, AuthMethods, FirebaseListObservable, FirebaseObjectObservable } from 'angularfire2';
import { UserModel } from '../users/models/user.model';

@Injectable()
export class AuthenticationService {

  public displayName: string;
  public userKey: string;
  public user: UserModel;

  constructor(public af: AngularFire) {
    this.af.auth.subscribe(
      (auth) => {
        if (auth != null) {
          this.user = this.af.database.object('users/' + auth.uid);
          this.userKey = auth.uid;
        }
      });
  }

  logout() {
    return this.af.auth.logout();
  }

  loginWithEmail(email, password) {
    return this.af.auth.login({
      email: email,
      password: password,
    },
      { …
Run Code Online (Sandbox Code Playgroud)

firebase firebase-authentication angularfire2 angular

1
推荐指数
2
解决办法
6564
查看次数

AG-Grid:无法更新网格中的字段,因为它是只读的

我正在尝试更新 ag-grid 中的一个字段,它不断返回错误类型错误:无法分配给对象“[对象对象]”的只读属性“数量”。

它允许我编辑单元格,但是当我尝试更新它时会出现此错误。

我正在使用来自 ngrx 存储的 observable 来填充 rowData,如下所示:

this.order$.subscribe(order => {
            this.order = { ...order, products: [...order.products] };
        });
Run Code Online (Sandbox Code Playgroud)

我已经检查了上面的内容,我可以通过说 this.orders.products = [] 来更新这个对象,它告诉我它不再是不可变的。

 <mi-ag-grid [data]="order.products" [columnDefs]="columnDefs" [suppressClickEdit]="false"></mi-ag-grid>

columnDefs = [
        {
            headerName: 'Code',
            field: 'code',
            width: 150
        },
        {
            headerName: 'Name',
            field: 'name',
            width: 200,
            editable: true
        },
        {
            headerName: 'Quantity',
            field: 'quantity',
            width: 150,
            editable: true
        }
    ];
Run Code Online (Sandbox Code Playgroud)

我接下来尝试了@GreyBeardedGeek 的建议,并尝试按照下面的方法使用 valueSetter 设置值,但仍然遇到相同的错误。

,
    {
        headerName: 'Quantity',
        width: 150,
        editable: true,
        field: 'quantity',
        valueSetter: quantityValueSetter
    },


function …
Run Code Online (Sandbox Code Playgroud)

ag-grid angular

1
推荐指数
1
解决办法
3022
查看次数