public override void Given()
        {
            grades = new List <LookupViewModel> {
                new LookupViewModel {
                    Id = 1, Code = "C1", Value = "V1"
                }, new LookupViewModel {
                    Id = 2, Code = "C2", Value = "V2"
                }
            };
            mockresult = new ManageCoreResultViewModel
            {
                ProfileId          = 1,
                PathwayDisplayName = "Pathway (7654321)",
                AssessmentSeries   = "Summer 2021",
                AssessmentId       = 11,
                ResultId           = 111,
                SelectedGradeCode  = string.Empty,
                Grades             = grades
            };

            _routeAttributes = new Dictionary <string, string> {
                { Constants.ProfileId, ProfileId.ToString() }
            };
            ResultLoader.GetManageCoreResultAsync(AoUkprn, ProfileId, AssessmentId, true).Returns(mockresult);
        }
        public override void Given()
        {
            HttpContextAccessor = Substitute.For <IHttpContextAccessor>();
            HttpContextAccessor.HttpContext.Returns(new DefaultHttpContext
            {
                User = new ClaimsPrincipal(new ClaimsIdentity(new[]
                {
                    new Claim(ClaimTypes.GivenName, _givename),
                    new Claim(ClaimTypes.Surname, _surname),
                    new Claim(ClaimTypes.Email, _email)
                }))
            });

            CreateMapper();

            BulkResultRequest = new BulkProcessRequest {
                AoUkprn = Ukprn
            };

            BulkResultResponse = new BulkResultResponse
            {
                IsSuccess = true,
                Stats     = new BulkUploadStats
                {
                    TotalRecordsCount = 10
                }
            };

            UploadResultsRequestViewModel = new UploadResultsRequestViewModel {
                AoUkprn = Ukprn, File = FormFile
            };
            InternalApiClient.ProcessBulkResultsAsync(BulkResultRequest).Returns(BulkResultResponse);
            Loader = new ResultLoader(Mapper, Logger, InternalApiClient, BlobStorageService);
        }
 public override void Given()
 {
     MockResult.IsSuccess = false;
     MockResult.Uln       = 1234567891;
     MockResult.ProfileId = 1;
     ResultLoader.AddCoreResultAsync(AoUkprn, ViewModel).Returns(MockResult);
 }
Ejemplo n.º 4
0
        public override void Given()
        {
            mockresult = new ResultDetailsViewModel
            {
                ProfileId               = 1,
                Uln                     = 1234567890,
                Name                    = "Test",
                ProviderDisplayName     = "Test Provider (1234567)",
                PathwayDisplayName      = "Pathway (7654321)",
                PathwayAssessmentSeries = "Summer 2021",
                PathwayAssessmentId     = 11,
                SpecialismDisplayName   = "Specialism1 (2345678)",
                PathwayResult           = "A",
                PathwayResultId         = 123,
                PathwayStatus           = RegistrationPathwayStatus.Active
            };

            _routeAttributes = new Dictionary <string, string>
            {
                { Constants.ProfileId, ProfileId.ToString() },
                { Constants.AssessmentId, mockresult.PathwayAssessmentId.ToString() }
            };

            ResultLoader.GetResultDetailsAsync(AoUkprn, ProfileId, RegistrationPathwayStatus.Active).Returns(mockresult);
        }
        public override void Given()
        {
            HttpContextAccessor = Substitute.For <IHttpContextAccessor>();
            HttpContextAccessor.HttpContext.Returns(new DefaultHttpContext
            {
                User = new ClaimsPrincipal(new ClaimsIdentity(new[]
                {
                    new Claim(ClaimTypes.GivenName, _givename),
                    new Claim(ClaimTypes.Surname, _surname),
                    new Claim(ClaimTypes.Email, _email)
                }))
            });

            CreateMapper();

            BulkResultRequest = new BulkProcessRequest {
                AoUkprn = Ukprn
            };

            BulkResultResponse = new BulkResultResponse
            {
                IsSuccess           = false,
                BlobUniqueReference = Guid.NewGuid(),
                ErrorFileSize       = 1.5
            };

            UploadResultsRequestViewModel = new UploadResultsRequestViewModel {
                AoUkprn = Ukprn, File = FormFile
            };
            InternalApiClient.ProcessBulkResultsAsync(BulkResultRequest).Returns(BulkResultResponse);
            Loader = new ResultLoader(Mapper, Logger, InternalApiClient, BlobStorageService);
        }
        public override void Given()
        {
            BulkResultResponse = new BulkResultResponse
            {
                IsSuccess = true,
                Stats     = new BulkUploadStats
                {
                    TotalRecordsCount = 10
                }
            };

            UploadResultsRequestViewModel = new UploadResultsRequestViewModel {
                AoUkprn = Ukprn, File = FormFile
            };

            UploadResultsResponseViewModel = new UploadResultsResponseViewModel
            {
                IsSuccess = true,
                Stats     = new BulkUploadStatsViewModel
                {
                    TotalRecordsCount = 10
                }
            };

            Mapper.Map <BulkProcessRequest>(UploadResultsRequestViewModel).Returns(BulkResultRequest);
            Mapper.Map <UploadResultsResponseViewModel>(BulkResultResponse).Returns(UploadResultsResponseViewModel);
            InternalApiClient.ProcessBulkResultsAsync(BulkResultRequest).Returns(BulkResultResponse);
            Loader = new ResultLoader(Mapper, Logger, InternalApiClient, BlobStorageService);
        }
Ejemplo n.º 7
0
 public override void Given()
 {
     MockResult.IsSuccess = false;
     MockResult.Uln       = 1234567891;
     MockResult.ProfileId = 1;
     ResultLoader.IsCoreResultChangedAsync(AoUkprn, Arg.Any <ManageCoreResultViewModel>()).Returns(true);
     ResultLoader.ChangeCoreResultAsync(AoUkprn, ViewModel).Returns(MockResult);
 }
 public void Then_Expected_Methods_AreCalled()
 {
     ResultLoader.Received(1).AddCoreResultAsync(AoUkprn, ViewModel);
     CacheService.Received(1).SetAsync(string.Concat(CacheKey, Constants.ResultConfirmationViewModel),
                                       Arg.Is <ResultConfirmationViewModel>
                                           (x => x.ProfileId == ViewModel.ProfileId &&
                                           x.Uln == AddResultResponse.Uln),
                                       CacheExpiryTime.XSmall);
 }
Ejemplo n.º 9
0
        public override void Given()
        {
            SearchResultsViewModel = new SearchResultsViewModel {
                SearchUln = SearchUln
            };
            var mockResult = new UlnResultsNotFoundViewModel {
                IsAllowed = true, IsWithdrawn = false, Uln = SearchUln
            };

            ResultLoader.FindUlnResultsAsync(AoUkprn, SearchUln.ToLong()).Returns(mockResult);
        }
Ejemplo n.º 10
0
        public override void Given()
        {
            mockresult = new ResultDetailsViewModel
            {
                ProfileId           = 1,
                Uln                 = 1234567890,
                Name                = "Test",
                ProviderDisplayName = "Test Provider (1234567)",
                PathwayStatus       = RegistrationPathwayStatus.Active
            };

            ResultLoader.GetResultDetailsAsync(AoUkprn, ProfileId, RegistrationPathwayStatus.Active).Returns(mockresult);
        }
        public override void Given()
        {
            FormFile = Substitute.For <IFormFile>();
            FormFile.FileName.Returns("results.csv");
            ViewModel.File = FormFile;

            ResponseViewModel = new UploadResultsResponseViewModel
            {
                IsSuccess = true
            };

            ResultLoader.ProcessBulkResultsAsync(ViewModel).Returns(ResponseViewModel);
        }
        public override void Given()
        {
            mockresult = new ResultDetailsViewModel
            {
                ProfileId               = 1,
                Uln                     = 1234567890,
                Name                    = "Test",
                ProviderDisplayName     = "Test Provider (1234567)",
                PathwayDisplayName      = "Pathway (7654321)",
                PathwayAssessmentSeries = "Summer 2021",
                SpecialismDisplayName   = "Specialism1 (2345678)",
                PathwayStatus           = RegistrationPathwayStatus.Withdrawn
            };

            ResultLoader.GetResultDetailsAsync(AoUkprn, ProfileId, RegistrationPathwayStatus.Withdrawn).Returns(mockresult);
        }
        public override void Given()
        {
            FormFile = Substitute.For <IFormFile>();
            FormFile.FileName.Returns("results.csv");
            ViewModel.File      = FormFile;
            BlobUniqueReference = Guid.Empty;

            ResponseViewModel = new UploadResultsResponseViewModel
            {
                IsSuccess           = false,
                BlobUniqueReference = BlobUniqueReference,
                ErrorFileSize       = 1.5
            };

            ResultLoader.ProcessBulkResultsAsync(ViewModel).Returns(ResponseViewModel);
        }
        public override void Given()
        {
            ViewModel = new ManageCoreResultViewModel
            {
                ProfileId         = 1,
                SelectedGradeCode = "PCG1"
            };

            AddResultResponse = new AddResultResponse
            {
                IsSuccess = true,
                Uln       = 1234567890,
                ProfileId = 1
            };

            ResultLoader.AddCoreResultAsync(AoUkprn, ViewModel).Returns(AddResultResponse);
        }
        public override void Given()
        {
            BlobUniqueReference = Guid.NewGuid();
            ApiResponse         = new DocumentUploadHistoryDetails
            {
                AoUkprn             = Ukprn,
                BlobFileName        = BlobFileName,
                BlobUniqueReference = BlobUniqueReference,
                DocumentType        = (int)DocumentType.Results,
                FileType            = (int)FileType.Csv,
                Status    = (int)DocumentUploadStatus.Processed,
                CreatedBy = $"{Givenname} {Surname}"
            };

            InternalApiClient.GetDocumentUploadHistoryDetailsAsync(Ukprn, BlobUniqueReference).Returns(ApiResponse);
            BlobStorageService.DownloadFileAsync(Arg.Any <BlobStorageData>()).Returns(new MemoryStream(Encoding.ASCII.GetBytes("Test File")));
            Loader = new ResultLoader(Mapper, Logger, InternalApiClient, BlobStorageService);
        }
Ejemplo n.º 16
0
        private async Task <ResultLoader> UpdateEquipmentsAsync(IEnumerable <EquipmentsEdge> edges)
        {
            var result = new ResultLoader
            {
                Cursor = ""
            };

            try
            {
                List <Task> tasks = null;
                foreach (var edge in edges)
                {
                    if (tasks != null)
                    {
                        Task.WaitAll(tasks.ToArray());
                    }
                    tasks = new List <Task>();

                    var equipmentCatalog =
                        await this.CarContext.FindOrCreateEquipmentCatalogAsync
                        (
                            edge.node.databaseId
                        );

                    tasks.AddRange
                    (
                        new Task[]
                    {
                        UpdateVersionEquipment(equipmentCatalog, edge),
                        UpdateSpecifications(equipmentCatalog, edge),
                        UpdatePricelistsEquipment(equipmentCatalog, edge)
                    }
                    );
                    result.Cursor = edge.cursor;
                }
                result.Status = StatusResultLoader.Success;
            }
            catch (Exception ex)
            {
                result.Exception = ex;
                result.Status    = StatusResultLoader.Error;
            }
            return(result);
        }
        public override void Given()
        {
            ViewModel = new ManageCoreResultViewModel
            {
                ProfileId         = 1,
                ResultId          = 1,
                Uln               = 1234567890,
                SelectedGradeCode = "PCG1"
            };

            ChangeResultResponse = new ChangeResultResponse
            {
                IsSuccess = true,
                Uln       = 1234567890,
                ProfileId = 1
            };

            ResultLoader.IsCoreResultChangedAsync(AoUkprn, ViewModel).Returns(true);
            ResultLoader.ChangeCoreResultAsync(AoUkprn, ViewModel).Returns(ChangeResultResponse);
        }
Ejemplo n.º 18
0
        private void Init(IColorPreset colorPreset)
        {
            bgSprite = CreateChild <UguiSprite>("bg", -1);
            {
                bgSprite.Anchor = AnchorType.Fill;
                bgSprite.Offset = Offset.Zero;

                var gradient = bgSprite.AddEffect(new GradientEffect());
                gradient.Component.direction = UIGradient.Direction.Vertical;
                gradient.Component.color1    = colorPreset.Passive;
                gradient.Component.color2    = colorPreset.DarkBackground;
            }
            searchMenu = CreateChild <SearchMenu>("search-menu", 1);
            {
                searchMenu.Anchor = AnchorType.Fill;
                searchMenu.Pivot  = PivotType.Top;
                searchMenu.Offset = new Offset(0f, MenuBarHeight, 0f, 0f);
            }
            resultArea = CreateChild <UguiObject>("result-area", 1);
            {
                resultArea.Anchor = AnchorType.Fill;
                resultArea.Offset = new Offset(0f, searchMenu.FoldedHeight + MenuBarHeight, 0f, 0f);

                resultList = resultArea.CreateChild <ResultList>("list", 0);
                {
                    resultList.Anchor = AnchorType.Fill;
                    resultList.Offset = new Offset(8f, 0f);
                }
                resultLoader = resultArea.CreateChild <ResultLoader>("loader", 1);
                {
                    resultLoader.Anchor = AnchorType.Fill;
                    resultLoader.Offset = Offset.Zero;
                }
            }

            model.MapsetsRequest.OnNewValue += OnRequestChange;
        }
Ejemplo n.º 19
0
 public override void Given()
 {
     MockResult = null;
     ResultLoader.IsCoreResultChangedAsync(AoUkprn, Arg.Any <ManageCoreResultViewModel>()).Returns(true);
     ResultLoader.ChangeCoreResultAsync(AoUkprn, ViewModel).Returns(MockResult);
 }
 public void Then_Expected_Methods_Called()
 {
     ResultLoader.Received(1).FindUlnResultsAsync(AoUkprn, SearchUln.ToLong());
 }
 public void Then_Expected_Methods_Called()
 {
     ResultLoader.Received(1).ProcessBulkResultsAsync(ViewModel);
 }
 public override void Given()
 {
     ResultLoader.GetResultDetailsAsync(AoUkprn, ProfileId).Returns(mockresult);
 }
 public void Then_Expected_Methods_Called()
 {
     ResultLoader.Received(1).GetResultValidationErrorsFileAsync(Ukprn, Id.ToGuid());
 }
Ejemplo n.º 24
0
 public override void Given()
 {
     ResultLoader.GetManageCoreResultAsync(AoUkprn, ProfileId, AssessmentId, false).Returns(mockresult);
 }
 public override void Given()
 {
     ResultLoader.IsCoreResultChangedAsync(AoUkprn, Arg.Any <ManageCoreResultViewModel>()).Returns(mockResult);
 }
Ejemplo n.º 26
0
 public override void Given()
 {
     MockResult = null;
     ResultLoader.AddCoreResultAsync(AoUkprn, ViewModel).Returns(MockResult);
 }
Ejemplo n.º 27
0
        void OnGUI()
        {
            GUIStyle s = new GUIStyle(GUI.skin.textField)
            {
                fontSize = 25,
            };

            EditorGUILayout.BeginHorizontal("Box");
            string newSearchString = EditorGUILayout.DelayedTextField(searchString, s, GUILayout.Height(30));

            if (
                newSearchString != searchString ||
                GUILayout.Button(EditorGUIUtility.IconContent("Search Icon", "|Search"), GUILayout.Height(30), GUILayout.Width(30)))
            {
                searchString = newSearchString;
                if (loader == null || loader.thread?.ThreadState == ThreadState.Stopped)
                {
                    loader = new ResultLoader()
                    {
                        searchString = searchString,
                        adapters     = adapters,
                    };

                    loader.thread = new Thread(new ThreadStart(loader.LoadResults));
                    loader.thread.Start();
                }
            }
            EditorGUILayout.EndHorizontal();

            Rect wnd = EditorGUILayout.BeginVertical();

            using (var scrollView = new EditorGUILayout.ScrollViewScope(scrollPos))
            {
                scrollPos = scrollView.scrollPosition;
                int numPerRow = Mathf.FloorToInt(EditorGUIUtility.currentViewWidth / 120.0f) - 1;
                if (loader == null)
                {
                    EditorGUILayout.LabelField("Type something above to start a search.");
                }
                else if (loader.failed)
                {
                    EditorGUILayout.LabelField("Something went wrong!");
                }
                else if (loader.completed)
                {
                    if (loader.Results.Count() == 0)
                    {
                        EditorGUILayout.LabelField($"No Results matched your query {searchString}.");
                    }

                    foreach (IEnumerable <IMaterialOption> row in loader.Results.Chunk(numPerRow))
                    {
                        EditorGUILayout.BeginHorizontal();
                        foreach (IMaterialOption option in row)
                        {
                            option.OnGUI();
                        }
                        EditorGUILayout.EndHorizontal();
                    }
                }
                else
                {
                    EditorGUILayout.LabelField("Loading...");
                }
                EditorGUILayout.LabelField("Please donsider donating to cc0textures.com on patreon");
            }
            EditorGUILayout.EndVertical();
        }