예제 #1
0
        public void GetTourTypes_ArrayReturned()
        {
            mock.Setup(m => m.TourTypes.GetAll()).Returns(types);
            var             mapper  = new MapperConfiguration(cfg => cfg.CreateMap <TourType, TourTypeDTO>()).CreateMapper();
            TourTypeService service = new TourTypeService(mock.Object);
            //ISerialize<TourTypeDTO> serialize = new TourTypeSerialize();

            IEnumerable <TourTypeDTO> example = (mapper.Map <IEnumerable <TourType>, List <TourTypeDTO> >(types));//serialize.serializeList

            IEnumerable <TourTypeDTO> data = service.GetTourTypes();

            Assert.AreEqual(data.Count(), example.Count());
        }
예제 #2
0
        public void GetTourTypeById_stringValueReturned()
        {
            var mock = new Mock <IUnitOfWork>();

            mock.Setup(m => m.TourTypes.Get(1)).Returns(types.ElementAt(0));
            var             mapper  = new MapperConfiguration(cfg => cfg.CreateMap <TourType, TourTypeDTO>()).CreateMapper();
            TourTypeService country = new TourTypeService(mock.Object);

            //ISerialize<TourTypeDTO> serialize = new TourTypeSerialize();
            TourTypeDTO example = (mapper.Map <TourType, TourTypeDTO>(types.ElementAt(0)));//serialize.serializeVary

            TourTypeDTO data = country.GetTourType(1);

            Assert.IsNotNull(data);
        }