小编e11*_*1en的帖子

茉莉花角测试指令应该失败

因此,我做了一个简单的指令,当输入无效时会抛出错误,但是当我尝试期望抛出成功时,这是正确的,但是当我not.toThrow()成功时,抛出错误。这告诉我我做错了事,但无法弄清楚是什么。有人可以帮忙吗?

测试

// Test component
@Component({
  template: `<div [addClass]="data"></div> `
})
class TestAddClassComponent {
   data: string | Array<string>;
}


describe('AddClassDirective', () => {
    let component: TestAddClassComponent;
    let fixture: ComponentFixture<TestAddClassComponent>;
    let element: DebugElement;

    beforeEach(() => {
        TestBed.configureTestingModule({
          declarations: [TestAddClassComponent, AddClassDirective]
        });
        fixture = TestBed.createComponent(TestAddClassComponent);
        component = fixture.componentInstance;
        element = fixture.debugElement.query(By.css('div'));
    });

    it('should throw error', () => {
       component.data = 'some-invalid-input';
       fixture.detectChanges();

       expect(component).toThrow();
       // Same result as:
       // expect(component).not.toThrow();

    });
});
Run Code Online (Sandbox Code Playgroud)

指示

@Directive({
  selector: '[addClass]'
})
export class AddClassDirective implements …
Run Code Online (Sandbox Code Playgroud)

javascript jasmine angular-directive angular

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

WCF WF服务,无法通过授权为SSL / TLS建立安全通道

尝试访问WCF WF服务时,我始终收到相同的错误:“无法使用授权建立SSL / TLS的安全通道。”

我已经尝试了很多stackoverflow / google解决方案,但到目前为止还没有运气。

我已经制作了WCF WF服务,该服务连接到使用证书进行验证的第三方。我的Web.config看起来像这样:

<?xml version="1.0"?>
<configuration>
<appSettings>
  <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
</appSettings>
<system.web>
  <compilation debug="true" strict="false" explicit="true" 
                            targetFramework="4.5.1"/>
  <httpRuntime targetFramework="4.5.1"/>
</system.web>
<system.serviceModel>
  <bindings>      
    <basicHttpsBinding>
      <binding name="binding1">
        <security mode="TransportWithMessageCredential">
          <message clientCredentialType="Certificate" />
        </security>
      </binding>
    </basicHttpsBinding>
  </bindings>
  <client>
    <!-- Test Endpoint -->
    <endpoint address="https://example.com" 
              behaviorConfiguration="endpointBehavior" 
              binding="basicHttpsBinding" 
              bindingConfiguration="binding1" 
              contract="ContractPortType" 
              name="Port">
    </endpoint>
  </client>
  <behaviors>
    <serviceBehaviors>
      <behavior>
        <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
        <serviceDebug includeExceptionDetailInFaults="true"/>        
      </behavior>
    </serviceBehaviors>
    <endpointBehaviors>
      <behavior name="endpointBehavior">
        <clientCredentials>          
          <clientCertificate findValue="SOMETHUMBPRINT" 
                              storeLocation="LocalMachine" 
                              storeName="My" 
                              x509FindType="FindByThumbprint" />
        </clientCredentials>
      </behavior>
    </endpointBehaviors>
  </behaviors>
  <protocolMapping>
    <add …
Run Code Online (Sandbox Code Playgroud)

c# ssl wcf workflow-foundation

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