Esempio n. 1
0
        public async Task ValidatorCalledOnce()
        {
            IValidator validatorFake             = Substitute.For <IValidator>();
            ServiceHostFake <IValidator> srvHost = new ServiceHostFake <IValidator>(validatorFake);

            Task.Run(() => srvHost.Run());

            await srvHost.WaitForHostInitialized();

            await srvHost.StopHost();

            validatorFake.Received(1).Validate();
        }
Esempio n. 2
0
        public async Task WorkloadMetricsCalledOnce()
        {
            IWorkloadMetrics workloadMetricsFake       = Substitute.For <IWorkloadMetrics>();
            ServiceHostFake <IWorkloadMetrics> srvHost = new ServiceHostFake <IWorkloadMetrics>(workloadMetricsFake);

            Task.Run(() => srvHost.Run());

            await srvHost.WaitForHostInitialized();

            await srvHost.StopHost();

            workloadMetricsFake.Received(1).Init();
            workloadMetricsFake.Received().Dispose();
        }