小编abb*_*33f的帖子

Angular 2:没有ConnectionBackend的提供者

得到这个"ConnectionBackend没有提供者!" 尝试使用httppromise 时出错.

main.ts

// ... tl;dr import a bunch of stuff

platformBrowserDynamic().bootstrapModule(MyModule);
Run Code Online (Sandbox Code Playgroud)

myModule.ts

// ... tl;dr import a bunch of stuff

@NgModule({
 declarations: [
        PostComponent
  ],
  providers: [
    Actions,
    MyService,
    Http
  ],
  imports: [
    ...
  ],
  bootstrap: [MyComponent]
})
Run Code Online (Sandbox Code Playgroud)

myComponent.ts

import { Component, OnInit } from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {Observable} from 'rxjs/Observable';
import {MyService} from './../services/myService'
import {Post} from './post';

@Component({
  templateUrl: 'post.component.html',
  styleUrls: ['post.component.css']
})
export class MyComponent implements OnInit {
  post: …
Run Code Online (Sandbox Code Playgroud)

angular-http angular

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

为什么angular-cli会创建component/shared/index.ts?

如果我运行这个:

ng g component components/blogs
Run Code Online (Sandbox Code Playgroud)

我明白了

app
+--components
| +--blogs
| |  +--shared
| |  |  +--index.ts              // what's this for?
| |  +--blogs.component.css
| |  +--blogs.component.html
| |  +--blogs.component.ts
| |  +--blogs.component.spec.ts  // unit tests!
| |  +--index.ts
Run Code Online (Sandbox Code Playgroud)

我了解其余的,但是/blogs/shared/index.ts为了什么?如果组件文件夹仅用于组件,为什么组件具有共享文件夹?

shared angular-cli angular

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

Azure 逻辑应用程序:将 HTTP 请求标头键值获取到条件检查中

我在 Azure 门户中创建了一个逻辑应用程序。它由 HTTP POST 触发,在该 POST 中我设置了一个名为“jmb_private_key”的密钥。在逻辑应用程序收到 HTTP 请求后,我已经放置了一个我想检查密钥的条件。

检查Header CONTAINS 'myvalue'不起作用。
我想检查,Header.Keys['jmb_private_key'] EQUALS 'myvalue'但我不知道这是怎么做的。

在此处输入图片说明

当我检查逻辑应用程序的运行时,我看到正确的 JSON 有效负载已交付,但不满足条件,即使正确的值在 JSON 中。

在此处输入图片说明

azure-logic-apps

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

测试运行时未调用C#中的nUnit SetupFixture类

nUnit SetupFixture参考

使用SpecFlow Gherkin功能
解决方案以这样的方式设置我的解决方案
-测试项目
-功能
-步骤
-页面项目
-页面

我使用以下命令运行nUnit测试运行程序:

"C:\Program Files (x86)\NUnit.org\nunit-console\nunit3-console.exe" ".\bin\Dev\Solution.dll"

并且我已将此代码添加到上述项目结构的步骤文件夹中。

using System;
using NUnit.Framework;

namespace TestsProject.StepDefinitions
{
    /// <summary>
    /// This class needs to be in the same namespace as the StepDefinitions
    /// see: https://www.nunit.org/index.php?p=setupFixture&r=2.4.8
    /// </summary>
    [SetUpFixture]
    public class NUnitSetupFixture
    {
        [SetUp]
        public void RunBeforeAnyTests()
        {
            // this is not working
            throw new Exception("This is never-ever being called.");
        }

        [TearDown]
        public void RunAfterAnyTests()
        {
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?为什么[SetupFixture]在所有测试由nUnit开始之前不被调用?

c# nunit test-runner

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

无头模式下的 Selenium FindElement 和 Chrome

遵循此建议并仅使用这些参数以无头模式启动 chromedriver.exe 后

 options.AddArgument("headless");
 options.AddArgument("window-size=1280,960");
Run Code Online (Sandbox Code Playgroud)

chromedriver 以隐形方式打开。但是 Selenium 的FindElement()命令在无头 Chrome 页面上找不到任何内容。相反,它抛出这个异常:

WebDriver.dll 中发生了“OpenQA.Selenium.NoSuchElementException”类型的异常,但未在用户代码中处理

附加信息:没有这样的元素:无法定位元素:

Q1:有没有人在 Chrome 的 headless 模式下成功运行 Selenium 命令?

问题 2:您是否能够FindElement与在无头模式下运行的 chromedriver一起使用?如果是,你是如何做到的?


阅读更多内容后,也许需要遵循这些思路?将此添加到 Chrome 启动选项中,然后将 chromedriver 连接到它?
"remote-debugging-port=9222"
但是使用该选项 IWebDriver 和 chromedriver 不会打开。


背景信息:回答,你为什么要这样做?主要原因是测试作为 CI 的一部分运行。这些是在 VM 上运行的测试,可能不支持 1080p 显示器。如果我们以无头模式运行它并以这种方式设置分辨率。

selenium selenium-chromedriver google-chrome-headless

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

使用Selenium ChromeDriver ChromeOptions清除缓存

目前正在使用 var driver = new ChromeDriver(TestContext.CurrentContext.TestDirectory);

我们希望像执行以下操作一样替换它:
在此处输入图片说明

用类似的东西:

var options = new ChromeOptions();
options.AggressiveCacheDiscard = true; // how??
options.ChromeDriverDirectory = TestContext.CurrentContext.TestDirectory; // how??
var driver = new ChromeDriver(options);
Run Code Online (Sandbox Code Playgroud)

但是我们该怎么做呢?目标是设置选项,以确保始终完全清除缓存/ cookie(如Chrome所说,从一开始就清除)并设置了目录。

selenium browser-cache selenium-chromedriver

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

FindAsync返回最近的1000个结果

我正在编写一个测试来检查应用程序日志,这些日志的数量可以达到每分钟数千.我想使用FindAsync来获取最新的日志.但有时候服务中断,所以使用时间值并不准确:

// may return many or none` 
context.FindAsync(x => x.Timestamp >= DateTime.Now.AddMinutes(-10))
Run Code Online (Sandbox Code Playgroud)

我想做的是:

context.FindAsync(x => OrderByDescending(x.Timestamp).Take(1000))
Run Code Online (Sandbox Code Playgroud)

问题是如果FindAsync返回太多结果,可能会减慢其他服务和线程的速度.有没有办法使用FindAsync只返回最近的1000行?

c# asp.net-mvc asynchronous entity-framework

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