public async Task DataLoadServiceGetJobProfileByIdReturnsEmptyResponse()
        {
            // arrange
            var apiResponse  = File.ReadAllText(Directory.GetCurrentDirectory() + "/DataLoadServiceTests/Files/DataLoadService_GetAll_JobProfile_Response.json");
            var httpResponse = new HttpResponseMessage {
                StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(apiResponse)
            };

            var fakeHttpRequestSender  = A.Fake <IFakeHttpRequestSender>();
            var fakeHttpMessageHandler = new FakeHttpMessageHandler(fakeHttpRequestSender);
            var httpClient             = new HttpClient(fakeHttpMessageHandler)
            {
                BaseAddress = new Uri("http://somebaseaddress")
            };

            A.CallTo(() => fakeHttpRequestSender.Send(A <HttpRequestMessage> .Ignored)).Returns(httpResponse);

            var dataLoadService = new DataLoadService <ServiceTaxonomyApiClientOptions>(httpClient, A.Fake <ServiceTaxonomyApiClientOptions>());

            // act
            var result = await dataLoadService.GetByIdAsync <JobProfile>("JobProfile", Guid.NewGuid()).ConfigureAwait(false);

            // assert
            A.CallTo(() => fakeHttpRequestSender.Send(A <HttpRequestMessage> .Ignored)).MustHaveHappenedOnceExactly();

            Assert.Null(result);

            httpResponse.Dispose();
            httpClient.Dispose();
            fakeHttpMessageHandler.Dispose();
        }
 static void Main(string[] args)
 {
     if (DataLoadService.LoadJsonData())
     {
         IComputeService service = new ComputeService(DataLoadService.Pizzas);
         ResultService   result  = new ResultService(service);
         // Pass how many top results you want to see
         result.ComputeResult(20);
         result.OutputResult();
     }
 }
示例#3
0
        /// <summary>
        /// 在应用程序由最终用户正常启动时进行调用。
        /// 将在启动应用程序以打开特定文件等情况下使用。
        /// </summary>
        /// <param name="e">有关启动请求和过程的详细信息。</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
            if (Window.Current.Content is null)
            {
                Window.Current.Content = new Shell();
            }

            if (e.PrelaunchActivated == false)
            {
                // 确保当前窗口处于活动状态
                Window.Current.Activate();
                ExtendAcrylicIntoTitleBar();
            }

            LogService.ConfigLogger();
            DataLoadService.LoadFromDataAsync();
            await ThemeSelectorService.InitializeAsync().ConfigureAwait(false);

            await ThemeSelectorService.SetRequestedThemeAsync();
        }
示例#4
0
 public CarsController()
 {
     this.service = DataLoadService.Instance;
 }
示例#5
0
 public TransactionController()
 {
     this.service = DataLoadService.Instance;
 }
示例#6
0
 public ParkingController()
 {
     this.service = DataLoadService.Instance;
 }
示例#7
0
        public static async void Initialize()
        {
            var dataLoad = new DataLoadService(new HttpClient());

            Data = await dataLoad.GetDataHierarchyAsync();
        }
 public DataLoadServiceTests()
 {
     dataLoadService = new DataLoadService(fakeLogger, fakeModelValidationService, fakeDocumentService);
 }