Exemplo n.º 1
0
 public void TryCreate_HasMoreThan1000Chars_NotCreated()
 {
     AssertException <ArgumentException>(() =>
     {
         new Content(FakeData.Alpha(1001));
     });
 }
Exemplo n.º 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();
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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();
            });
        }
Exemplo n.º 8
0
        public static Employee Create()
        {
            var userId = new TestCurrentUserContext().UserId;

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

            Assert.NotNull(content);
        }