public void CreateTitleCreatesTitle()
        {
            //arrange

            var options = new DbContextOptionsBuilder <DatLib.Entities.ecgbhozpContext>()
                          .UseInMemoryDatabase("SearchUsersReturnsAllCustomers")
                          .Options;

            int    titleId     = 1;
            string titleString = "TitleString";
            int    creatorId   = 1;

            var titleLog = new LogLibMod.Title()
            {
                TitleId = titleId, TitleString = titleString, CreatorId = creatorId
            };

            using var actContext = new DatLib.Entities.ecgbhozpContext(options);

            var repo = new CreateQuizRepository(actContext);

            //act
            repo.CreateTitle(titleLog);
            repo.Save();

            using var assertContext = new DatLib.Entities.ecgbhozpContext(options);
            var title = assertContext.Title.FirstOrDefault();

            //assert

            Assert.Equal(expected: titleId + titleString + creatorId, actual: title.TitleId + title.TitleString + title.CreatorId);
        }
Пример #2
0
 //class to entity
 public static Entities.Title MapTitle(LogLib.Title title)
 {
     return(new Entities.Title
     {
         TitleId = title.TitleId,
         TitleString = title.TitleString,
         CreatorId = title.CreatorId
     });
 }