예제 #1
0
        public void CreatePersonWithEmptyNameTest()
        {
            //Prepare
            var agendaService = new AgendaService();
            var person        = new Person
            {
                Id       = Guid.NewGuid(),
                Name     = "",
                Birthday = new DateTime(2010, 02, 5, 10, 20, 00)
            };

            //Assert Action
            Assert.ThrowsException <EmptyNameException>(() => agendaService.AddPerson(person));
        }
예제 #2
0
        public void CreatePersonWithInvalidBirthdayTest()
        {
            //Prepare
            var agendaService = new AgendaService();
            var person        = new Person
            {
                Id       = Guid.NewGuid(),
                Name     = "Jo�o",
                Birthday = new DateTime(1700, 02, 15, 10, 20, 00)
            };

            //Assert Action
            Assert.ThrowsException <BirthdayTooOldException>(() => agendaService.AddPerson(person));
        }
예제 #3
0
        public void CreateAcceptablePersonTest()
        {
            //Prepare
            var agendaService = new AgendaService();
            var person        = new Person
            {
                Id       = Guid.NewGuid(),
                Name     = "Jo�o da Silva",
                Birthday = new DateTime(2010, 02, 5, 10, 20, 00)
            };

            //Action/Call Test Function
            bool result = agendaService.AddPerson(person);

            //Assert
            Assert.IsTrue(result); //Se result for verdadeiro => passa no teste
        }