Ejemplo n.º 1
0
        public void APersonMustHaveAName()
        {
            //Arrange
            PersonBL.PersonBL logic  = new PersonBL.PersonBL();
            Person            person = new Person()

            {
                Id       = 1,
                Name     = "",
                Birthday = DateTime.Now
            };

            //Act & Assert

            Assert.ThrowsException <ArgumentException>(() => logic.Create(person));
        }
Ejemplo n.º 2
0
        public void APersonIsCreated()
        {
            //Arrange
            PersonBL.PersonBL logic  = new PersonBL.PersonBL();
            Person            person = new Person()

            {
                Id       = 1,
                Name     = "Some Person",
                Birthday = DateTime.Now
            };

            //Act
            logic.Create(person);
            Person saved = logic.GetById(1);


            //Assert
            Assert.IsNotNull(saved, "Person should not been null after insert or person found");
        }
Ejemplo n.º 3
0
        public void TheAgeOfAPersonIsCalculatedCorrectly()
        {
            //Arrange profe
            Person p = new Person();

            //set values
            p.Birthday = new DateTime(2010, 01, 01);


            //Arrange
            PersonBL.PersonBL logic  = new PersonBL.PersonBL();
            Person            person = new Person()

            {
                Id       = 1,
                Name     = "",
                Birthday = DateTime.Now
            };

            // Act & Assert
            Assert.AreEqual(8, p.Age);
        }