Exemplo n.º 1
0
        public void Arrange()
        {
            Setup();
            CertificateRepository.Setup(r => r.GetCompletedCertificatesFor(1111111111))
            .ReturnsAsync(new List <Certificate>
            {
                new Certificate {
                    CertificateReference = "00010001", StandardCode = 12,
                    CertificateData      =
                        JsonConvert.SerializeObject(new CertificateData {
                    })
                }
            });

            CertificateRepository.Setup(r => r.GetCertificateLogsFor(It.IsAny <Guid>()))
            .ReturnsAsync(new List <CertificateLog>());

            IlrRepository.Setup(r => r.SearchForLearnerByUln(It.IsAny <long>()))
            .ReturnsAsync(new List <Ilr> {
                new Ilr()
                {
                    StdCode = 12, FamilyName = "Lamora"
                }, new Ilr()
                {
                    StdCode = 13, FamilyName = "Lamora"
                }
            });
        }
        // GET: Certificate
        public ActionResult Index(string sortOrder, string filter, string archived, int page = 1, Guid?archive = null)
        {
            //PdfGenerator.PdfGenerator pdf = new PdfGenerator.PdfGenerator();
            //pdf.GenerateOnflyPdf();

            //ExcelReader.Read(@"C:\Users\malikwaqar\Desktop\bredford code analysic.xlsx");

            ViewBag.searchQuery  = string.IsNullOrEmpty(filter) ? "" : filter;
            ViewBag.showArchived = (archived ?? "") == "on";

            page = page > 0 ? page : 1;
            int pageSize = 0;

            pageSize = pageSize > 0 ? pageSize : 10;

            ViewBag.CurrentSort = sortOrder;

            IEnumerable <certificate> certificates;
            var repository = new CertificateRepository();

            if (string.IsNullOrEmpty(filter))
            {
                certificates = repository.Get();
            }
            else
            {
                certificates = repository.Get().Where(x => x.Name.ToLower().Contains(filter.ToLower()));
            }
            //Sorting order
            certificates  = certificates.OrderBy(x => x.Name);
            ViewBag.Count = certificates.Count();

            return(View(certificates.ToPagedList(page, pageSize)));
        }
Exemplo n.º 3
0
        public OctopusAsyncRepository(IOctopusAsyncClient client, RepositoryScope repositoryScope = null)
        {
            Client                    = client;
            Scope                     = repositoryScope ?? RepositoryScope.Unspecified();
            Accounts                  = new AccountRepository(this);
            ActionTemplates           = new ActionTemplateRepository(this);
            Artifacts                 = new ArtifactRepository(this);
            Backups                   = new BackupRepository(this);
            BuiltInPackageRepository  = new BuiltInPackageRepositoryRepository(this);
            CertificateConfiguration  = new CertificateConfigurationRepository(this);
            Certificates              = new CertificateRepository(this);
            Channels                  = new ChannelRepository(this);
            CommunityActionTemplates  = new CommunityActionTemplateRepository(this);
            Configuration             = new ConfigurationRepository(this);
            DashboardConfigurations   = new DashboardConfigurationRepository(this);
            Dashboards                = new DashboardRepository(this);
            Defects                   = new DefectsRepository(this);
            DeploymentProcesses       = new DeploymentProcessRepository(this);
            Deployments               = new DeploymentRepository(this);
            Environments              = new EnvironmentRepository(this);
            Events                    = new EventRepository(this);
            FeaturesConfiguration     = new FeaturesConfigurationRepository(this);
            Feeds                     = new FeedRepository(this);
            Interruptions             = new InterruptionRepository(this);
            LibraryVariableSets       = new LibraryVariableSetRepository(this);
            Lifecycles                = new LifecyclesRepository(this);
            MachinePolicies           = new MachinePolicyRepository(this);
            MachineRoles              = new MachineRoleRepository(this);
            Machines                  = new MachineRepository(this);
            Migrations                = new MigrationRepository(this);
            OctopusServerNodes        = new OctopusServerNodeRepository(this);
            PerformanceConfiguration  = new PerformanceConfigurationRepository(this);
            PackageMetadataRepository = new PackageMetadataRepository(this);
            ProjectGroups             = new ProjectGroupRepository(this);
            Projects                  = new ProjectRepository(this);
            ProjectTriggers           = new ProjectTriggerRepository(this);
            Proxies                   = new ProxyRepository(this);
            Releases                  = new ReleaseRepository(this);
            RetentionPolicies         = new RetentionPolicyRepository(this);
            Schedulers                = new SchedulerRepository(this);
            ServerStatus              = new ServerStatusRepository(this);
            Spaces                    = new SpaceRepository(this);
            Subscriptions             = new SubscriptionRepository(this);
            TagSets                   = new TagSetRepository(this);
            Tasks                     = new TaskRepository(this);
            Teams                     = new TeamsRepository(this);
            Tenants                   = new TenantRepository(this);
            TenantVariables           = new TenantVariablesRepository(this);
            UserInvites               = new UserInvitesRepository(this);
            UserRoles                 = new UserRolesRepository(this);
            Users                     = new UserRepository(this);
            VariableSets              = new VariableSetRepository(this);
            Workers                   = new WorkerRepository(this);
            WorkerPools               = new WorkerPoolRepository(this);
            ScopedUserRoles           = new ScopedUserRoleRepository(this);
            UserPermissions           = new UserPermissionsRepository(this);

            loadRootResource      = new Lazy <Task <RootResource> >(LoadRootDocumentInner, true);
            loadSpaceRootResource = new Lazy <Task <SpaceRootResource> >(LoadSpaceRootDocumentInner, true);
        }
Exemplo n.º 4
0
        public bool SaveCertificate(CertificateDTO token, out string error)
        {
            try
            {
                var entity = CertificateRepository.GetMany(x => x.CourseId == token.CourseId).FirstOrDefault();

                if (entity == null)
                {
                    entity = token.Token2CertificateEntity();

                    CertificateRepository.Add(entity);

                    if (!CertificateRepository.UnitOfWork.CommitAndRefreshChanges(out error))
                    {
                        return(false);
                    }

                    token.CertificateId = entity.CertificateId;

                    return(true);
                }

                entity.UpdateCertificateEntity(token);

                return(CertificateRepository.UnitOfWork.CommitAndRefreshChanges(out error) && _deattchCertificateFromQuizes(token.IsActive, token.CourseId, out error));
            }
            catch (Exception ex)
            {
                Logger.Error("save certificate ", token.CourseId, ex, CommonEnums.LoggerObjectTypes.Certificate);
                error = FormatError(ex);
                return(false);
            }
        }
        public void Then_an_exception_is_not_thrown()
        {
            RegisterQueryRepository.Setup(c => c.GetAllOrganisationStandardByOrganisationId("EPA0050"))
            .ReturnsAsync(new List <OrganisationStandardSummary>
            {
                new OrganisationStandardSummary {
                    StandardCode = 12
                },
                new OrganisationStandardSummary {
                    StandardCode = 13
                },
                new OrganisationStandardSummary {
                    StandardCode = 14
                }
            });

            CertificateRepository.Setup(c => c.GetDraftAndCompletedCertificatesFor(It.IsAny <long>()))
            .ReturnsAsync(new List <Certificate>());

            SearchHandler
            .Handle(new SearchQuery()
            {
                Surname = "smith", EpaOrgId = "99999", Uln = 12345, Username = "******"
            },
                    new CancellationToken()).Wait();
        }
        private void SetUpCertificateAndLogEntries(int standardCode)
        {
            var certificateData = Builder <CertificateData> .CreateNew()
                                  .With(x => x.LearnerFamilyName = "Lamora").Build();

            var certificate = Builder <Certificate> .CreateNew()
                              .With(x => x.StandardCode    = standardCode)
                              .With(x => x.CertificateData = JsonConvert.SerializeObject(certificateData))
                              .Build();

            var certificatesResponse = new List <Certificate> {
                certificate
            };

            CertificateRepository.Setup(r => r.GetDraftAndCompletedCertificatesFor(1111111111))
            .ReturnsAsync(certificatesResponse);

            var certificateLogEntries = Builder <CertificateLog> .CreateListOfSize(2)
                                        .All()
                                        .With(x => x.CertificateId = certificate.Id)
                                        .TheFirst(1)
                                        .With(x => x.Status == CertificateStatus.Draft)
                                        .With(x => x.EventTime == DateTime.Now.AddDays(-1))
                                        .TheNext(1)
                                        .With(x => x.Status == CertificateStatus.Submitted)
                                        .With(x => x.EventTime == DateTime.Now)
                                        .Build().ToList();

            CertificateRepository.Setup(r => r.GetCertificateLogsFor(certificate.Id))
            .ReturnsAsync(certificateLogEntries);
        }
Exemplo n.º 7
0
        public void Arrange()
        {
            Setup();

            CertificateRepository.Setup(r => r.GetDraftAndCompletedCertificatesFor(1111111111))
            .ReturnsAsync(new List <Certificate>
            {
                new Certificate
                {
                    CertificateReference = "00010001",
                    StandardCode         = 12,
                    CertificateData      =
                        JsonConvert.SerializeObject(new CertificateData {
                        OverallGrade = "Distinction"
                    }),
                    CertificateLogs = GetCertificateLogs()
                }
            });

            CertificateRepository.Setup(r => r.GetCertificateLogsFor(It.IsAny <Guid>()))
            .ReturnsAsync(GetCertificateLogs());

            LearnerRepository.Setup(r => r.SearchForLearnerByUln(It.IsAny <long>()))
            .ReturnsAsync(new List <Domain.Entities.Learner> {
                new Domain.Entities.Learner()
                {
                    StdCode = 12, FamilyName = "Lamora"
                }
            });
        }
        public async Task Fallback_To_Regular_Receipt_When_Referenced_UserMessage_Isnt_Signed()
        {
            // Arrange
            var as4Message = AS4Message.Create(
                new UserMessage($"user-{Guid.NewGuid()}"));

            var certRepo = new CertificateRepository(StubConfig.Default);

            as4Message.Encrypt(
                new KeyEncryptionConfiguration(
                    certRepo.GetCertificate(X509FindType.FindBySubjectName, "AccessPointB")),
                DataEncryptionConfiguration.Default);

            var fixture = new MessagingContext(as4Message, MessagingContextMode.Receive)
            {
                ReceivingPMode = new ReceivingProcessingMode()
            };

            // Act
            AS4Message result = await ExerciseCreateReceiptAsync(fixture);

            // Assert
            var receipt = Assert.IsType <Receipt>(result.FirstSignalMessage);

            Assert.Null(receipt.NonRepudiationInformation);
            Assert.NotNull(receipt.UserMessage);
        }
        public void Arrange()
        {
            Setup();
            CertificateRepository.Setup(r => r.GetDraftAndCompletedCertificatesFor(1111111111))
                .ReturnsAsync(new List<Certificate>
                {
                    new Certificate
                    {
                        CertificateReference = "00010001", StandardCode = 12,
                        CertificateData = JsonConvert.SerializeObject(new CertificateData {}),
                        CertificateLogs = new List<CertificateLog>
                        {
                            new CertificateLog
                            {
                                Action = CertificateActions.Submit,
                                CertificateData = JsonConvert.SerializeObject(new CertificateData
                                {
                                    OverallGrade = "Distinction",
                                    AchievementDate = DateTime.UtcNow.AddDays(-2)
                                })
                            }
                        }
                    }
                });

            LearnerRepository.Setup(r => r.SearchForLearnerByUln(It.IsAny<long>()))
                .ReturnsAsync(new List<Domain.Entities.Learner> {new Domain.Entities.Learner() {StdCode = 12, FamilyName = "Lamora"}, new Domain.Entities.Learner() {StdCode = 13, FamilyName = "Lamora"}});
        }
Exemplo n.º 10
0
        public CertificateDTO GetCourseCertificate(int courseId)
        {
            try
            {
                var entity = CertificateRepository.GetMany(x => x.CourseId == courseId).FirstOrDefault();

                if (entity == null)
                {
                    var courseEntity = CourseRepository.GetById(courseId);

                    return(courseEntity != null ? new CertificateDTO(courseId, courseEntity.CourseName, this.GetCurrentUserName()) : new CertificateDTO {
                        IsValid = false, Message = "Course not found"
                    });
                }

                var token = entity.Entity2CertificateDto(StudentCertificatesRepository.IsAny(x => x.CertificateId == entity.CertificateId), CourseQuizzesRepository.IsAny(x => x.CourseId == entity.CourseId && x.AttachCertificate));

                return(token);
            }
            catch (Exception ex)
            {
                Logger.Error("get certificate token", courseId, ex, CommonEnums.LoggerObjectTypes.Certificate);
                return(new CertificateDTO
                {
                    IsValid = false
                    , Message = FormatError(ex)
                });
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Registry"/> class.
        /// </summary>
        private Registry()
        {
            CertificateRepository = new CertificateRepository();

            MessageBodyStore = new MessageBodyStore();
            MessageBodyStore.Accept(
                condition: l => l.StartsWith("file:///", StringComparison.OrdinalIgnoreCase),
                persister: new AS4MessageBodyFileStore());
        }
Exemplo n.º 12
0
 public RequestAcmeCertificateJob(
     AcmeChallengeSingleton challengeSingleton,
     ConfigurationProvider configurationProvider,
     CertificateRepository certificateRepository)
 {
     _challengeSingleton    = challengeSingleton;
     _configurationProvider = configurationProvider;
     _certificateRepository = certificateRepository;
 }
Exemplo n.º 13
0
        public JsonResult Certificate(int?draw, int?start, int?length, List <Dictionary <string, string> > order, List <Dictionary <string, string> > columns)
        {
            var search        = Request["search[value]"];
            var dir           = order[0]["dir"].ToLower();
            var column        = columns[int.Parse(order[0]["column"])]["data"];
            var dataTableData = new CertificateRepository().GetPage(search, draw, start, length, dir, column);

            return(Json(dataTableData, JsonRequestBehavior.AllowGet));
        }
        public void Arrange()
        {
            Setup();

            var certificateId = Guid.NewGuid();

            CertificateRepository.Setup(r => r.GetCompletedCertificatesFor(1111111111))
            .ReturnsAsync(new List <Certificate>
            {
                new Certificate
                {
                    Id = certificateId,
                    CertificateReference = "00010001",
                    StandardCode         = 12,
                    CertificateData      =
                        JsonConvert.SerializeObject(new CertificateData
                    {
                        OverallGrade      = CertificateGrade.Distinction,
                        LearningStartDate = new DateTime(2015, 06, 01),
                        AchievementDate   = new DateTime(2018, 06, 01)
                    }),
                    CreatedBy = "username"
                }
            });

            CertificateRepository.Setup(r => r.GetCertificateLogsFor(certificateId))
            .ReturnsAsync(new List <CertificateLog>()
            {
                new CertificateLog()
                {
                    Status    = CertificateStatus.Submitted,
                    EventTime = new DateTime(2018, 2, 3, 13, 23, 33),
                    Username  = "******"
                },
                new CertificateLog()
                {
                    Status    = CertificateStatus.Draft,
                    EventTime = new DateTime(2018, 2, 3, 13, 23, 32),
                    Username  = "******"
                }
            });

            ContactRepository.Setup(cr => cr.GetContact("username"))
            .ReturnsAsync(new Contact()
            {
                DisplayName = "EPAO User from same EAPOrg"
            });

            IlrRepository.Setup(r => r.SearchForLearnerByUln(It.IsAny <long>()))
            .ReturnsAsync(new List <Ilr> {
                new Ilr()
                {
                    StdCode = 12, FamilyName = "Lamora"
                }
            });
        }
Exemplo n.º 15
0
        public ActionResult CertificateDetail(int?id)
        {
            CertificateViewModel model = new CertificateViewModel();

            if (id.HasValue)
            {
                model = new CertificateRepository().GetByID((int)id);
            }
            return(PartialView("_Certificate", model));
        }
Exemplo n.º 16
0
        public CertificateInfoModel GetCertificateInfo(CertificateSearchModel searchModel)
        {
            CertificateInfoModel     info    = new CertificateInfoModel();
            DataContext              dc      = new DataContext(this.DbString);
            ICertificateRepository   rep     = new CertificateRepository(dc);
            IQueryable <Certificate> results = rep.Search(searchModel);

            info.certificateCount = dc.Context.GetTable <Certificate>().Where(c => c.id.Equals(results.Count() > 0 ? results.First().id : -1)).Count();

            return(info);
        }
        public UnitOfWork(ExtendedNotificationCenterContext databaseContext)
        {
            NotificationRepository      = new NotificationRepository(databaseContext);
            CertificateRespoitory       = new CertificateRepository(databaseContext);
            RequestRepository           = new RequestRepository(databaseContext);
            NotificationEventRepository = new NotificationEventRepository(databaseContext);
            LoginRepository             = new LoginRepository(databaseContext);
            ClientRepository            = new ClientRepository(databaseContext);

            _databaseContext = databaseContext;
        }
        public void Arrange()
        {
            MappingBootstrapper.Initialize();

            var mockSet = CreateCertificateMockDbSet();

            _mockDbContext  = CreateMockDbContext(mockSet);
            _mockUnitOfWork = new Mock <IUnitOfWork>();

            _certificateRepository = new CertificateRepository(_mockUnitOfWork.Object, _mockDbContext.Object);
        }
Exemplo n.º 19
0
        public static IHostBuilder CreateHostBuilder(string[] args)
        {
            return(Host.CreateDefaultBuilder(args)
                   .ConfigureWebHostDefaults(webBuilder =>
            {
                webBuilder.UseStartup <Startup>();
                webBuilder.UseKestrel((builderContext, kestrelOptions) =>
                {
                    kestrelOptions.AddServerHeader = false;

                    kestrelOptions.ListenAnyIP(443, listenOptions =>
                    {
                        listenOptions.UseHttps(async(stream, clientHelloInfo, state, cancellationToken) =>
                        {
                            await Task.Yield();
                            SslServerAuthenticationOptions options = new SslServerAuthenticationOptions
                            {
                                ApplicationProtocols = new System.Collections.Generic.List <SslApplicationProtocol>()
                                {
                                    SslApplicationProtocol.Http2,
                                    SslApplicationProtocol.Http11,
                                },
                            };

                            X509Certificate2?certificate;
                            bool hasCertificate = CertificateRepository.TryGetCertificate(clientHelloInfo.ServerName, out certificate);

                            if (!hasCertificate)
                            {
                                string snapFolder = PathProvider.GetApplicationDataFolder();
                                string primaryDomainConfigFile = snapFolder + "/primary-domain.txt";
                                if (File.Exists(primaryDomainConfigFile))
                                {
                                    string value = await File.ReadAllTextAsync(primaryDomainConfigFile);
                                    CertificateRepository.TryGetCertificate(value, out certificate);
                                }
                            }

                            options.ServerCertificate = certificate;

                            return options;
                        }, state: null);
                    });
                    kestrelOptions.ListenAnyIP(80);
                });
            })
                   .ConfigureLogging(logging =>
            {
                logging.ClearProviders();
                logging.SetMinimumLevel(LogLevel.Trace);
            })
                   .UseNLog());
        }
Exemplo n.º 20
0
        public void Arrange()
        {
            Setup();

            var certificateId      = Guid.NewGuid();
            var searchingEpaoOrgId = Guid.NewGuid();

            CertificateRepository.Setup(r => r.GetDraftAndCompletedCertificatesFor(1111111111))
            .ReturnsAsync(new List <Certificate>
            {
                new Certificate
                {
                    Id = certificateId,
                    CertificateReference = "00010001",
                    StandardCode         = 12,
                    CertificateData      =
                        JsonConvert.SerializeObject(new CertificateData
                    {
                        OverallGrade      = CertificateGrade.Distinction,
                        LearningStartDate = new DateTime(2015, 06, 01),
                        AchievementDate   = new DateTime(2018, 06, 01)
                    }),
                    IsPrivatelyFunded = false,
                    CreatedBy         = "username",
                    CertificateLogs   = new List <CertificateLog>
                    {
                        new CertificateLog
                        {
                            CertificateData = JsonConvert.SerializeObject(new CertificateData
                            {
                                OverallGrade    = CertificateGrade.Distinction,
                                AchievementDate = new DateTime(2018, 06, 01)
                            }),
                            Action = CertificateActions.Submit
                        }
                    }
                }
            });

            ContactRepository.Setup(cr => cr.GetContact("username"))
            .ReturnsAsync(new Contact()
            {
                DisplayName = "EPAO User from this EAPOrg", OrganisationId = searchingEpaoOrgId
            });

            LearnerRepository.Setup(r => r.SearchForLearnerByUln(It.IsAny <long>()))
            .ReturnsAsync(new List <Domain.Entities.Learner> {
                new Domain.Entities.Learner()
                {
                    StdCode = 12, FamilyName = "Lamora"
                }
            });
        }
Exemplo n.º 21
0
        public OctopusAsyncRepository(IOctopusAsyncClient client)
        {
            this.Client = client;

            Accounts                 = new AccountRepository(client);
            ActionTemplates          = new ActionTemplateRepository(client);
            Artifacts                = new ArtifactRepository(client);
            Backups                  = new BackupRepository(client);
            BuiltInPackageRepository = new BuiltInPackageRepositoryRepository(client);
            CertificateConfiguration = new CertificateConfigurationRepository(client);
            Certificates             = new CertificateRepository(client);
            Channels                 = new ChannelRepository(client);
            CommunityActionTemplates = new CommunityActionTemplateRepository(client);
            Configuration            = new ConfigurationRepository(client);
            DashboardConfigurations  = new DashboardConfigurationRepository(client);
            Dashboards               = new DashboardRepository(client);
            Defects                  = new DefectsRepository(client);
            DeploymentProcesses      = new DeploymentProcessRepository(client);
            Deployments              = new DeploymentRepository(client);
            Environments             = new EnvironmentRepository(client);
            Events = new EventRepository(client);
            FeaturesConfiguration = new FeaturesConfigurationRepository(client);
            Feeds                    = new FeedRepository(client);
            Interruptions            = new InterruptionRepository(client);
            LibraryVariableSets      = new LibraryVariableSetRepository(client);
            Lifecycles               = new LifecyclesRepository(client);
            MachinePolicies          = new MachinePolicyRepository(client);
            MachineRoles             = new MachineRoleRepository(client);
            Machines                 = new MachineRepository(client);
            Migrations               = new MigrationRepository(client);
            OctopusServerNodes       = new OctopusServerNodeRepository(client);
            PerformanceConfiguration = new PerformanceConfigurationRepository(client);
            ProjectGroups            = new ProjectGroupRepository(client);
            Projects                 = new ProjectRepository(client);
            ProjectTriggers          = new ProjectTriggerRepository(client);
            Proxies                  = new ProxyRepository(client);
            Releases                 = new ReleaseRepository(client);
            RetentionPolicies        = new RetentionPolicyRepository(client);
            Schedulers               = new SchedulerRepository(client);
            ServerStatus             = new ServerStatusRepository(client);
            Subscriptions            = new SubscriptionRepository(client);
            TagSets                  = new TagSetRepository(client);
            Tasks                    = new TaskRepository(client);
            Teams                    = new TeamsRepository(client);
            Tenants                  = new TenantRepository(client);
            TenantVariables          = new TenantVariablesRepository(client);
            UserRoles                = new UserRolesRepository(client);
            Users                    = new UserRepository(client);
            VariableSets             = new VariableSetRepository(client);
            Workers                  = new WorkerRepository(client);
            WorkerPools              = new WorkerPoolRepository(client);
        }
Exemplo n.º 22
0
        public void Arrange()
        {
            MappingBootstrapper.Initialize();

            var mockSet = CreateCertificateMockDbSet();

            _mockDbContext  = CreateMockDbContext(mockSet);
            _mockUnitOfWork = new Mock <IUnitOfWork>();

            _certificateRepository = new CertificateRepository(_mockUnitOfWork.Object, _mockDbContext.Object);

            _result = _certificateRepository.GetCertificateByOrgIdLastname(1111111111, "EPA0001", "Hawkins").Result;
        }
Exemplo n.º 23
0
        public void Arrange()
        {
            Setup();
            CertificateRepository.Setup(r => r.GetDraftAndCompletedCertificatesFor(1111111111))
            .ReturnsAsync(new List <Certificate>());

            LearnerRepository.Setup(r => r.SearchForLearnerByUln(It.IsAny <long>()))
            .ReturnsAsync(new List <Domain.Entities.Learner> {
                new Domain.Entities.Learner()
                {
                    StdCode = 12, FamilyName = "Lamora"
                }
            });
        }
        public void Arrange()
        {
            _certificateId   = Guid.NewGuid();
            _incidentNumber  = "INC12345";
            _reasonForChange = "Test Text Reason For Change";

            var mockCertificate    = MockDbSetCreateCertificate();
            var mockCertificateLog = MockDbSetCreateCertificateLog();

            _mockDbContext  = CreateMockDbContext(mockCertificate, mockCertificateLog);
            _mockUnitOfWork = new Mock <IUnitOfWork>();

            _certificateRepository = new CertificateRepository(_mockUnitOfWork.Object, _mockDbContext.Object);
        }
        public void Arrange()
        {
            Setup();
            CertificateRepository.Setup(r => r.GetCompletedCertificatesFor(1111111111))
            .ReturnsAsync(new List <Certificate>());

            IlrRepository.Setup(r => r.SearchForLearnerByUln(It.IsAny <long>()))
            .ReturnsAsync(new List <Ilr> {
                new Ilr()
                {
                    StdCode = 12, FamilyName = "Lamora"
                }
            });
        }
Exemplo n.º 26
0
        public TestDataSeeder(IServiceScope scope)
        {
            citizenUserRepository  = scope.ServiceProvider.GetService <CitizenUserRepository>();
            roleRepository         = scope.ServiceProvider.GetService <RoleRepository>();
            busRouteRepository     = scope.ServiceProvider.GetService <BusRouteRepository>();
            busRepository          = scope.ServiceProvider.GetService <BusRepository>();
            certificateRepository  = scope.ServiceProvider.GetService <CertificateRepository>();
            busWorkerRepository    = scope.ServiceProvider.GetService <BusWorkerRepository>();
            busRouteTimeRepository = scope.ServiceProvider.GetService <BusRouteTimeRepository>();

            if (citizenUserRepository == null || roleRepository == null)
            {
                throw new Exception("Cannot get services from ServiceProvider.");
            }
        }
        public void Arrange()
        {
            MappingBootstrapper.Initialize();

            var mockSet = CreateCertificateMockDbSet();

            _mockDbContext  = CreateMockDbContext(mockSet);
            _mockUnitOfWork = new Mock <IUnitOfWork>();

            _certificateRepository = new CertificateRepository(_mockUnitOfWork.Object, _mockDbContext.Object);

            _result = _certificateRepository.GetCertificates(new List <string> {
                "Reprint", "Submitted"
            }).Result;
        }
Exemplo n.º 28
0
        public override async Task <IsTlsCertificateSetupReply> IsTlsCertificateSetup(IsTlsCertificateSetupRequest request, ServerCallContext context)
        {
            if (!await IsAccessible(request.AuthToken))
            {
                return(new IsTlsCertificateSetupReply
                {
                    Success = false
                });
            }

            return(new IsTlsCertificateSetupReply
            {
                Success = CertificateRepository.TryGetCertificate(request.Domain, out _),
            });
        }
Exemplo n.º 29
0
        public void Arrange()
        {
            MappingBootstrapper.Initialize();

            _certificateId = Guid.NewGuid();

            var mockSet = CreateCertificateMockDbSet();

            _mockDbContext  = CreateMockDbContext(mockSet);
            _mockUnitOfWork = new Mock <IUnitOfWork>();

            _certificateRepository = new CertificateRepository(_mockUnitOfWork.Object, _mockDbContext.Object);

            _result = _certificateRepository.GetCertificate(_certificateId).Result;
        }
Exemplo n.º 30
0
        public JsonResult SaveCertificate(CertificateViewModel model)
        {
            ResponseData result = new Models.ResponseData();

            if (model.CerID != 0)
            {
                result = new CertificateRepository().UpdateByEntity(model);
            }
            else
            {
                result = new CertificateRepository().AddByEntity(model);
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 31
0
 public OctopusRepository(IOctopusClient client)
 {
     this.Client = client;
     Feeds = new FeedRepository(client);
     Backups = new BackupRepository(client);
     Machines = new MachineRepository(client);
     MachineRoles = new MachineRoleRepository(client);
     MachinePolicies = new MachinePolicyRepository(client);
     Subscriptions = new SubscriptionRepository(client);
     Environments = new EnvironmentRepository(client);
     Events = new EventRepository(client);
     FeaturesConfiguration = new FeaturesConfigurationRepository(client);
     ProjectGroups = new ProjectGroupRepository(client);
     Projects = new ProjectRepository(client);
     Proxies = new ProxyRepository(client);
     Tasks = new TaskRepository(client);
     Users = new UserRepository(client);
     VariableSets = new VariableSetRepository(client);
     LibraryVariableSets = new LibraryVariableSetRepository(client);
     DeploymentProcesses = new DeploymentProcessRepository(client);
     Releases = new ReleaseRepository(client);
     Deployments = new DeploymentRepository(client);
     Certificates = new CertificateRepository(client);
     Dashboards = new DashboardRepository(client);
     DashboardConfigurations = new DashboardConfigurationRepository(client);
     Artifacts = new ArtifactRepository(client);
     Interruptions = new InterruptionRepository(client);
     ServerStatus = new ServerStatusRepository(client);
     UserRoles = new UserRolesRepository(client);
     Teams = new TeamsRepository(client);
     RetentionPolicies = new RetentionPolicyRepository(client);
     Accounts = new AccountRepository(client);
     Defects = new DefectsRepository(client);
     Lifecycles = new LifecyclesRepository(client);
     OctopusServerNodes = new OctopusServerNodeRepository(client);
     Channels = new ChannelRepository(client);
     ProjectTriggers = new ProjectTriggerRepository(client);
     Schedulers = new SchedulerRepository(client);
     Tenants = new TenantRepository(client);
     TagSets = new TagSetRepository(client);
     BuiltInPackageRepository = new BuiltInPackageRepositoryRepository(client);
     ActionTemplates = new ActionTemplateRepository(client);
     CommunityActionTemplates = new CommunityActionTemplateRepository(client);
 }
        public void Should_Throw_If_Unable_To_Parse_StoreLocation() {
            // Arrange
            var repository = new CertificateRepository(_storeWrapper.Object, _thumbprintValidator.Object);

            // Act
            TestDelegate sit = () => GetRepository().SetStoreLocation("xyz");

            // Assert
            Assert.Throws<UnableToParseArgumentException>(sit);
        }
        public void Should_Parse_LocalMachine_LowerCase_StoreLocation() {
            // Arrange
            var repository = new CertificateRepository(_storeWrapper.Object, _thumbprintValidator.Object);

            // Act
            repository.SetStoreLocation("localmachine");

            // Assert
            repository.StoreLocation.ShouldEqual(StoreLocation.LocalMachine);
        }
        public void Should_Parse_TrustedPeople_LowerCase_StoreName() {
            // Arrange
            var repository = new CertificateRepository(_storeWrapper.Object, _thumbprintValidator.Object);

            // Act
            repository.SetStoreName("trustedpeople");

            // Assert
            repository.StoreName.ShouldEqual(StoreName.TrustedPeople);
        }