예제 #1
0
        public async Task GetShellAppRegistrationModelReturnsSuccess()
        {
            var fakeAppRegistryService = A.Fake <IAppRegistryService>();

            A.CallTo(() => fakeAppRegistryService.GetPaths()).Returns(appRegistrationModels);

            var appRegistryDataService = new AppRegistryDataService(fakeAppRegistryService);
            var result = await appRegistryDataService.GetShellAppRegistrationModel().ConfigureAwait(false);

            Assert.Equal("shell", result.Path);
        }
예제 #2
0
        public async Task GetPathReturnsFirstMatchingPathModelResult()
        {
            var fakeAppRegistryService = A.Fake <IAppRegistryService>();

            A.CallTo(() => fakeAppRegistryService.GetPaths()).Returns(appRegistrationModels);

            var appRegistryDataService = new AppRegistryDataService(fakeAppRegistryService);
            var result = await appRegistryDataService.GetAppRegistrationModel("SecondFakePath").ConfigureAwait(false);

            Assert.Equal(appRegistrationModels[1], result);
        }
예제 #3
0
        public async Task GetPathsReturnsPathModelResults()
        {
            var fakeAppRegistryService = A.Fake <IAppRegistryService>();

            A.CallTo(() => fakeAppRegistryService.GetPaths()).Returns(appRegistrationModels);

            var appRegistryDataService = new AppRegistryDataService(fakeAppRegistryService);
            var result = await appRegistryDataService.GetAppRegistrationModels().ConfigureAwait(false);

            Assert.Equal(appRegistrationModels, result);
        }
예제 #4
0
        public async Task SetAjaxRequestHealthStateForInvalidAjaxRequestSuccess()
        {
            // Arrange
            var fakeAppRegistryService = A.Fake <IAppRegistryService>();

            A.CallTo(() => fakeAppRegistryService.GetPaths()).Returns(appRegistrationModels);

            var appRegistryDataService = new AppRegistryDataService(fakeAppRegistryService);

            // Act
            await appRegistryDataService.SetAjaxRequestHealthState(appRegistrationModels.First().Path, "unknown", true).ConfigureAwait(false);

            // Assert
            A.CallTo(() => fakeAppRegistryService.GetPaths()).MustHaveHappenedOnceExactly();
            A.CallTo(() => fakeAppRegistryService.SetAjaxRequestHealthState(A <string> .Ignored, A <string> .Ignored, A <bool> .Ignored)).MustNotHaveHappened();
        }
예제 #5
0
        public async Task SetRegionHealthStateForInvalidRegionSuccess()
        {
            // Arrange
            var fakeAppRegistryService = A.Fake <IAppRegistryService>();

            A.CallTo(() => fakeAppRegistryService.GetPaths()).Returns(appRegistrationModels);

            var appRegistryDataService = new AppRegistryDataService(fakeAppRegistryService);

            // Act
            await appRegistryDataService.SetRegionHealthState(appRegistrationModels.First().Path, PageRegion.Head, true);

            // Assert
            A.CallTo(() => fakeAppRegistryService.GetPaths()).MustHaveHappenedOnceExactly();
            A.CallTo(() => fakeAppRegistryService.SetRegionHealthState(A <string> .Ignored, A <PageRegion> .Ignored, A <bool> .Ignored)).MustNotHaveHappened();
        }