Beispiel #1
0
        //ListAllFeedbacksForModeratorAsync_Should
        public static void GetContextWithFeedbackIdAndBusinessAndModerator(string DbName, int feedbackId, string moderatorId, int businessId)
        {
            var options = GetOptions(DbName);

            var context  = new AlphaHotelDbContext(options);
            var feedback = new Feedback()
            {
                Id         = feedbackId,
                BusinessId = businessId
            };

            var moderator = new User()
            {
                Id         = moderatorId,
                BusinessId = businessId
            };

            var business = new Business()
            {
                Id = businessId
            };

            context.Feedbacks.Add(feedback);
            context.Users.Add(moderator);
            context.Businesses.Add(business);
            context.SaveChanges();
        }
        //ChangeStatusOfLogAsync_Should
        public static void GetContextWithLogAndStatuses(string DbName, int logId, int statusId, int statusId2)
        {
            var options = GetOptions(DbName);

            var context = new AlphaHotelDbContext(options);

            var status = new Status()
            {
                Id = statusId
            };
            var status2 = new Status()
            {
                Id = statusId2
            };
            var log = new Log
            {
                Id       = logId,
                StatusId = status.Id
            };

            context.Logs.Add(log);
            context.Statuses.Add(status);
            context.Statuses.Add(status2);
            context.SaveChanges();
        }
        //GetLogBooksAndCategories_Should
        public static void GetContextWithUserAndLogBookAndCategory(string DbName, string userId)
        {
            var options = GetOptions(DbName);

            var context       = new AlphaHotelDbContext(options);
            var usersLogBooks = new List <UsersLogbooks>()
            {
                new UsersLogbooks {
                    UserId = userId, LogBookId = 1
                }
            };
            var category = new Category()
            {
                Id = 1
            };
            var logbook = new LogBook()
            {
                Id = 1,
                ManagersLogbooks = usersLogBooks
            };
            var user = new User()
            {
                Id = userId
            };

            context.Users.Add(user);
            context.Categories.Add(category);
            context.LogBooks.Add(logbook);
            context.SaveChanges();
        }
        //FindLog_Should
        public static void GetContextWithLogAndAuthorAndStatusAndCategory(string DbName, int logId, string description)
        {
            var options = GetOptions(DbName);

            var context = new AlphaHotelDbContext(options);
            var user    = new User()
            {
                Id = "user"
            };
            var status = new Status()
            {
                Id = 1
            };
            var category = new Category()
            {
                Id = 1
            };
            var log = new Log()
            {
                Id          = logId,
                Description = description,
                Author      = user,
                Category    = category,
                Status      = status
            };

            context.Logs.Add(log);
            context.Users.Add(user);
            context.Statuses.Add(status);
            context.Categories.Add(category);
            context.SaveChanges();
        }
Beispiel #5
0
        //CheckIfUserIsAllowedToSeeLogAsync_Should
        public static void GetContextWithUserLogBooksAndUserAndLogBook(string DbName, string userId, string username, int logbookId)
        {
            var options = GetOptions(DbName);

            var context = new AlphaHotelDbContext(options);
            var user    = new User()
            {
                Id       = userId,
                UserName = username,
            };

            var logbook = new LogBook()
            {
                Id = logbookId
            };

            var usersLogbooks = new UsersLogbooks()
            {
                User    = user,
                LogBook = logbook
            };

            context.Users.Add(user);
            context.LogBooks.Add(logbook);
            context.UsersLogbooks.Add(usersLogbooks);
            context.SaveChanges();
        }
Beispiel #6
0
        //ListAllUsersAsync_Should
        public static void GetContextWithUser(string DbName, string userId)
        {
            var options = GetOptions(DbName);

            var context = new AlphaHotelDbContext(options);
            var user    = new User()
            {
                Id = userId
            };

            context.Users.Add(user);
            context.SaveChanges();
        }
Beispiel #7
0
        public static void GetContextWithFacilities(string DbName, int facilityId)
        {
            var options = GetOptions(DbName);

            var context  = new AlphaHotelDbContext(options);
            var facility = new Facility()
            {
                Id = facilityId
            };

            context.Facilities.Add(facility);
            context.SaveChanges();
        }
        //AddLog_Should
        public static void GetContextWithLogBook(string DbName, int logbookId)
        {
            var options = GetOptions(DbName);

            var context = new AlphaHotelDbContext(options);
            var logbook = new LogBook()
            {
                Id = logbookId
            };

            context.LogBooks.Add(logbook);
            context.SaveChanges();
        }
Beispiel #9
0
        //FindFeedback_Should
        public static void GetContextWithFeedbackId(string DbName, int id)
        {
            var options = GetOptions(DbName);

            var context  = new AlphaHotelDbContext(options);
            var feedback = new Feedback()
            {
                Id = id
            };

            context.Feedbacks.Add(feedback);
            context.SaveChanges();
        }
Beispiel #10
0
        //AddCategory_Should
        public static void GetContextWithCategory(string DbName, string categoryName)
        {
            var options = GetOptions(DbName);

            var context  = new AlphaHotelDbContext(options);
            var category = new Category()
            {
                Name = categoryName
            };

            context.Categories.Add(category);
            context.SaveChanges();
        }
        //FindLog_Should
        public static void GetContextWithLog(string DbName, int logId, string description)
        {
            var options = GetOptions(DbName);

            var context = new AlphaHotelDbContext(options);
            var log     = new Log()
            {
                Id          = logId,
                Description = description
            };

            context.Logs.Add(log);
            context.SaveChanges();
        }
        //CreateBusiness_Should
        public static void GetContextWithBusiness(string DbName, int businessId, string businessName)
        {
            var options = GetOptions(DbName);

            var context = new AlphaHotelDbContext(options);

            var business = new Business()
            {
                Id   = businessId,
                Name = businessName
            };

            context.Businesses.Add(business);
            context.SaveChanges();
        }
Beispiel #13
0
        //EditAccountAsync_Should
        public static void GetContextWithFullUser(string DbName, string userId, string username, string email, bool isDeleted = false)
        {
            var options = GetOptions(DbName);

            var context = new AlphaHotelDbContext(options);
            var user    = new User()
            {
                Id        = userId,
                UserName  = username,
                Email     = email,
                IsDeleted = isDeleted
            };

            context.Users.Add(user);
            context.SaveChanges();
        }
        //AddLog_Should
        public static void GetContextWithFullLogAndLogBookAndUserAndStatusAndCategory(string DbName, int logbookId, string userId, int categoryId, string description, string username, int statusId, string statusType, string categoryName, bool isDeleted = false)
        {
            var options = GetOptions(DbName);

            var context  = new AlphaHotelDbContext(options);
            var category = new Category()
            {
                Id   = categoryId,
                Name = categoryName
            };
            var status = new Status()
            {
                Id   = statusId,
                Type = statusType
            };
            var user = new User()
            {
                Id       = userId,
                UserName = username
            };
            //var log = new Log
            //{
            //    LogBookId = logbookId,
            //    AuthorId = userId,
            //    CategoryId = categoryId,
            //    Description = description,
            //    IsDeleted = isDeleted,
            //    StatusId = statusId
            //};
            var logbook = new LogBook()
            {
                Id = logbookId
            };

            //context.Logs.Add(log);
            context.Users.Add(user);
            context.Statuses.Add(status);
            context.Categories.Add(category);
            context.LogBooks.Add(logbook);
            context.SaveChanges();
        }
        //ListTopNBusinessAsync_Should, FindDetailedBusinessAsync_Should
        public static void GetContextWithBusinessAndFeedback(string DbName, int businessId, int feedbackRating)
        {
            var options = GetOptions(DbName);

            var context = new AlphaHotelDbContext(options);

            var feedback = new Feedback()
            {
                BusinessId = businessId,
                Rate       = feedbackRating
            };

            var business = new Business()
            {
                Id = businessId,
            };

            context.Businesses.Add(business);
            context.Feedbacks.Add(feedback);
            context.SaveChanges();
        }
Beispiel #16
0
        //ListAllFeedbacksForUserAsync_Should
        public static void GetContextWithFeedbackIdAndBusiness(string DbName, int feedbackId, int businessId, bool isDeleted = false)
        {
            var options = GetOptions(DbName);

            var context  = new AlphaHotelDbContext(options);
            var feedback = new Feedback()
            {
                Id         = feedbackId,
                BusinessId = businessId,
                IsDeleted  = isDeleted
            };

            var business = new Business()
            {
                Id = businessId
            };

            context.Feedbacks.Add(feedback);
            context.Businesses.Add(business);
            context.SaveChanges();
        }
        //AddLogBookToBusinessAsync_Should, ListBusinessLogbooksAsync_ReturnLogBooks
        public static void GetContextWithBusinessAndLogBook(string DbName, int businessId, string logbookName)
        {
            var options = GetOptions(DbName);

            var context = new AlphaHotelDbContext(options);

            var logbook = new LogBook()
            {
                BusinessId = businessId,
                Name       = logbookName
            };

            var business = new Business()
            {
                Id = businessId,
            };

            context.Businesses.Add(business);
            context.LogBooks.Add(logbook);
            context.SaveChanges();
        }
Beispiel #18
0
        //AddFeedbackAsync_Should
        public static void GetContextWithFullFeedbackAndAnonymousAuthor(string DbName, string feedbackText, int rating, string author, int businessId)
        {
            var options = GetOptions(DbName);

            var context  = new AlphaHotelDbContext(options);
            var business = new Business()
            {
                Id = businessId
            };

            var feedback = new Feedback()
            {
                BusinessId = businessId,
                Author     = "Anonymous",
                Rate       = rating,
                Text       = feedbackText,
                IsDeleted  = false
            };

            context.Feedbacks.Add(feedback);
            context.Businesses.Add(business);
            context.SaveChanges();
        }
        public static void GetContextWithLogs(string DbName, int businessId, DateTime date)
        {
            var options = GetOptions(DbName);

            var context = new AlphaHotelDbContext(options);

            var logbook = new LogBook
            {
                BusinessId = businessId
            };

            var log = new Log()
            {
                LogBook   = logbook,
                CreatedOn = date,
                IsDeleted = false
            };

            var secondLog = new Log()
            {
                LogBook   = logbook,
                CreatedOn = date,
                IsDeleted = false
            };

            var thirdLog = new Log()
            {
                LogBook   = logbook,
                CreatedOn = new DateTime(2017, 1, 1),
                IsDeleted = false
            };

            context.Logs.Add(log);
            context.Logs.Add(secondLog);
            context.SaveChanges();
        }