public void ShouldReturnErrorMessageWhenVisitsPriceIsTooSmall()
        {
            visit.Price = -1M;
            var result = TestModelHelper.Validate(visit);

            var expected = "Price must be between 0 and 1000000.";
            var actual   = result[0].ErrorMessage;

            Assert.AreEqual(expected, actual);
        }
        public void ShouldReturnOneErrorOnListWhenVisitsPriceIsTooBig()
        {
            visit.Price = 1000001M;
            var result = TestModelHelper.Validate(visit);

            var expected = 1;
            var actual   = result.Count;

            Assert.AreEqual(expected, actual);
        }
Beispiel #3
0
        public void ShouldReturnErrorMessageWhenDoctorsLastnameIsTooShort()
        {
            var doctor = new Doctor()
            {
                Firstname = _firstname,
                Lastname  = "a",
                Pesel     = _pesel
            };
            var result = TestModelHelper.Validate(doctor);

            var expected = "Invalid name value (must be at least 3 characters; max 30).";
            var actual   = result[0].ErrorMessage;

            Assert.AreEqual(expected, actual);
        }
Beispiel #4
0
        public void ShouldReturnOneErrorOnListWhenDoctorsFirstnameRegexIsNotValid()
        {
            var doctor = new Doctor()
            {
                Firstname = "Adam1",
                Lastname  = _lastname,
                Pesel     = _pesel
            };
            var result = TestModelHelper.Validate(doctor);

            var expected = 1;
            var actual   = result.Count;

            Assert.AreEqual(expected, actual);
        }
Beispiel #5
0
        public void ShouldReturnTwoErrorsOnListWhenDoctorsFirstnameAndLastnameIsNotValid()
        {
            var doctor = new Doctor()
            {
                Firstname = "adam21",
                Lastname  = "123logan",
                Pesel     = _pesel
            };
            var result = TestModelHelper.Validate(doctor);

            var expected = 2;
            var actual   = result.Count;

            Assert.AreEqual(expected, actual);
        }
Beispiel #6
0
        public void ShouldReturnOneErrorOnListWhenDoctorsPESELIsTooLong()
        {
            var doctor = new Doctor()
            {
                Firstname = _firstname,
                Lastname  = _lastname,
                Pesel     = "940101010101"
            };
            var result = TestModelHelper.Validate(doctor);

            var expected = 1;
            var actual   = result.Count;

            Assert.AreEqual(expected, actual);
        }
Beispiel #7
0
        public void ShouldReturnErrorMessageWhenDoctorsPESELIsTooShort()
        {
            var doctor = new Doctor()
            {
                Firstname = _firstname,
                Lastname  = _lastname,
                Pesel     = "9401010101"
            };
            var result = TestModelHelper.Validate(doctor);

            var expected = "Invalid PESEL length (must be 11 characters).";
            var actual   = result[0].ErrorMessage;

            Assert.AreEqual(expected, actual);
        }
        public void ShouldReturnOneErrorOnListWhenPatientsFirstnameRegexIsNotValid()
        {
            var patient = new Patient()
            {
                Firstname   = "Adam1",
                Lastname    = _lastname,
                Pesel       = _pesel,
                DateOfBirth = _dateOfBirth
            };
            var result = TestModelHelper.Validate(patient);

            var expected = 1;
            var actual   = result.Count;

            Assert.AreEqual(expected, actual);
        }
        public void ShouldReturnErrorMessageWhenPatientsFirstnameIsTooShort()
        {
            var patient = new Patient()
            {
                Firstname   = "a",
                Lastname    = _lastname,
                Pesel       = _pesel,
                DateOfBirth = _dateOfBirth
            };
            var result = TestModelHelper.Validate(patient);

            var expected = "Invalid name value (must be at least 3 characters; max 30).";
            var actual   = result[0].ErrorMessage;

            Assert.AreEqual(expected, actual);
        }
        public void ShouldReturnTwoErrorsOnListWhenPatientsFirstnameAndPESELIsNotValid()
        {
            var patient = new Patient()
            {
                Firstname   = "a",
                Lastname    = _lastname,
                Pesel       = "9401010101",
                DateOfBirth = _dateOfBirth
            };
            var result = TestModelHelper.Validate(patient);

            var expected = 2;
            var actual   = result.Count;

            Assert.AreEqual(expected, actual);
        }
        public void ShouldReturnOneErrorOnListWhenPatientsDateOfBirthIsFromFuture()
        {
            var patient = new Patient()
            {
                Firstname   = _firstname,
                Lastname    = _lastname,
                Pesel       = _pesel,
                DateOfBirth = new DateTime(2020, 1, 1)
            };
            var result = TestModelHelper.Validate(patient);

            var expected = 1;
            var actual   = result.Count;

            Assert.AreEqual(expected, actual);
        }
        public void ShouldReturnErrorMessageWhenPatientsDateOfBirthIsFromFuture()
        {
            var patient = new Patient()
            {
                Firstname   = _firstname,
                Lastname    = _lastname,
                Pesel       = _pesel,
                DateOfBirth = new DateTime(2020, 1, 1)
            };
            var result = TestModelHelper.Validate(patient);

            var expected = "Invalid date of birth (cannot be from the future).";
            var actual   = result[0].ErrorMessage;

            Assert.AreEqual(expected, actual);
        }
        public void ShouldReturnOneErrorOnListWhenPatientsPESELIsTooLong()
        {
            var patient = new Patient()
            {
                Firstname   = _firstname,
                Lastname    = _lastname,
                Pesel       = "940101010101",
                DateOfBirth = _dateOfBirth
            };
            var result = TestModelHelper.Validate(patient);

            var expected = 1;
            var actual   = result.Count;

            Assert.AreEqual(expected, actual);
        }
        public void ShouldReturnErrorMessageWhenPatientsPESELIsTooShort()
        {
            var patient = new Patient()
            {
                Firstname   = _firstname,
                Lastname    = _lastname,
                Pesel       = "9401010101",
                DateOfBirth = _dateOfBirth
            };
            var result = TestModelHelper.Validate(patient);

            var expected = "Invalid PESEL length (must be 11 characters).";
            var actual   = result[0].ErrorMessage;

            Assert.AreEqual(expected, actual);
        }