public void AgeShouldReturnNullIfDateOfBirthHasNotValue()
        {
            UserSettings settings = new UserSettings();

            var result = settings.Age;

            Assert.IsNull(result);
        }
Ejemplo n.º 2
0
 private void UpdateUserSettings(UserSettings model, UserSettingsViewModel viewModel)
 {
     model.FirstName = viewModel.FirstName;
     model.LastName = viewModel.LastName;
     model.City = viewModel.City;
     model.DateOfBirth = viewModel.DateOfBirth;
     model.Company = viewModel.Company;
     model.JobTitle = viewModel.JobTitle;
     model.EducationalInstitution = viewModel.EducationalInstitution;
     model.FacultyNumber = viewModel.FacultyNumber;
 }
        public void AgeShouldReturnZeroYearsIfUserIsDaysOld()
        {
            UserSettings settings = new UserSettings()
            {
                DateOfBirth = DateTime.Now.AddDays(-2)
            };

            var result = settings.Age;
            byte expected = 0;

            Assert.AreEqual(expected, result);
        }
        public void AgeShouldReturnProperAgeIfCurrentYearBirthMonthIsTheSameAndDayHasPassed()
        {
            UserSettings settings = new UserSettings()
            {
                DateOfBirth = DateTime.Now.AddYears(-10).AddDays(-1)
            };

            var result = settings.Age;
            byte expected = 10;

            Assert.AreEqual(expected, result);
        }
        public void AgeShouldReturnProperAgeIfCurrentYearBirthMonthHasNotPassed()
        {
            UserSettings settings = new UserSettings()
            {
                DateOfBirth = DateTime.Now.AddYears(-10).AddMonths(1)
            };

            var result = settings.Age;
            byte expected = 9;

            Assert.AreEqual(expected, result);
        }