public void GetUnseenRequestsShouldReturnListWithUnseenRequests()
        {
            var options = new DbContextOptionsBuilder <BookStoreDbContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString())
                          .Options;
            //

            var dbContext = new BookStoreDbContext(options);

            var userRequestService = new UserRequestsService(dbContext);

            var title   = "Question";
            var email   = "*****@*****.**";
            var content = "content";

            userRequestService.Create(title, email, content);
            userRequestService.Create(title + 1, email, content);

            userRequestService.Unseen(1);
            userRequestService.Unseen(2);

            var unSeenListOfRequest = userRequestService.GetUnseenRequests().ToList();

            Assert.True(unSeenListOfRequest != null);
            Assert.True(unSeenListOfRequest.Count == 2);
        }
        public void AllShouldReturnListWithRequestSaveInDB()
        {
            var options = new DbContextOptionsBuilder <BookStoreDbContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString())
                          .Options;
            //

            var dbContext = new BookStoreDbContext(options);

            var userRequestService = new UserRequestsService(dbContext);

            var title   = "Question";
            var email   = "*****@*****.**";
            var content = "content";

            userRequestService.Create(title, email, content);
            userRequestService.Create(title + 1, email, content);

            var isReurntallRequests = userRequestService.All().ToList();

            Assert.True(isReurntallRequests != null);
            Assert.True(isReurntallRequests.Count == 2);
        }
        public void CreateShoulCreteUserRequestAndSaveInDb()
        {
            var options = new DbContextOptionsBuilder <BookStoreDbContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString())
                          .Options;
            //

            var dbContext = new BookStoreDbContext(options);

            var userRequestService = new UserRequestsService(dbContext);

            var title   = "Question";
            var email   = "*****@*****.**";
            var content = "content";

            userRequestService.Create(title, email, content);

            var userRequestFronDb = dbContext.UserRequests.FirstOrDefault();

            Assert.True(userRequestFronDb != null);
            Assert.True(userRequestFronDb.Title == title);
            Assert.True(userRequestFronDb.Email == email);
            Assert.True(userRequestFronDb.Content == content);
        }
        public void CreateShouldCreateUserRequest()
        {
            var options = new DbContextOptionsBuilder <XeonDbContext>()
                          .UseInMemoryDatabase(databaseName: "Create_UserRequests_Database")
                          .Options;
            var dbContext = new XeonDbContext(options);

            var userRequestsService = new UserRequestsService(dbContext);

            var title   = "Question";
            var email   = "*****@*****.**";
            var content = "content";

            userRequestsService.Create(title, email, content);

            var userRequests = dbContext.UserRequests.ToList();

            Assert.Single(userRequests);
            Assert.Equal(title, userRequests.First().Title);
            Assert.Equal(email, userRequests.First().Email);
            Assert.Equal(content, userRequests.First().Content);
            Assert.Equal(DateTime.UtcNow.AddHours(GlobalConstants.BULGARIAN_HOURS_FROM_UTC_TIME).Hour,
                         userRequests.First().RequestDate.Hour);
        }