示例#1
0
 public void TryCreate_HasMoreThan1000Chars_NotCreated()
 {
     AssertException <ArgumentException>(() =>
     {
         new Content(FakeData.Alpha(1001));
     });
 }
示例#2
0
        public void AddDraftApplicationWithEmployeesInDatabase(ILifetimeScope scope)
        {
            var readContext = scope.Resolve <IncidentReportReadDbContext>();

            readContext.Database.EnsureCreated();

            readContext.DraftApplications.Add(new DraftApplication
            {
                Id           = Guid.NewGuid(),
                IncidentType = "FinancialViolations",
                Title        = FakeData.Alpha(10),
                Content      = FakeData.Alpha(15),
                Applicant    = this.CreateEmployee(),
                Attachments  = new List <Attachment>()
                {
                    CreateAttachment()
                },
                DraftApplicationSuspiciousEmployees = new List <DraftApplicationSuspiciousEmployee>()
                {
                    new DraftApplicationSuspiciousEmployee()
                    {
                        Employee = this.CreateEmployee()
                    },
                    new DraftApplicationSuspiciousEmployee
                    {
                        Employee = this.CreateEmployee()
                    }
                }
            });

            readContext.SaveChanges();
        }
示例#3
0
        public DraftApplication Create(EmployeeId applicant, List <EmployeeId> suspiciousEmployee)
        {
            var draftApplication = DraftApplication.Create(
                new Title(FakeData.Alpha(10)),
                new Content(FakeData.Alpha(100)),
                IncidentType.AdverseEffectForTheCompany, applicant,
                suspiciousEmployee);

            return(draftApplication);
        }
示例#4
0
        public IncidentApplication CreatePostedWithAttachments(EmployeeId applicant, EmployeeId suspiciousEmployee)
        {
            var incidentApplication = IncidentApplication.Create(
                new Title(FakeData.Alpha(12)),
                new Content(FakeData.Alpha(100)),
                IncidentType.AdverseEffectForTheCompany, applicant,
                new List <EmployeeId>()
            {
                suspiciousEmployee
            }, this.CreateAttachment());

            return(incidentApplication);
        }
示例#5
0
        private DraftApplication CreateTestDraftApplicationEntity(EmployeeId applicantId, EmployeeId suspiciousEmployeeId)
        {
            var draftApplication = DraftApplication.Create(
                new Title(FakeData.Alpha(12)),
                new Content(FakeData.Alpha(100)),
                IncidentType.AdverseEffectForTheCompany,
                applicantId,
                new List <EmployeeId> {
                suspiciousEmployeeId
            });

            return(draftApplication);
        }
示例#6
0
        public static IncidentApplication CreateInCreatedStateValid()
        {
            var applicationBuilder = new IncidentApplicationBuilder()
                                     .SetTitle(FakeData.Alpha(10))
                                     .SetContent(FakeData.Alpha(100))
                                     .SetIncidentType(IncidentType.AdverseEffectForTheCompany)
                                     .SetApplicantId(new EmployeeId(Guid.NewGuid()))
                                     .SetSuspiciousEmployees(x => x.SetEmployees(new List <EmployeeId> {
                new EmployeeId(Guid.NewGuid())
            }));

            var createdApplication = applicationBuilder.Build();

            return(createdApplication);
        }
示例#7
0
        public void IndicateAtLeastOneSuspect_NotCreated()
        {
            var employeeId = new EmployeeId(Guid.NewGuid());

            var applicationBuilder = new IncidentApplicationBuilder()
                                     .SetApplicantId(employeeId)
                                     .SetSuspiciousEmployees(x => x.SetEmployees(new List <EmployeeId>()))
                                     .SetTitle(FakeData.Alpha(10))
                                     .SetContent(FakeData.Alpha(100))
                                     .SetIncidentType(IncidentType.AdverseEffectForTheCompany);

            AssertBrokenRule <IndicateAtLeastOneSuspectRule>(() =>
            {
                var applicationDraft = applicationBuilder.Build();
            });
        }
示例#8
0
        public static Employee Create()
        {
            var userId = new TestCurrentUserContext().UserId;

            return(new Employee(userId, FakeData.Alpha(10), FakeData.Alpha(10)));
        }
示例#9
0
 public static Employee Create()
 {
     return(new Employee(Guid.NewGuid(), FakeData.Alpha(10), FakeData.Alpha(10)));
 }
示例#10
0
        public void TryCreate_Has10Chars_Created()
        {
            var content = new Content(FakeData.Alpha(10));

            Assert.NotNull(content);
        }