Пример #1
0
        public void InsetContentPlace_Test()
        {
            ContentPlace contentPlace = CreateContentPlace();

            ContentPlaceRepository repository = new ContentPlaceRepository(BaseTest.ServerMapPath);

            repository.Insert(contentPlace);

            Assert.AreNotEqual(Guid.Empty, contentPlace.Id, "The object ContentPlace was not created in the repository");

            string filePathPage = string.Concat(BaseTest.StorageXmlPath, string.Format("ContentPlace_{0}.xml", contentPlace.Id));

            Assert.IsTrue(System.IO.File.Exists(filePathPage), "The file xml page was not created");

            XDocument xDocument = XDocument.Load(filePathPage);

            Assert.IsTrue(xDocument.Root.Element("ContentPlace").Attribute("Id") != null, "There is no attribute Id");
            Assert.IsTrue(xDocument.Root.Element("ContentPlace").Attribute("Published") != null, "There is no attribute Published");
            Assert.IsTrue(xDocument.Root.Element("ContentPlace").Attribute("DateCreated") != null, "There is no attribute DateCreated");
            Assert.IsTrue(xDocument.Root.Element("ContentPlace").Attribute("Type") != null, "There is no attribute Type");
            Assert.IsTrue(xDocument.Root.Element("ContentPlace").Attribute("Code") != null, "There is no element Code");

            Assert.IsTrue(xDocument.Root.Element("ContentPlace").Element("Title") != null, "There is no element Title");
            Assert.IsTrue(xDocument.Root.Element("ContentPlace").Element("Content") != null, "There is no element Content");
        }
Пример #2
0
        public void GetContentPlace_Test()
        {
            ContentPlaceRepository repository = new ContentPlaceRepository(BaseTest.ServerMapPathFacked);

            ContentPlace contentPlace = repository.Get(Guid.Parse("ba7542bf-0a41-417b-a684-e0843151dfb4"));

            Assert.IsNotNull(contentPlace);
        }
Пример #3
0
        private ContentPlace CreateContentPlace()
        {
            ContentPlace contentPlace = new ContentPlace();

            contentPlace.Code    = "ContentTest";
            contentPlace.Content = "This is the <b> content of content place </b>";
            contentPlace.Title   = "This is a title";
            contentPlace.Type    = "Agenda";

            return(contentPlace);
        }
 public override void Print(ContentPlace contentPlace, Info toPresent)
 {
     var(x, y, width, _) = contentPlace;
     Console.SetCursorPosition(x, y);
     if (toPresent is null)
     {
         Console.Write(new string(' ', width));
         return;
     }
     var nameWidth = width - 14;
     var name      = toPresent.Name.Length < nameWidth
         ? toPresent.Name + new string(' ', nameWidth - toPresent.Name.Length)
         : toPresent.Name[..nameWidth];
Пример #5
0
        public void EditContentPlace_Test()
        {
            ContentPlace contentPlace = this.CreateContentPlace();

            contentPlace.Id = Guid.Parse("ba7542bf-0a41-417b-a684-e0843151dfb4");

            contentPlace.DateCreated = DateTime.Now;

            ContentPlaceRepository repositoy = new ContentPlaceRepository(BaseTest.ServerMapPathFacked);

            repositoy.Update(contentPlace);

            XDocument xContentPlaceUpdated = XDocument.Load(string.Concat(BaseTest.ServerMapPathFacked, "App_Data\\", "ContentPlace_", contentPlace.Id, ".xml"));

            Assert.IsNotNull(xContentPlaceUpdated, "Document does not exist");

            DateTime dateUpdateFomDocument = DateTime.Parse(xContentPlaceUpdated.Root.Element("ContentPlace").Attribute("DateCreated").Value);

            Assert.IsTrue(dateUpdateFomDocument.Equals(contentPlace.DateCreated), "DateCreated does not upadated");
        }
Пример #6
0
 public abstract void Print(ContentPlace contentPlace, T toPresent);