Beispiel #1
0
        public bool UpdateHuman(Human human)
        {
            if (Repo.Update(human))
                return true;
            return false;

        }
Beispiel #2
0
        public bool CreateHuman(string firstName, string lastName, DateTime pickedDateOfBirth)
        {
            Human human = new Human()
            {
                FirstName = CheckNameContainsCorrectCharactersElseNull(firstName),
                LastName = CheckNameContainsCorrectCharactersElseNull(lastName),
                Birthdate = new DateTime(pickedDateOfBirth.Year, pickedDateOfBirth.Month, pickedDateOfBirth.Day),
                Pnr = GeneratePersonNumber(pickedDateOfBirth)
            };

            if (human.FirstName != null && human.LastName != null)
            {
                Repo.Create(human);
                return true;
            }
            return false;
        }
Beispiel #3
0
        public void UpdateHumanTest()
        {
            //Arrange
            Human human = new Human
            {
                FirstName = "Anton",
                LastName = "Cornett"
            };

            var mock = new Mock<IRepository>();
            mock.Setup(repo => repo.Update(human)).Returns(true);

            var logic = new HumanLogic(mock.Object);

            //Act
            var something = logic.UpdateHuman(human);

            //Assert
            Assert.IsTrue(something);
        }
Beispiel #4
0
 public HumanView(Human human)
 {
     InitializeComponent();
     DataContext = new HumansViewModel();
     HumansViewModel.UpdateHumanProp(human);
 }
Beispiel #5
0
 public void UpdateHumanProp(Human human)
 {
     Human = human;
 }
Beispiel #6
0
 public HumansViewModel(Human human)
 {
     Humans = humanLogic.GetAllHumans();
     Human = human;
 }