Exemplo n.º 1
0
        public void GetKvest_ObjectReturn()
        {
            mock.Setup(m => m.KvestRooms.GetAll()).Returns(rooms);
            mock.Setup(m => m.KvestRooms.Get(rooms.ElementAt(0).Id)).Returns(rooms.ElementAt(0));
            KvestRoomService service = new KvestRoomService(mock.Object);
            var mapper = new MapperConfiguration(cfg => cfg.CreateMap <KvestRoom, KvestRoomDTO>()).CreateMapper();

            KvestRoomDTO kvest = service.GetKvest(1);
            KvestRoomDTO ex    = mapper.Map <KvestRoom, KvestRoomDTO>(rooms.ElementAt(0));


            Assert.IsNotNull(kvest);
        }
Exemplo n.º 2
0
        public void GetKvest_ErrorReturn()
        {
            try
            {
                mock.Setup(m => m.KvestRooms.GetAll()).Returns(rooms);
                mock.Setup(m => m.KvestRooms.Get(rooms.ElementAt(0).Id)).Returns(rooms.ElementAt(0));
                KvestRoomService service = new KvestRoomService(mock.Object);
                var mapper = new MapperConfiguration(cfg => cfg.CreateMap <KvestRoom, KvestRoomDTO>()).CreateMapper();

                KvestRoomDTO kvest = service.GetKvest(77);
                //KvestRoomDTO ex = mapper.Map<KvestRoom, KvestRoomDTO>(rooms.ElementAt(0));

                Assert.Fail();
            }
            catch (ValidationException) { }
        }