コード例 #1
0
        /// <summary>
        /// Ustawia przykładowych użytkowników
        /// </summary>
        private void Load()
        {
            List <User> users = new List <User>();
            User        u     = new User()
            {
                Username       = "******",
                HashedPassword = @"/TmCAkG+Rl0kJd+GvhgbVYghlOY3RXPFcRXLpx69sPk=",
                Salt           = @"jQcO9f74p4sySJrXISk2XBw689JAPAic"
            };
            User u2 = new User()
            {
                Username       = "******",
                HashedPassword = @"PIks6KBVlB0pE5DvlSmKpxKCs5tN9EDebq6s8bqb4HA=",
                Salt           = @"zapt0VgkYldvUEc7K3TJ5S0aRLDavxmN"
            };
            UserData ud = new UserData()
            {
                Email       = "*****@*****.**",
                FirstName   = "Mateusz",
                LastName    = "Bąkała",
                CompanyName = "",
            };
            UserData ud2 = new UserData()
            {
                Email       = "*****@*****.**",
                FirstName   = "Mateusz",
                LastName    = "Jabłoński",
                CompanyName = ""
            };
            Address a = new Address()
            {
                City        = "Gołąb",
                PostalCode  = "24-100",
                Street      = "Piaskowa",
                LocalNumber = "20"
            };
            Address a2 = new Address()
            {
                City        = "Piotrków Trybunalski",
                Street      = "",
                LocalNumber = "",
                PostalCode  = ""
            };

            ud.Address  = a;
            ud2.Address = a2;
            u.UserData  = ud;
            u2.UserData = ud2;
            users.Add(u);
            users.Add(u2);
            User admin = new User()
            {
                Username       = "******",
                HashedPassword = @"HEsEsPd3IWOfCLXgPHXL4dA4zDPjOj/0Tltk5WOJ68A=",
                Salt           = @"MpneiNAMrJyPySqkJqpnB/qNib5FrMa7"
            };
            UserData adminData = new UserData()
            {
                FirstName   = "Jarosław",
                LastName    = "Taboret",
                CompanyName = "Hotel SPA & Wellness",
                Email       = @"*****@*****.**"
            };
            Address add = new Address()
            {
                City        = "Krajzegów",
                Street      = "Kropelkowa",
                LocalNumber = "12a",
                PostalCode  = "12-345",
            };

            adminData.Address = add;
            admin.UserData    = adminData;
            users.Add(admin);
            _users = new MockDbSet <User>(users);
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new AccommodationMockContext object and fills it with example data.
        /// </summary>
        public AccommodationMockContext()
        {
            List <User> users = new List <User>()
            {
                new User()
                {
                    Id             = 1,
                    Username       = "******",
                    HashedPassword = @"/TmCAkG+Rl0kJd+GvhgbVYghlOY3RXPFcRXLpx69sPk=",
                    Salt           = @"jQcO9f74p4sySJrXISk2XBw689JAPAic"
                },
                new User()
                {
                    Id             = 2,
                    Username       = "******",
                    HashedPassword = @"PIks6KBVlB0pE5DvlSmKpxKCs5tN9EDebq6s8bqb4HA=",
                    Salt           = @"zapt0VgkYldvUEc7K3TJ5S0aRLDavxmN"
                },
                new User()
                {
                    Id             = 3,
                    Username       = "******",
                    HashedPassword = @"PIks6KBVlB0pE5DvlSmKpxKCs5tN9EDebq6s8bqb4HA=",
                    Salt           = @"zapt0VgkYldvUEc7K3TJ5S0aRLDavxmN"
                }
            };
            List <UserData> userData = new List <UserData>()
            {
                new UserData()
                {
                    Id        = 1,
                    Email     = "*****@*****.**",
                    FirstName = "Mateusz",
                    LastName  = "Bąkała"
                },
                new UserData()
                {
                    Id        = 2,
                    Email     = "*****@*****.**",
                    FirstName = "Mateusz",
                    LastName  = "Jabłoński"
                }
            };

            users[0].UserDataId = 1;
            users[1].UserDataId = 2;
            users[0].UserData   = userData[0];
            users[1].UserData   = userData[1];

            List <Address> addresses = new List <Address>()
            {
                new Address()
                {
                    City        = "Warszawa",
                    Id          = 1,
                    PostalCode  = "11-111",
                    LocalNumber = "12a",
                    Street      = "Puławska"
                }
            };
            List <Place> places = new List <Place>()
            {
                new Place()
                {
                    PlaceName = "Pensjonat pod różą", Id = 1, Address = addresses[0], AddressId = addresses[0].Id
                }
            };

            List <Room> rooms = new List <Room>()
            {
                new Room()
                {
                    Id = 1, Place = places[0], Capacity = 2, Number = "101", PlaceId = 1
                },
                new Room()
                {
                    Id = 2, Place = places[0], PlaceId = places[0].Id, Capacity = 3, Number = "102"
                }
            };

            List <OfferInfo> offerInfos = new List <OfferInfo>()
            {
                new OfferInfo()
                {
                    Id               = 1,
                    OfferStartTime   = new DateTime(2015, 12, 20),
                    OfferEndTime     = new DateTime(2015, 12, 23),
                    OfferPublishTime = new DateTime(2015, 12, 13),
                    Price            = 400,
                },
                new OfferInfo()
                {
                    Id               = 2,
                    OfferStartTime   = new DateTime(2015, 12, 20),
                    OfferEndTime     = new DateTime(2015, 12, 23),
                    OfferPublishTime = new DateTime(2015, 12, 13),
                    Price            = 300,
                },
                new OfferInfo()
                {
                    Id               = 3,
                    OfferStartTime   = new DateTime(2015, 12, 26),
                    OfferEndTime     = new DateTime(2015, 12, 30),
                    OfferPublishTime = new DateTime(2015, 12, 13),
                    Price            = 500,
                }
            };

            List <Offer> offers = new List <Offer>()
            {
                new Offer()
                {
                    Vendor      = users[1],
                    VendorId    = 2,
                    Id          = 1,
                    Room        = rooms[0],
                    RoomId      = rooms[0].Id,
                    OfferInfo   = offerInfos[0],
                    OfferInfoId = 1,
                    IsBooked    = false
                },
                new Offer()
                {
                    Vendor      = users[0],
                    VendorId    = 1,
                    Id          = 2,
                    Room        = rooms[1],
                    RoomId      = rooms[1].Id,
                    OfferInfo   = offerInfos[1],
                    OfferInfoId = 2,
                    IsBooked    = false
                },
                new Offer()
                {
                    Vendor      = users[1],
                    VendorId    = 2,
                    Id          = 3,
                    Room        = rooms[1],
                    RoomId      = rooms[1].Id,
                    OfferInfo   = offerInfos[2],
                    OfferInfoId = 3,
                    IsBooked    = true,
                    CustomerId  = 2
                },
                new Offer()
                {
                    Vendor      = users[0],
                    VendorId    = 1,
                    Id          = 4,
                    Room        = rooms[0],
                    RoomId      = rooms[0].Id,
                    OfferInfo   = offerInfos[0],
                    OfferInfoId = 1,
                    IsBooked    = false
                }
            };
            List <HistoricalOffer> historical = new List <HistoricalOffer>()
            {
                new HistoricalOffer()
                {
                    Vendor          = users[0],
                    VendorId        = 1,
                    Id              = 1,
                    Room            = rooms[0],
                    RoomId          = rooms[0].Id,
                    OfferInfo       = offerInfos[0],
                    OfferInfoId     = 1,
                    OriginalOffer   = offers[0],
                    OriginalOfferId = 1
                },
                new HistoricalOffer()
                {
                    Vendor          = users[0],
                    VendorId        = 1,
                    Id              = 2,
                    Room            = rooms[1],
                    RoomId          = rooms[1].Id,
                    OfferInfo       = offerInfos[1],
                    OfferInfoId     = 2,
                    OriginalOffer   = offers[1],
                    OriginalOfferId = 2
                },
                new HistoricalOffer()
                {
                    Vendor          = users[1],
                    VendorId        = 2,
                    Id              = 3,
                    Room            = rooms[1],
                    RoomId          = rooms[1].Id,
                    OfferInfo       = offerInfos[2],
                    OfferInfoId     = 3,
                    OriginalOffer   = offers[2],
                    OriginalOfferId = 3
                }
            };
            List <Rank> ranks = new List <Rank>()
            {
                new Rank()
                {
                    Name = "Nowicjusz"
                },
                new Rank()
                {
                    Name = "Junior"
                },
                new Rank()
                {
                    Name = "Znawca"
                },
                new Rank()
                {
                    Name = "Mistrz"
                },
                new Rank()
                {
                    Name = "Guru"
                }
            };

            users[0].Rank     = ranks[0];
            users[1].Rank     = ranks[0];
            _users            = new MockDbSet <User>(users);
            _offerInfo        = new MockDbSet <OfferInfo>(offerInfos);
            _addreses         = new MockDbSet <Address>(addresses);
            _userData         = new MockDbSet <UserData>(userData);
            _offers           = new MockDbSet <Offer>(offers);
            _historicalOffers = new MockDbSet <HistoricalOffer>(historical);
            _ranks            = new MockDbSet <Rank>(ranks);
            _rooms            = new MockDbSet <Room>(rooms);
            _places           = new MockDbSet <Place>(places);
        }