public SlideDataModel UpdateSlideData([FromBody] SlideDataModel data, int presentationId, int id) { Slide s = null; Presentation p = null; SlideDataModel ret = null; if (data != null && presentationId > 0 && id > 0) { p = base.Service.Read(presentationId); if (p != null) { s = p.Slides.FirstOrDefault(candidate => candidate.Id == id); if (s != null) { if (string.IsNullOrEmpty(s.Title)) { s.Title = data.Title ?? string.Empty; } if (string.IsNullOrEmpty(s.Description)) { s.Description = data.Description ?? string.Empty; } s.Elements.Clear(); if (data.Elements != null && data.Elements.Length > 0) { foreach (Element e in data.Elements) { e.SlideId = s.Id; s.Elements.Add(e); } } base.Service.CreateOrUpdate(p); ret = new SlideDataModel() { Title = s.Title, Description = s.Description, Elements = s.Elements.ToArray() }; } } } return(ret); }
public void TextCountTest() { List <SlideDataModel> SlideDataModelList = new List <SlideDataModel>(); foreach (Slide slide in PPTObject.Slides) { SlideDataModel slideModel = new SlideDataModel(slide); slideModel.build(); SlideDataModelList.Add(slideModel); } Assert.AreEqual(5, SlideDataModelList[0].TotalTextCount); Assert.AreEqual(0, SlideDataModelList[1].TotalTextCount); }
public void RunAnalysisProcess() { List <SlideDataModel> SlideDataModelList = new List <SlideDataModel>(); Assert.AreEqual(0, PPTObject.Slides.Count); foreach (Slide slide in PPTObject.Slides) { try { SlideDataModel slideModel = new SlideDataModel(slide); slideModel.build(); SlideDataModelList.Add(slideModel); } catch { Assert.AreEqual(1, 2); } } Assert.AreEqual(0, SlideDataModelList.Count); }