0
這裏就不在規範中定義爲我的實際AzureServiceVaraible宣佈在測試
declare var WindowsAzure;
declare var config;
@Injectable()
export class AzureService {
azureUrl;
client: any;
programmes: Programme[];
selectedProgramme: Programme;
orderSummary: Order;
constructor() {
this.client = new WindowsAzure.MobileServiceClient(this.azureUrl);}
}
這裏是我的儀表板規格
describe('DashboardComponent',() => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
DashbaordComponent,
StatusComponent
],
providers:[ AzureService]
}).compileComponents();
}));
it('should create the app', async(() => {
const fixture = TestBed.createComponent(DashbaordComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));
儀表板組件承包商我在哪裏注射湛藍服務:
constructor(private azureService: AzureService) { }
測試失敗,說明我沒有定義WindowAzure,但我在哪裏設想界定?
這裏是錯誤:
感謝@Aravind。執行後無法讀取未定義的屬性'MobileServiceClient' – User1911
'WindowsAzure'是您聲明的變量。那麼它將如何包含任何屬性或方法。 – Aravind
WindowsAzure我從''client。我沒有定義。 – User1911