Exemplo n.º 1
0
        public void APersonIsCreated()
        {
            //Arrange
            PersonBL logic  = new PersonBL();
            Person   person = new Person()
            {
                Id        = 1,
                Name      = "John Smith",
                BirthDate = new DateTime(1999, 1, 1)
            };

            //Act
            logic.Create(person);
            var lastInserted = logic.GetById(1);

            //Assert
            Assert.IsNotNull(lastInserted, "The last inserted is null.");
        }
Exemplo n.º 2
0
        public void APersonIsCreated() //Prueba de crear un objeto
        {
            //Arrange: configura todo lo que va a utilizar

            PersonBL logic  = new PersonBL();
            Person   person = new Person()
            {
                Id        = 1,
                Name      = "Some Person",
                BirthDate = DateTime.Now
            };


            //Act: llama al método
            logic.Create(person);
            Person saved = logic.GetById(1);


            //Assert: que tuvo que pasar
            Assert.IsNotNull(saved, "Person should have not been null after insert");
        }
Exemplo n.º 3
0
        public HttpResponseMessage GetById(int id)
        {
            var response = PersonBL.GetById(id);

            return(Request.CreateResponse(response.StatusCode, response));
        }