Пример #1
0
 public void Initialize()
 {
     db = new Database(new MockDatabaseContext());
     db.CreateUser(new User(true, "Ari1", "Ari Arasson", 1994, Gender.MALE, "*****@*****.**"));
     db.CreateUser(new User(true, "Ari2", "Ari Arasson", 1994, Gender.MALE, "*****@*****.**"));
     db.CreateUser(new User(true, "Ari3", "Ari Arasson", 1994, Gender.MALE, "*****@*****.**"));
     db.CreateUser(new User(true, "Ari4", "Ari Arasson", 1994, Gender.MALE, "*****@*****.**"));
     db.CreateUser(new User(true, "Ari5", "Ari Arasson", 1994, Gender.MALE, "*****@*****.**"));
     db.CreateUser(new User(true, "Ari6", "Ari Arasson", 1994, Gender.MALE, "*****@*****.**"));
 }
Пример #2
0
        public void Initialize()
        {
            MockDb mock = new MockDb();

            #region Users
            User user1 = new User
            {
                UserID = 1,
                Active = true,
                UserName = "******",
                DisplayName = "xXx$w4gM4$t3r420xXx",
                BirthYear = 9000,
                Gender = Gender.MALE,
                Email = "[email protected]"
            };
            User user2 = new User
            {
                UserID = 2,
                Active = true,
                UserName = "******",
                DisplayName = "Sultumenni500",
                BirthYear = 1337,
                Gender = Gender.MALE,
                Email = "*****@*****.**"
            };
            User user3 = new User
            {
                UserID = 3,
                Active = true,
                UserName = "******",
                DisplayName = "Pulsmeister99",
                BirthYear = 9000,
                Gender = Gender.FEMALE,
                Email = "*****@*****.**"
            };
            mock.UserList.Add(user1);
            mock.UserList.Add(user2);
            mock.UserList.Add(user3);
            #endregion
            #region Groups

            Group group1 = new Group
            {
                GroupID = 1,
                Active = true,
                OwnerId = 1,
                Name = "Team Gulli"
            };
            Group group2 = new Group
            {
                GroupID = 2,
                Active = true,
                OwnerId = 3,
                Name = "Pulsuvagninn"
            };
            mock.Groups.Add(group1);
            mock.Groups.Add(group2);
            #endregion
            #region Events
            Event event1 = new Event
            {
                EventID = 1,
                Active = true,
                GroupId = null,
                OwnerId = 1,
                Name = "Lan",
                Photo = "",
                Description = "Quake 4 lyfe",
                CreationTime = new DateTime(2015, 5, 6, 12, 30, 1),
                TimeOfEvent = new DateTime(2015, 5, 9, 12, 30, 0),
                Minutes = 60,
                Location = "the internet",
                Min = 0,
                Max = 5,
            };

            Event event2 = new Event
            {
                EventID = 2,
                Active = true,
                GroupId = 2,
                OwnerId = 3,
                Name = "Pulsuparty",
                Photo = "",
                Description = "pulsulíf",
                CreationTime = new DateTime(2015, 5, 6, 12, 30, 1),
                TimeOfEvent = new DateTime(2015, 5, 9, 12, 30, 0),
                Minutes = 60,
                Location = "bæjarins bestu",
                Min = 0,
                Max = 5,
            };
            mock.Events.Add(event1);
            mock.Events.Add(event2);

            #endregion
            #region Comments
            Comment comment1 = new Comment
            {
                CommentID = 1,
                Active = true,
                OwnerId = 2,
                Content = "FOKK PULSUR, SULTA IS SUPERIOR",
                CreationTime = new DateTime(2015, 5, 6, 12, 35, 1)
            };
            mock.Comments.Add(comment1);

            #endregion
            #region GroupToUserRelations
            GroupToUserRelation groupUser1 = new GroupToUserRelation
            {
                GroupToUserRelationID = 1,
                Active = true,
                GroupId = 1,
                MemberId = 1
            };

            GroupToUserRelation groupUser2 = new GroupToUserRelation
            {
                GroupToUserRelationID = 2,
                Active = true,
                GroupId = 2,
                MemberId = 3
            };

            GroupToUserRelation groupUser3 = new GroupToUserRelation
            {
                GroupToUserRelationID = 3,
                Active = true,
                GroupId = 2,
                MemberId = 2
            };

            GroupToUserRelation groupUser4 = new GroupToUserRelation
            {
                GroupToUserRelationID = 4,
                Active = true,
                GroupId = 1,
                MemberId = 2
            };
            mock.GroupToUserRelations.Add(groupUser1);
            mock.GroupToUserRelations.Add(groupUser2);
            mock.GroupToUserRelations.Add(groupUser3);
            mock.GroupToUserRelations.Add(groupUser4);

            #endregion
            #region GroupsToEventRelations
            GroupToEventRelation groupEvent1 = new GroupToEventRelation
            {
                GroupToEventRelationID = 1,
                Active = true,
                EventId = 2,
                GroupId = 2
            };
            mock.GroupToEventRelations.Add(groupEvent1);

            #endregion
            #region UserToUserRelations

            UserToUserRelation friendship1 = new UserToUserRelation
            {
                UserToUserRelationID = 1,
                Active = true,
                SenderId = 2,
                ReceiverId = 3,
                Answer = true
            };

            UserToUserRelation friendship2 = new UserToUserRelation
            {
                UserToUserRelationID = 2,
                Active = true,
                SenderId = 1,
                ReceiverId = 2,
                Answer = true
            };

            mock.UserToUserRelations.Add(friendship1);
            mock.UserToUserRelations.Add(friendship2);

            #endregion
            #region EventToUserRelations

            EventToUserRelation eventUser1 = new EventToUserRelation
            {
                EventToUserRelationID = 1,
                Active = true,
                EventId = 1,
                AttendeeId = 1,
                Answer = true
            };

            EventToUserRelation eventUser2 = new EventToUserRelation
            {
                EventToUserRelationID = 2,
                Active = true,
                EventId = 1,
                AttendeeId = 2,
                Answer = null
            };

            EventToUserRelation eventUser3 = new EventToUserRelation
            {
                EventToUserRelationID = 3,
                Active = true,
                EventId = 2,
                AttendeeId = 3,
                Answer = true
            };

            EventToUserRelation eventUser4 = new EventToUserRelation
            {
                EventToUserRelationID = 4,
                Active = true,
                EventId = 2,
                AttendeeId = 2,
                Answer = false
            };

            mock.EventToUserRelations.Add(eventUser1);
            mock.EventToUserRelations.Add(eventUser2);
            mock.EventToUserRelations.Add(eventUser3);
            mock.EventToUserRelations.Add(eventUser4);

            #endregion
            #region EventToCommentRelations

            EventToCommentRelation eventComment1 = new EventToCommentRelation
            {
                EventToCommentRelationID = 1,
                EventId = 2,
                CommentId = 1,
                Active = true

            };

            mock.EventToCommentRelations.Add(eventComment1);
            #endregion

            DbTest = new Database(mock);
            ServiceTest = new Service(DbTest);
        }
Пример #3
0
 public Service(Database setDatabase = null)
 {
     database = setDatabase ?? new Database(null);
 }
Пример #4
0
        public void Initialize()
        {
            MockDb mock = new MockDb();

            #region Records
            #region User
            mock.UserList.Add(new User(true, "Hrafn", "Hrafn Orri Hrafnkelsson", 1994, Gender.MALE, "*****@*****.**", 1));
            mock.UserList.Add(new User(true, "Gudni", "Gudni Fannar Kristjánsson", 1994, Gender.MALE, "*****@*****.**", 2));
            mock.UserList.Add(new User(false, "Kristinn", "Kristinn Þorri Þrastarsson", 1989, Gender.MALE, "*****@*****.**", 3));
            mock.UserList.Add(new User(true, "Helgi", "Helgi Rúnar Einarsson", 1989, Gender.MALE, "*****@*****.**", 4));
            mock.UserList.Add(new User(true, "Fanney", "Fanney Sigurðardóttir", 1985, Gender.FEMALE, "*****@*****.**", 5));
            #endregion
            #region Group
            mock.Groups.Add(new Group(true, 1, "Lan Group", 1));
            mock.Groups.Add(new Group(true, 1, "MVC Project", 2));
            mock.Groups.Add(new Group(true, 2, "Bobby Tables", 3));
            mock.Groups.Add(new Group(false, 1, "HearthStone For Live", 4));
            mock.Groups.Add(new Group(true, 2, "Runescape fanatics", 5));
            mock.Groups.Add(new Group(true, 3, "Ghost in the machine", 6));
            mock.Groups.Add(new Group(false, 3, "Ghost birthdays", 7));
            mock.Groups.Add(new Group(false, 4, "Sports for live", 8));
            #endregion
            #region Event
            mock.Events.Add(new Event(true, null, 5, "Sund", "Non", "FAra í sund og fá okkur ís", new DateTime(), new DateTime(), 30, "Kópavogi", 1, 2, 1));
            mock.Events.Add(new Event(true, 8, 3, "Fotbolti", "Non1", "Taka smá fótbolta með Braga", new DateTime(), new DateTime(), 30, "Garðabæ", 1, 2, 2));
            mock.Events.Add(new Event(true, 1, 1, "Lan", "Non2", "Taka nokkra aom heima hjá hrafni", new DateTime(), new DateTime(), 30, "Kópavogi", 1, 2, 3));
            mock.Events.Add(new Event(true, 1, 2, "RuneScape", "Non3", "Mine some ores", new DateTime(), new DateTime(), 30, "Akureyri", 1, 2, 4));
            mock.Events.Add(new Event(true, 1, 2, "League Of Legends", "Non4", "Taka ap darius", new DateTime(), new DateTime(), 30, "Kópavogi", 1, 2, 5));
            mock.Events.Add(new Event(false, 1, 1, "HearthStone", "Non5", "Spila smá aggro warrior", new DateTime(), new DateTime(), 30, "Kópavogi", 1, 2, 6));
            mock.Events.Add(new Event(true, 1, 5, "Heroes of the storm", "Non6", "Feed Lili", new DateTime(), new DateTime(), 30, "Hafnafyrði", 1, 2, 7));
            mock.Events.Add(new Event(true, 8, 4, "Korfubolti", "Non7", "Shoot some hoops", new DateTime(), new DateTime(), 30, "Kópavogi", 1, 2, 8));
            mock.Events.Add(new Event(false, 8, 4, "Golf", "Non8", "Spila 18 holur", new DateTime(), new DateTime(), 30, "Garðabæ", 1, 2, 9));
            mock.Events.Add(new Event(true, 2, 3, "Database", "Non9", "Halda áfram með databasið", new DateTime(), new DateTime(), 30, "Kópavogi", 1, 2, 10));
            #endregion
            #region Comment
            mock.Comments.Add(new Comment(true, 1, "First1", new DateTime(1,1,1), 1));
            mock.Comments.Add(new Comment(true, 1, "First2", new DateTime(1,1,1), 2));
            mock.Comments.Add(new Comment(true, 1, "First3", new DateTime(1,1,1), 3));
            mock.Comments.Add(new Comment(false, 2, "Second", new DateTime(2, 2, 2), 4));
            #endregion
            #endregion
            #region Relations
            #region UserToUser
            mock.UserToUserRelations.Add(new UserToUserRelation(true, 1, 2, true, 1));
            mock.UserToUserRelations.Add(new UserToUserRelation(true, 1, 3, true, 2));
            mock.UserToUserRelations.Add(new UserToUserRelation(true, 1, 4, true, 3));
            mock.UserToUserRelations.Add(new UserToUserRelation(false, 1, 5, false, 4));
            mock.UserToUserRelations.Add(new UserToUserRelation(true, 1, 5, false, 4));
            mock.UserToUserRelations.Add(new UserToUserRelation(true, 2, 3, null, 5));
            #endregion
            #region GroupToUserRelation
            mock.GroupToUserRelations.Add(new GroupToUserRelation(true, 1, 1, 1));
            mock.GroupToUserRelations.Add(new GroupToUserRelation(true, 1, 2, 2));
            mock.GroupToUserRelations.Add(new GroupToUserRelation(true, 1, 5, 2));

            mock.GroupToUserRelations.Add(new GroupToUserRelation(true, 2, 1, 3));
            mock.GroupToUserRelations.Add(new GroupToUserRelation(true, 2, 2, 4));
            mock.GroupToUserRelations.Add(new GroupToUserRelation(true, 2, 3, 5));
            mock.GroupToUserRelations.Add(new GroupToUserRelation(true, 2, 4, 6));
            mock.GroupToUserRelations.Add(new GroupToUserRelation(true, 2, 5, 7));

            mock.GroupToUserRelations.Add(new GroupToUserRelation(true, 3, 1, 8));

            mock.GroupToUserRelations.Add(new GroupToUserRelation(false, 4, 1, 9));

            mock.GroupToUserRelations.Add(new GroupToUserRelation(true, 5, 2, 10));

            mock.GroupToUserRelations.Add(new GroupToUserRelation(true, 6, 3, 11));
            mock.GroupToUserRelations.Add(new GroupToUserRelation(true, 6, 1, 12));
            mock.GroupToUserRelations.Add(new GroupToUserRelation(true, 6, 2, 13));

            mock.GroupToUserRelations.Add(new GroupToUserRelation(false, 7, 2, 14));
            mock.GroupToUserRelations.Add(new GroupToUserRelation(false, 7, 2, 15));
            mock.GroupToUserRelations.Add(new GroupToUserRelation(true, 7, 2, 16));
            #endregion
            #region GroupToEventRelation
            mock.GroupToEventRelations.Add(new GroupToEventRelation(true, 8, 2, 1));
            mock.GroupToEventRelations.Add(new GroupToEventRelation(true, 1, 3, 2));
            mock.GroupToEventRelations.Add(new GroupToEventRelation(true, 1, 4, 3));
            mock.GroupToEventRelations.Add(new GroupToEventRelation(true, 1, 5, 4));
            mock.GroupToEventRelations.Add(new GroupToEventRelation(true, 1, 6, 5));
            mock.GroupToEventRelations.Add(new GroupToEventRelation(true, 1, 7, 6));
            mock.GroupToEventRelations.Add(new GroupToEventRelation(true, 8, 8, 7));
            mock.GroupToEventRelations.Add(new GroupToEventRelation(true, 8, 9, 8));
            mock.GroupToEventRelations.Add(new GroupToEventRelation(false, 2, 10, 1));
            mock.GroupToEventRelations.Add(new GroupToEventRelation(true, 2, 10, 9));
            mock.GroupToEventRelations.Add(new GroupToEventRelation(true, 0, 0, 1));
            mock.GroupToEventRelations.Add(new GroupToEventRelation(true, 1, 1, 1));
            mock.GroupToEventRelations.Add(new GroupToEventRelation(true, 88, 90, 1));
            mock.GroupToEventRelations.Add(new GroupToEventRelation(true, -1, 2, 1));
            #endregion
            #region EventToUserRelation
            mock.EventToUserRelations.Add(new EventToUserRelation(true, 3, 1, true, 1));
            mock.EventToUserRelations.Add(new EventToUserRelation(false, 4, 1, true, 2));
            mock.EventToUserRelations.Add(new EventToUserRelation(true, 4, 1, false, 3));
            mock.EventToUserRelations.Add(new EventToUserRelation(true, 6, 1, true, 4));
            mock.EventToUserRelations.Add(new EventToUserRelation(true, 5, 1, true, 5));

            mock.EventToUserRelations.Add(new EventToUserRelation(true, 1, 2, null, 1));
            mock.EventToUserRelations.Add(new EventToUserRelation(true, 3, 2, true, 1));
            mock.EventToUserRelations.Add(new EventToUserRelation(true, 4, 2, true, 1));
            mock.EventToUserRelations.Add(new EventToUserRelation(true, 5, 2, false, 1));
            mock.EventToUserRelations.Add(new EventToUserRelation(true, 7, 2, true, 1));
            #endregion
            #region EventToCommentRelation
            mock.EventToCommentRelations.Add(new EventToCommentRelation(false, 1, 2, 1));
            mock.EventToCommentRelations.Add(new EventToCommentRelation(true, 1, 2, 2));
            mock.EventToCommentRelations.Add(new EventToCommentRelation(true, 6, 1, 3));
            mock.EventToCommentRelations.Add(new EventToCommentRelation(true, 1, 2, 4));
            mock.EventToCommentRelations.Add(new EventToCommentRelation(true, 1, 2, 5));
            mock.EventToCommentRelations.Add(new EventToCommentRelation(false, 10, 1, 6));
            mock.EventToCommentRelations.Add(new EventToCommentRelation(false, 9, 3, 7));
            mock.EventToCommentRelations.Add(new EventToCommentRelation(false, 9, 4, 8));
            mock.EventToCommentRelations.Add(new EventToCommentRelation(false, 9, 5, 9));
            #endregion
            #endregion

            db = new Database(mock);
        }