public void MakeInfo(TourInfoDTO tourInfoDTO)//(TourInfoDTO tourInfoDTO) { // deserialize = new TourInfoDeserialize(); //TourInfoDTO tourInfoDTO = deserialize.deserializeVary(data); TourInfo info = new TourInfo { Info = tourInfoDTO.Info, }; Database.TourInfos.Create(info); Database.Save(); }
public void GetTourInfoById_stringValueReturned() { var mock = new Mock <IUnitOfWork>(); mock.Setup(m => m.TourInfos.Get(1)).Returns(info.ElementAt(0)); var mapper = new MapperConfiguration(cfg => cfg.CreateMap <TourInfo, TourInfoDTO>()).CreateMapper(); TourInfoService country = new TourInfoService(mock.Object); //ISerialize<TourInfoDTO> serialize = new TourInfoSerialize(); //string example = serialize.serializeVary(mapper.Map<TourInfo, TourInfoDTO>(info.ElementAt(0))); TourInfoDTO data = country.GetTourInfo(1); Assert.IsNotNull(data); }
public void MakeInfo_CapableReturned() { var mock = new Mock <IUnitOfWork>(); TourInfoDTO infoDTO = new TourInfoDTO() { Info = "Possible to deal" }; var mapper = new MapperConfiguration(cfg => cfg.CreateMap <TourInfoDTO, TourInfo>()).CreateMapper(); mock.Setup(m => m.TourInfos.GetAll()).Returns(info); TourInfoService service = new TourInfoService(mock.Object); service.MakeInfo((infoDTO));//JsonSerializer.Serialize var data = mapper.Map <TourInfoDTO, TourInfo>(infoDTO); info.Add(data); Assert.AreEqual(info.Count(), 5); }