当前位置: 首页>>代码示例>>C#>>正文


C# UserForAuditing类代码示例

本文整理汇总了C#中UserForAuditing的典型用法代码示例。如果您正苦于以下问题:C# UserForAuditing类的具体用法?C# UserForAuditing怎么用?C# UserForAuditing使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


UserForAuditing类属于命名空间,在下文中一共展示了UserForAuditing类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Setup

        public void Setup()
        {
            _actioningUserId = Guid.NewGuid();
            _actioningUser = new UserForAuditing() { Id = _actioningUserId };

            _userForAuditingRepo = new Mock<IUserForAuditingRepository>();
            _userForAuditingRepo
                .Setup(x => x.GetByIdAndCompanyId(_actioningUserId, _companyId))
                .Returns(_actioningUser);

            _responsibilityRepo = new Mock<IResponsibilityRepository>();
            _responsibility = new Mock<Responsibility>();
            _responsibility
                .Setup(x => x.HasUndeletedTasks())
                .Returns(false);

            _responsibility
                .Setup(x => x.MarkForDelete(_actioningUser));

            _responsibilityRepo
                .Setup(x => x.GetByIdAndCompanyId(_responsibilityId, _companyId))
                .Returns(_responsibility.Object);

            _log = new Mock<IPeninsulaLog>();

        }
开发者ID:mnasif786,项目名称:Business-Safe,代码行数:26,代码来源:DeleteTests.cs

示例2: Given_FCM_is_reocurring_weekly_Then_when_it_is_completed_Then_following_task_should_be_created_with_due_date_a_week_later

        public void Given_FCM_is_reocurring_weekly_Then_when_it_is_completed_Then_following_task_should_be_created_with_due_date_a_week_later()
        {
            var assignedTo = new Employee { Id = Guid.NewGuid() };
            var user1= new UserForAuditing { Id = Guid.NewGuid() };
            var user2= new UserForAuditing { Id = Guid.NewGuid() };

            var furtherControlMeasureTask = HazardousSubstanceRiskAssessmentFurtherControlMeasureTask.Create(
                "FCM",
                "Test FCM",
                "Description",
                new DateTime(2012, 09, 13),
                TaskStatus.Outstanding,
                assignedTo,
                user1,
                new System.Collections.Generic.List<CreateDocumentParameters>
                    {
                        new CreateDocumentParameters
                            {
                                DocumentLibraryId = 2000L,
                                Description = "Test File 1",
                                DocumentType = new DocumentType {Id = 5L},
                                Filename = "Test File 1.txt"
                            }
                    },
                new TaskCategory {Id = 9L},
                (int) TaskReoccurringType.Weekly,
                new DateTime(2013, 09, 13),
                false,
                false,
                false,
                false,
                Guid.NewGuid());

            furtherControlMeasureTask.Complete("Test Comments", new List<CreateDocumentParameters>(), new List<long>(), user2, null, DateTime.Now);

            Assert.IsNotNull(furtherControlMeasureTask.FollowingTask);
            Assert.AreEqual(furtherControlMeasureTask,
                            furtherControlMeasureTask.FollowingTask.
                                PrecedingTask);
            Assert.AreEqual(furtherControlMeasureTask.Reference,
                            furtherControlMeasureTask.FollowingTask.Reference);
            Assert.AreEqual(furtherControlMeasureTask.Title,
                            furtherControlMeasureTask.FollowingTask.Title);
            Assert.AreEqual(furtherControlMeasureTask.Description,
                            furtherControlMeasureTask.FollowingTask.Description);
            Assert.AreEqual(new DateTime(2012, 09, 20),
                                         furtherControlMeasureTask.FollowingTask.TaskCompletionDueDate);
            Assert.AreEqual(furtherControlMeasureTask.TaskAssignedTo.Id,
                            furtherControlMeasureTask.FollowingTask.TaskAssignedTo.Id);
            Assert.AreEqual(user2.Id,
                            furtherControlMeasureTask.FollowingTask.CreatedBy.Id);
            Assert.AreEqual(1, furtherControlMeasureTask.FollowingTask.Documents.Count);
            Assert.AreEqual(furtherControlMeasureTask.Documents[0].DocumentLibraryId, furtherControlMeasureTask.FollowingTask.Documents[0].DocumentLibraryId);
            Assert.AreEqual(furtherControlMeasureTask.Documents[0].Description, furtherControlMeasureTask.FollowingTask.Documents[0].Description);
            Assert.AreEqual(furtherControlMeasureTask.Documents[0].DocumentType.Id, furtherControlMeasureTask.FollowingTask.Documents[0].DocumentType.Id);
            Assert.AreEqual(furtherControlMeasureTask.Documents[0].Filename, furtherControlMeasureTask.FollowingTask.Documents[0].Filename);
            Assert.AreEqual(furtherControlMeasureTask.Category.Id, furtherControlMeasureTask.FollowingTask.Category.Id);
            Assert.AreEqual(furtherControlMeasureTask.TaskReoccurringType, furtherControlMeasureTask.FollowingTask.TaskReoccurringType);
            Assert.AreEqual(furtherControlMeasureTask.TaskReoccurringEndDate, furtherControlMeasureTask.FollowingTask.TaskReoccurringEndDate);
        }
开发者ID:mnasif786,项目名称:Business-Safe,代码行数:60,代码来源:CompleteTests.cs

示例3: UpdateSummary

        public virtual void UpdateSummary(string title, string reference, DateTime? assessmentDate, RiskAssessor riskAssessor, Site site, UserForAuditing currentUser)
        {
            if (IsDifferentRiskAssessor(riskAssessor))
            {
                if (AreThereAnyFurtherControlMeasureTasks())
                {
                    Hazards
                        .Where(h => h.FurtherControlMeasureTasks != null)
                        .SelectMany(h => h.FurtherControlMeasureTasks)
                        .ToList()
                        .ForEach(task =>
                                     {
                                         task.SendTaskCompletedNotification = riskAssessor == null ? true : !riskAssessor.DoNotSendTaskCompletedNotifications;
                                         task.SendTaskOverdueNotification = riskAssessor == null ? true : !riskAssessor.DoNotSendTaskOverdueNotifications;
                                         task.SetLastModifiedDetails(currentUser);
                                     });
                }
            }

            Title = title;
            Reference = reference;
            RiskAssessor = riskAssessor;
            AssessmentDate = assessmentDate;
            RiskAssessmentSite = site;
            SetLastModifiedDetails(currentUser);

        }
开发者ID:mnasif786,项目名称:Business-Safe,代码行数:27,代码来源:MultiHazardRiskAssessment.cs

示例4: UserForAuditing

        public void Given_significant_finding_with_further_control_measure_tasks_When_mark_as_delete_Then_sets_correct_properties()
        {
            // Given
            var user = new UserForAuditing();
            var significantFinding = new SignificantFinding
            {
                FurtherControlMeasureTasks = new List<FireRiskAssessmentFurtherControlMeasureTask>
                                                 {
                                                     new FireRiskAssessmentFurtherControlMeasureTask
                                                         {
                                                             Deleted = false
                                                         }
                                                         ,
                                                         new FireRiskAssessmentFurtherControlMeasureTask
                                                         {
                                                             Deleted = false
                                                         }
                                                 }
            };

            // When
            significantFinding.MarkForDelete(user);

            // Then
            Assert.That(significantFinding.FurtherControlMeasureTasks.Count(x => x.Deleted), Is.EqualTo(2));
        }
开发者ID:mnasif786,项目名称:Business-Safe,代码行数:26,代码来源:MarkSignificantFindingAsDeletedTests.cs

示例5: SetUp

 public void SetUp()
 {
     _sourceOFIgnitionRepository = new Mock<ISourceOfIgnitionRepository>();
     _user = new UserForAuditing();
     _userRepository = new Mock<IUserForAuditingRepository>();
     _log = new Mock<IPeninsulaLog>();
 }
开发者ID:mnasif786,项目名称:Business-Safe,代码行数:7,代码来源:SaveSourceOFIgnitionTests.cs

示例6: Given_valid_request_When_update_supplier_Then_should_call_correct_methods

        public void Given_valid_request_When_update_supplier_Then_should_call_correct_methods()
        {
            // Given
            var target = CreateRolesService();

            var request = new SaveSupplierRequest()
                              {
                                  UserId = Guid.NewGuid(),
                                  Name = "Updated Supplier Name",
                                  CompanyId = 2
                              };

            var user = new UserForAuditing();
            _usersRepository
                .Setup(s => s.GetByIdAndCompanyId(request.UserId, request.CompanyId))
                .Returns(user);

            var supplier = new Mock<Supplier>();
            _suppliersRepository
                .Setup(x => x.GetByIdAndCompanyId(request.Id, request.CompanyId))
                .Returns(supplier.Object);


            // When
            target.UpdateSupplier(request);

            // Then
            _suppliersRepository.Verify(x => x.SaveOrUpdate(supplier.Object));
            supplier.Verify(x => x.Update(request.Name, user));
        }
开发者ID:mnasif786,项目名称:Business-Safe,代码行数:30,代码来源:UpdateteSupplierTests.cs

示例7: SetUp

 public void SetUp()
 {
     _nonEmployeeRepository = new Mock<INonEmployeeRepository>();
     _userRepository = new Mock<IUserForAuditingRepository>();
     _user = new UserForAuditing();
     _log = new Mock<IPeninsulaLog>();
 }
开发者ID:mnasif786,项目名称:Business-Safe,代码行数:7,代码来源:MarkNonEmployeeAsDeletedTests.cs

示例8: Given_task_is_reocurring_When_Complete_called_Then_task_is_completed

        public void Given_task_is_reocurring_When_Complete_called_Then_task_is_completed()
        {
            var employee = new Employee { Id = Guid.NewGuid() };
            var user = new User { Id = Guid.NewGuid(), Employee = employee };
            var userForAuditing = new UserForAuditing { Id = Guid.NewGuid() };

            var createDocumentParameterObjects1 = new List<CreateDocumentParameters>
                                                     {
                                                         new CreateDocumentParameters
                                                             {
                                                                 DocumentLibraryId = 726L
                                                             }
                                                     };

            var site = new Site { Id = 5232L };

            var task = ResponsibilityTask.Create(
                "Test Title 1",
                "Test Description 1",
                new DateTime(2050, 10, 01),
                TaskStatus.Outstanding,
                employee,
                userForAuditing,
                createDocumentParameterObjects1,
                new TaskCategory { Id = 4323L },
                (int)TaskReoccurringType.Monthly,
                new DateTime(2051, 10, 01),
                false,
                true,
                true,
                true,
                Guid.NewGuid(),
                site,
                new Responsibility());

            var createDocumentParameterObjects2 = new List<CreateDocumentParameters>
                                                     {
                                                         new CreateDocumentParameters
                                                             {
                                                                 DocumentLibraryId = 2344L
                                                             }
                                                     };

            task.Complete(
                "Completed Comments 1",
                createDocumentParameterObjects2,
                new List<long>(),
                userForAuditing,
                user
                );

            Assert.That(task.TaskStatus, Is.EqualTo(TaskStatus.Completed));
            Assert.That(task.TaskCompletedComments, Is.EqualTo("Completed Comments 1"));
            Assert.That(task.Documents.Count, Is.EqualTo(2));
            Assert.That(task.TaskCompletedBy, Is.EqualTo(userForAuditing));
            Assert.That(task.LastModifiedBy, Is.EqualTo(userForAuditing));
            Assert.That(task.LastModifiedOn.HasValue, Is.True);
            Assert.That(task.FollowingTask, Is.Not.Null);
            Assert.That(task.FollowingTask.TaskCompletionDueDate, Is.EqualTo(new DateTime(2050, 11, 01)));
        }
开发者ID:mnasif786,项目名称:Business-Safe,代码行数:60,代码来源:CompleteTests.cs

示例9: Given_hazards_Then_should_detach_correctly

        public void Given_hazards_Then_should_detach_correctly()
        {
            //Given
            var user = new UserForAuditing();
            var target = GeneralRiskAssessment.Create("", "", default(long), null);

            var hazardDetaching = new Hazard()
                             {
                                 Id = 1
                             };
            var hazardToRemain = new Hazard()
                             {
                                 Id = 2
                             };
            IEnumerable<Hazard> hazards = new[]
                                              {
                                                  hazardDetaching, 
                                                  hazardToRemain,  
                                              };
            target.AttachHazardsToRiskAssessment(hazards, user);
            
            
            //When
            target.DetachHazardsFromRiskAssessment(new List<Hazard> { hazardDetaching }, user);

            //Then
            Assert.That(target.Hazards.Count(x => !x.Deleted), Is.EqualTo(1));
            Assert.That(target.LastModifiedBy, Is.EqualTo(user));
        }
开发者ID:mnasif786,项目名称:Business-Safe,代码行数:29,代码来源:DetachHazardsFromRiskAssessmentTests.cs

示例10: Create

        public static FireAnswer Create(
            FireRiskAssessmentChecklist fireRiskAssessmentChecklist,
            Question question,
            YesNoNotApplicableEnum? yesNoNotApplicableResponse,
            string additionalInfo,
            UserForAuditing user)
        {
            var fireAnswer = new FireAnswer
                                 {
                                     FireRiskAssessmentChecklist = fireRiskAssessmentChecklist,
                                     Question = question,
                                     YesNoNotApplicableResponse = yesNoNotApplicableResponse,
                                     AdditionalInfo = additionalInfo,
                                     CreatedOn = DateTime.Now,
                                     CreatedBy = user
                                 };

            if (yesNoNotApplicableResponse == YesNoNotApplicableEnum.No)
            {
                var significantFinding = SignificantFinding.Create(fireAnswer, user);
                fireAnswer.SignificantFinding = significantFinding;
            }

            return fireAnswer;
        }
开发者ID:mnasif786,项目名称:Business-Safe,代码行数:25,代码来源:FireAnswer.cs

示例11: Update

        public virtual void Update(YesNoNotApplicableEnum? newAnswer, string additionalInfo, UserForAuditing user)
        {
            if (!IsAnswerDifferent(newAnswer, additionalInfo))
                return;

            if (newAnswer != YesNoNotApplicableEnum.No)
            {
                if (SignificantFinding != null)
                {
                    SignificantFinding.MarkForDelete(user);
                }
            }
            else if (newAnswer == YesNoNotApplicableEnum.No)
            {
                if (SignificantFinding == null)
                {
                    SignificantFinding = SignificantFinding.Create(this, user);
                }
                else
                {
                    SignificantFinding.ReinstateFromDelete(user);
                }
            }

            YesNoNotApplicableResponse = newAnswer;
            AdditionalInfo = additionalInfo;
            SetLastModifiedDetails(user);
        }
开发者ID:mnasif786,项目名称:Business-Safe,代码行数:28,代码来源:FireAnswer.cs

示例12: Given_valid_request_When_MarkRiskAssessorAsDeleted_Then_should_call_correct_methods

        public void Given_valid_request_When_MarkRiskAssessorAsDeleted_Then_should_call_correct_methods()
        {
            // Given
            var target = GetTarget();
            var request = new MarkRiskAssessorAsDeletedAndUndeletedRequest()
                              {
                                  CompanyId = 100,
                                  UserId = Guid.NewGuid(),
                                  RiskAssessorId = 400
                              };


            var user = new UserForAuditing();
            _userForAuditingRepository
                .Setup(x => x.GetByIdAndCompanyId(request.UserId, request.CompanyId))
                .Returns(user);

            _riskAssessmentRepository
                .Setup(x => x.DoesAssessmentExistForRiskAssessor(request.RiskAssessorId, request.CompanyId))
                .Returns(false);

            var riskAssessor = new Mock<RiskAssessor>();
            _riskAssessorRepository
                .Setup(x => x.GetByIdAndCompanyId(request.RiskAssessorId, request.CompanyId))
                .Returns(riskAssessor.Object);

            // When
            target.MarkDeleted(request);

            // Then
            _riskAssessmentRepository.VerifyAll();
            riskAssessor.Verify(x => x.MarkForDelete(user));
            _userForAuditingRepository.VerifyAll();
            _riskAssessorRepository.Verify(x => x.SaveOrUpdate(riskAssessor.Object));
        }
开发者ID:mnasif786,项目名称:Business-Safe,代码行数:35,代码来源:MarkRiskAssessorAsDeletedTests.cs

示例13: Given_valid_request_to_disable_user_Then_should_delete_user

        public void Given_valid_request_to_disable_user_Then_should_delete_user()
        {
            //Given
            var target = CreateUserService();

            var actioningUserId = Guid.NewGuid();
            var actioningUser = new UserForAuditing() { Id = actioningUserId };

            var userId = Guid.NewGuid();
            var userToDelete = new Mock<User>() { CallBase = true };
            userToDelete.Setup(x => x.Id).Returns(userId);
            userToDelete.Setup(x => x.AuthenticationTokens).Returns(new List<AuthenticationToken>());

            _userForAuditingRepo
                .Setup(x => x.GetById(actioningUserId))
                .Returns(actioningUser);

            _userRepo
                .Setup(x => x.GetById(userId))
                .Returns(userToDelete.Object);

            //When
            target.DeleteUser(userId, actioningUserId);

            //Then
            Assert.That(userToDelete.Object.Deleted, Is.True);
        }
开发者ID:mnasif786,项目名称:Business-Safe,代码行数:27,代码来源:DeleteUserFromEventHandlerTests.cs

示例14: Create

        public static PersonalRiskAssessment Create(
            string title,
            string reference,
            long clientId,
            UserForAuditing currentUser,
            string location,
            string taskProcessDescription,
            Site site,
            DateTime? assessmentDate,
            RiskAssessor riskAssessor,
            bool IsSensitive
            )
        {
            var riskAssessment = new PersonalRiskAssessment
                                     {
                                         Title = title,
                                         Reference = reference,
                                         AssessmentDate = assessmentDate,
                                         RiskAssessmentSite = site,
                                         RiskAssessor = riskAssessor,
                                         Location = location,
                                         TaskProcessDescription = taskProcessDescription,
                                         CompanyId = clientId,
                                         CreatedBy = currentUser,
                                         CreatedOn = DateTime.Now,
                                         Status = RiskAssessmentStatus.Draft,
                                         Sensitive = IsSensitive
                                     };

            return riskAssessment;
        }
开发者ID:mnasif786,项目名称:Business-Safe,代码行数:31,代码来源:PersonalRiskAssessment.cs

示例15: Given_valid_request_When_mark_for_live_Then_calls_the_correct_methods

        public void Given_valid_request_When_mark_for_live_Then_calls_the_correct_methods()
        {
            //Given
            var riskAssessmentService = CreateRiskAssessmentService();

            var request = new MarkRiskAssessmentAsLiveRequest()
                              {
                                  CompanyId = 100,
                                  UserId = Guid.NewGuid(),
                                  RiskAssessmentId = 200
                              };

            var user = new UserForAuditing();
            _userRepository
                .Setup(x => x.GetByIdAndCompanyId(request.UserId, request.CompanyId))
                .Returns(user);

            var mockRiskAssessment = new Mock<BusinessSafe.Domain.Entities.HazardousSubstanceRiskAssessment>();
            _riskAssessmentRepository
                .Setup(rr => rr.GetByIdAndCompanyId(request.RiskAssessmentId, request.CompanyId))
                .Returns(mockRiskAssessment.Object);


            //When
            riskAssessmentService.MarkRiskAssessmentAsLive(request);

            //Then
            _riskAssessmentRepository.Verify(x => x.SaveOrUpdate(mockRiskAssessment.Object));
            mockRiskAssessment.Verify(x => x.MarkAsLive(user));
        }
开发者ID:mnasif786,项目名称:Business-Safe,代码行数:30,代码来源:MarkRiskAssessmentAsLiveTests.cs


注:本文中的UserForAuditing类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。