• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# UserForAuditing类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: When_reassign_Then_should_set_properties_correctly

        public void When_reassign_Then_should_set_properties_correctly()
        {
            //Given
            var document = new TaskDocument()
                               {
                                   Description = "Woo hoo",
                                   DocumentLibraryId = 1,
                                   DocumentType = new DocumentType(),
                                   Extension = ".biz",
                                   Filename = "FooBar",
                                   FilesizeByte = 2000
                               };

            var user = new UserForAuditing();
            

            //When
            var result = document.CloneForReoccurring(user);

            //Then
            Assert.That(result.DocumentLibraryId, Is.EqualTo(document.DocumentLibraryId));
            Assert.That(result.Filename, Is.EqualTo(document.Filename));
            Assert.That(result.Extension, Is.EqualTo(document.Extension));
            Assert.That(result.FilesizeByte, Is.EqualTo(document.FilesizeByte));
            Assert.That(result.Description, Is.EqualTo(document.Description));
            Assert.That(result.CreatedBy, Is.EqualTo(user));
            Assert.That(result.DocumentType, Is.EqualTo(document.DocumentType));
            Assert.That(result.CreatedOn.Value.Date, Is.EqualTo(DateTime.Now.Date));
        }
开发者ID:mnasif786,项目名称:Business-Safe,代码行数:29,代码来源:CloneForReoccurringTests.cs


示例17: Given_multiple_safety_control_measure_to_add_When_Attach_Then_should_be_added_correctly

        public void Given_multiple_safety_control_measure_to_add_When_Attach_Then_should_be_added_correctly()
        {
            //Given
            var user = new UserForAuditing();
            var fireRiskAssessment = FireRiskAssessment.Create("title", "reference", 100, new Checklist(), user);

            IEnumerable<FireSafetyControlMeasure> fireSafetControlMeasuresToAttach = new List<FireSafetyControlMeasure>()
                                                                                         {
                                                                                             new FireSafetyControlMeasure()
                                                                                                 {
                                                                                                     Id = 1,
                                                                                                     
                                                                                                 },
                                                                                            new FireSafetyControlMeasure()
                                                                                                 {
                                                                                                     Id = 2,
                                                                                                 }
                                                                                            ,
                                                                                            new FireSafetyControlMeasure()
                                                                                                 {
                                                                                                     Id = 3,
                                                                                                 }
                                                                                         };

            //When
            fireRiskAssessment.AttachFireSafetyControlMeasuresToRiskAssessment(fireSafetControlMeasuresToAttach, user);

            //Then
            Assert.That(fireRiskAssessment.FireSafetyControlMeasures.Count(x => x.FireSafetyControlMeasure.Id == 1), Is.EqualTo(1));
            Assert.That(fireRiskAssessment.FireSafetyControlMeasures.Count(x => x.FireSafetyControlMeasure.Id == 2), Is.EqualTo(1));
            Assert.That(fireRiskAssessment.FireSafetyControlMeasures.Count(x => x.FireSafetyControlMeasure.Id == 3), Is.EqualTo(1));
        }
开发者ID:mnasif786,项目名称:Business-Safe,代码行数:32,代码来源:AttachFireSafetyControlMeasuresToRiskAssessmentTests.cs


示例18: UserForAuditing

        public void Given_a_existing_yes_answer_but_update_no_and_have_a_deleted_significant_finding_When_answer_updated_Then_should_set_properties_as_expected()
        {
            // Given
            var user = new UserForAuditing();
            var fireRiskAssessmentChecklist = new FireRiskAssessmentChecklist();
            var question = new Question();

            var target = FireAnswer.Create(fireRiskAssessmentChecklist, question, YesNoNotApplicableEnum.Yes, "Additional Info", user);
            target.SignificantFinding = new SignificantFinding()
                                            {
                                                Deleted = true
                                            };
            
            // When
            target.Update(YesNoNotApplicableEnum.No, "Additional Info", user);

            // Then
            Assert.That(target.SignificantFinding, Is.Not.Null);
            Assert.That(target.SignificantFinding.Deleted, Is.False);
            Assert.That(target.FireRiskAssessmentChecklist, Is.EqualTo(fireRiskAssessmentChecklist));
            Assert.That(target.YesNoNotApplicableResponse, Is.EqualTo(YesNoNotApplicableEnum.No));
            Assert.That(target.AdditionalInfo, Is.EqualTo("Additional Info"));
            Assert.That(target.LastModifiedOn.Value.ToShortDateString(), Is.EqualTo(DateTime.Now.ToShortDateString()));
            Assert.That(target.LastModifiedBy, Is.EqualTo(user));
        }
开发者ID:mnasif786,项目名称:Business-Safe,代码行数:25,代码来源:UpdateTests.cs


示例19: Given_all_required_fields_are_available_Then_create_user_method_creates_an_object

        public void Given_all_required_fields_are_available_Then_create_user_method_creates_an_object()
        {
            //Given
            Guid userId = Guid.NewGuid();
            const long companyId = 33749;
            const long siteId = 324234L;
            var role = new Role() { Id = new Guid("BACF7C01-D210-4DBC-942F-15D8456D3B92") };
            var user = new UserForAuditing() { Id = new Guid("B03C83EE-39F2-4F88-B4C4-7C276B1AAD99") };
            var site = new Site() {Id = siteId};
            var employeeContactDetail = new EmployeeContactDetail {Email = "[email protected]"};
            var employee = new Employee {Forename = "Gary", Surname = "Green",ContactDetails = new List<EmployeeContactDetail> {employeeContactDetail}};

            //When
            var result = User.CreateUser(userId, companyId, role, site, employee, user);

            //Then
            Assert.That(result.Id, Is.EqualTo(userId));
            Assert.That(result.CompanyId, Is.EqualTo(companyId));
            Assert.That(result.Site.Id, Is.EqualTo(siteId));
            Assert.That(result.Employee, Is.Not.Null);
            Assert.That(result.Employee.Forename, Is.EqualTo("Gary"));
            Assert.That(result.Employee.Surname, Is.EqualTo("Green"));
            Assert.That(result.Employee.ContactDetails, Is.Not.Null);
            Assert.That(result.Employee.ContactDetails.Count, Is.EqualTo(1));
            Assert.That(result.Employee.ContactDetails[0].Email, Is.EqualTo("[email protected]"));
        }
开发者ID:mnasif786,项目名称:Business-Safe,代码行数:26,代码来源:RegisterAdminTests.cs


示例20: Given_valid_request_to_enable_user_Then_should_call_appropiate_methods

        public void Given_valid_request_to_enable_user_Then_should_call_appropiate_methods()
        {
            //Given
            var target = CreateUSerService();
            var userId = Guid.NewGuid();
            var currentUserId = Guid.NewGuid();
            const int companyId = 100;
            var currentUser = new UserForAuditing();
            var user = new Mock<User>();
            user.Setup(x => x.Deleted).Returns(true);

            _userForAuditingRepo
                .Setup(x => x.GetByIdAndCompanyId(currentUserId, companyId))
                .Returns(currentUser);


            _userForAuditingRepo
                .Setup(x => x.GetById(currentUserId))
                .Returns(currentUser);


            _userRepo
                .Setup(x => x.GetByIdAndCompanyIdIncludeDeleted(userId, companyId))
                .Returns(user.Object);

            //When
            target.ReinstateUser(userId, companyId, currentUserId);

            //Then
            user.Verify(x => x.ReinstateFromDelete(currentUser));
            _userRepo.Verify(x => x.SaveOrUpdate(user.Object));
        }
开发者ID:mnasif786,项目名称:Business-Safe,代码行数:32,代码来源:EnableUserTests.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# UserGroup类代码示例发布时间:2022-05-24
下一篇:
C# UserDetails类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap