Ejemplo n.º 1
0
        public async Task DataGrid_EndToEnd_ReadTotal()
        {
            var workspaceId = Config.WorkSpaceId;
            var auditQuery  = new AuditQuery
            {
                ActionTypes = new List <AuditActionId> {
                    AuditActionId.DocumentQuery
                },
                StartTime   = DateTime.MinValue,
                EndTime     = DateTime.UtcNow,
                WorkspaceId = workspaceId
            };

            // However we grab this for testing...
            var apiClientHelper       = new ApiClientHelper();
            var auditLogObjectManager = apiClientHelper.GetKeplerServiceReference <IExternalAuditLogObjectManager>();
            //using (var auditLogObjectManager = TestUtilities.GetServicesManager().CreateProxy<IExternalAuditLogObjectManager>(ExecutionIdentity.System))

            // Mock it up for the implementation
            var mockFactory = new Mock <IAuditLogObjectManagerFactory>();

            mockFactory.Setup(m => m.GetManager()).Returns(() => auditLogObjectManager.Value);
            var dataGridWorkspaceAuditService = DataGridEndToEnd.SetUpWorkspaceAuditService(mockFactory.Object);

            var result =
                await
                dataGridWorkspaceAuditService.ReadTotalAuditsForHourAsync(workspaceId, auditQuery.StartTime, auditQuery.EndTime,
                                                                          auditQuery.ActionTypes);

            Assert.Pass($"Test Passed - ResultCount {result}");
        }
Ejemplo n.º 2
0
        private void SetUpAuditRepository()
        {
            DataGridEndToEnd.SetUpDataGridOnlyWorkspaceAuditServiceFactory(this.Kernel);

            /*
             * var dataGridWorkspaceAuditService = DataGridEndToEnd.SetUpWorkspaceAuditService();
             *
             * var workspaceAuditServiceFactoryMock = new Mock<IWorkspaceAuditServiceFactory>();
             * workspaceAuditServiceFactoryMock.Setup(
             *              m => m.GetAuditService(It.IsAny<int>(), It.IsAny<DateTime>(), It.IsAny<DateTime>()))
             *      .ReturnsAsync(dataGridWorkspaceAuditService);
             * Kernel.Rebind<IWorkspaceAuditServiceFactory>().ToConstant(workspaceAuditServiceFactoryMock.Object);
             * //*/
        }
Ejemplo n.º 3
0
        public async Task DataGrid_EndToEnd_ReadAudits()
        {
            var workspaceId = Config.WorkSpaceId;
            var auditQuery  = new AuditQuery
            {
                ActionTypes = new List <AuditActionId> {
                    AuditActionId.DocumentQuery
                },
                StartTime   = DateTime.MinValue,
                EndTime     = DateTime.UtcNow,
                WorkspaceId = workspaceId
            };

            var queryBatch = new AuditQueryBatch
            {
                Query = auditQuery,
                Size  = 50,
                Start = 0
            };

            // However we grab this for testing...
            var apiClientHelper       = new ApiClientHelper();
            var auditLogObjectManager = apiClientHelper.GetKeplerServiceReference <IExternalAuditLogObjectManager>();
            // Mock it up for the implementation
            var mockFactory = new Mock <IAuditLogObjectManagerFactory>();

            mockFactory.Setup(m => m.GetManager()).Returns(() => auditLogObjectManager.Value);
            var dataGridWorkspaceAuditService = DataGridEndToEnd.SetUpWorkspaceAuditService(mockFactory.Object);

            var result = await dataGridWorkspaceAuditService.ReadAuditsAsync(workspaceId, auditQuery.StartTime,
                                                                             auditQuery.EndTime,
                                                                             auditQuery.ActionTypes, queryBatch.Size, queryBatch.Start);

            var resultMessages =
                result.Select(
                    r =>
                    $"AuditId: {r.AuditID}, UserId {r.UserID}, Action: {r.Action}, ArtifactID: {r.ArtifactID}, ExecutionTime: {r.ExecutionTime}, WorkspaceId: {r.WorkspaceId}, TimeStamp: {r.TimeStamp}, Details: {r.Details}");
            var finalMessage = string.Join("||", resultMessages);

            Assert.Pass($"Test Passed - ResultCount {result.Count} -- {finalMessage}");
        }