Example #1
0
            public void IsTrue_WhenEmployeeOrStudentAffiliation_IsEmployeeOnly()
            {
                var model = new UpdateAffiliationForm {
                    EmployeeOrStudentAffiliation = EmployeeOrStudentAffiliate.StudentOnly
                };

                model.IsClaimingStudent.ShouldBeTrue();
            }
Example #2
0
            public void IsFalse_WhenEmployeeOrStudentAffiliation_IsNull()
            {
                var model = new UpdateAffiliationForm {
                    EmployeeOrStudentAffiliation = null
                };

                model.IsClaimingStudent.ShouldBeFalse();
            }
Example #3
0
            public void IsFalse_WhenEmployeeOrStudentAffiliation_IsNeither()
            {
                var model = new UpdateAffiliationForm {
                    EmployeeOrStudentAffiliation = EmployeeOrStudentAffiliate.Neither
                };

                model.IsClaimingEmployee.ShouldBeFalse();
            }
Example #4
0
            public void IsTrue_WhenEmployeeOrStudentAffiliation_IsBoth()
            {
                var model = new UpdateAffiliationForm {
                    EmployeeOrStudentAffiliation = EmployeeOrStudentAffiliate.Both
                };

                model.IsClaimingEmployee.ShouldBeTrue();
            }
            public void IgnoresChangeCount()
            {
                var model = new UpdateAffiliationForm();

                var command = Mapper.Map <UpdateMyAffiliationCommand>(model);

                command.ShouldNotBeNull();
                command.ChangeCount.ShouldEqual(0);
            }
            public void MapsIsClaimingAdministrator()
            {
                var model = new UpdateAffiliationForm {
                    IsClaimingAdministrator = true
                };

                var command = Mapper.Map <UpdateMyAffiliationCommand>(model);

                command.ShouldNotBeNull();
                command.IsClaimingAdministrator.ShouldEqual(model.IsClaimingAdministrator);
            }
            public void MapsIsClaimingStaff()
            {
                var model = new UpdateAffiliationForm {
                    IsClaimingStaff = true
                };

                var command = Mapper.Map <UpdateMyAffiliationCommand>(model);

                command.ShouldNotBeNull();
                command.IsClaimingStaff.ShouldEqual(model.IsClaimingStaff);
            }
            public void MapsIsClaimingInternationalOffice()
            {
                var model = new UpdateAffiliationForm {
                    IsClaimingInternationalOffice = true
                };

                var command = Mapper.Map <UpdateMyAffiliationCommand>(model);

                command.ShouldNotBeNull();
                command.IsClaimingInternationalOffice.ShouldEqual(model.IsClaimingInternationalOffice);
            }
            public void MapsJobTitles()
            {
                var model = new UpdateAffiliationForm {
                    JobTitles = "test"
                };

                var command = Mapper.Map <UpdateMyAffiliationCommand>(model);

                command.ShouldNotBeNull();
                command.JobTitles.ShouldEqual(model.JobTitles);
            }
            public void MapsEstablishmentId()
            {
                var model = new UpdateAffiliationForm {
                    EstablishmentId = 96
                };

                var command = Mapper.Map <UpdateMyAffiliationCommand>(model);

                command.ShouldNotBeNull();
                command.EstablishmentId.ShouldEqual(model.EstablishmentId);
            }
            public void MapsIsClaimingEmployee_ToTrue_WhenEmployeeOrStudentAffiliation_IsBoth()
            {
                var model = new UpdateAffiliationForm {
                    EmployeeOrStudentAffiliation = EmployeeOrStudentAffiliate.Both
                };

                var command = Mapper.Map <UpdateMyAffiliationCommand>(model);

                command.ShouldNotBeNull();
                command.IsClaimingEmployee.ShouldBeTrue();
            }
            public void MapsIsClaimingEmployee_ToFalse_WhenEmployeeOrStudentAffiliation_IsNeither()
            {
                var model = new UpdateAffiliationForm {
                    EmployeeOrStudentAffiliation = EmployeeOrStudentAffiliate.Neither
                };

                var command = Mapper.Map <UpdateMyAffiliationCommand>(model);

                command.ShouldNotBeNull();
                command.IsClaimingEmployee.ShouldBeFalse();
            }
Example #13
0
            public void IsValidWhen_EmployeeOrStudentAffiliation_IsNotEmpty()
            {
                var validator = new UpdateAffiliationValidator();
                var model     = new UpdateAffiliationForm
                {
                    EmployeeOrStudentAffiliation = EmployeeOrStudentAffiliate.Neither
                };
                var results = validator.Validate(model);
                var error   = results.Errors.SingleOrDefault(e =>
                                                             e.PropertyName == UpdateAffiliationForm.EmployeeOrStudentAffiliationPropertyName);

                error.ShouldBeNull();
            }
Example #14
0
            public void IsInvalidWhen_EmployeeOrStudentAffiliation_IsNull()
            {
                var validator = new UpdateAffiliationValidator();
                var model     = new UpdateAffiliationForm {
                    EmployeeOrStudentAffiliation = null
                };
                var results = validator.Validate(model);

                results.IsValid.ShouldBeFalse();
                results.Errors.Count.ShouldBeInRange(1, int.MaxValue);
                var error = results.Errors.SingleOrDefault(e =>
                                                           e.PropertyName == UpdateAffiliationForm.EmployeeOrStudentAffiliationPropertyName);

                error.ShouldNotBeNull();
                // ReSharper disable PossibleNullReferenceException
                error.ErrorMessage.ShouldEqual(
                    UpdateAffiliationValidator.FailedBecauseEmployeeOrStudentAffiliationWasEmpty);
                // ReSharper restore PossibleNullReferenceException
            }
Example #15
0
            public void Implements_IReturnUrl()
            {
                var model = new UpdateAffiliationForm();

                model.ShouldImplement <IReturnUrl>();
            }