public ActionResult OrderHistory()
        {
            var model  = new OrderHistoryViewModel();
            var person = personProvider.GetPerson(CurrentUserName);

            model.PersonId = person.Id;
            return(View(model));
        }
        public ActionResult Index()
        {
            var model  = new MyAccountViewModel();
            var person = personProvider.GetPerson(User.Identity.Name);

            model.PersonInfo = person;
            return(View(model));
        }
Beispiel #3
0
        public ActionResult Edit(int id)
        {
            var model  = new EditViewModel();
            var person = personProvider.GetPerson(id);

            AutoMapper.Mapper.DynamicMap(person, model);
            return(View(model));
        }
Beispiel #4
0
        public void GetPerson_WhenNotInitialized_ThrowsException()
        {
            //Given
            IPersonProvider provider = new PersonProvider(new PersonCreator(new BogusFabricator(), new InMemoryUserDataProvider()));

            //When
            Action action = () => provider.GetPerson();

            //Then
            Assert.Throws <PersonProviderNotInitializedException>(action);
        }
Beispiel #5
0
        public void GetPerson_WhenCalledUpToCountTimes_ReturnsDifferentPerson()
        {
            // Arrange
            List <string>   userIds   = new List <string>();
            IPersonProvider provider  = new PersonProvider(new PersonCreator(new BogusFabricator(), new InMemoryUserDataProvider()));
            const int       userCount = 4;

            provider.Initialize(userCount);

            // Act
            for (int i = 0; i < userCount; i++)
            {
                userIds.Add(provider.GetPerson().Email);
            }

            // Assert
            foreach (string userId in userIds)
            {
                int userIdCount = userIds.Count(u => u.Equals(userId));
                Assert.Equal(1, userIdCount);
            }
        }
Beispiel #6
0
        void GetPerson_WhenCalledMoreThanCountTimes_ReturnsSamePeople()
        {
            // Arrange
            List <string>   userIds   = new List <string>();
            IPersonProvider provider  = new PersonProvider(new PersonCreator(new BogusFabricator(), new InMemoryUserDataProvider()));
            const int       userCount = 4;

            provider.Initialize(userCount);
            const int requestSets  = 3;
            int       requestCount = requestSets * provider.Count;

            // Act
            for (int i = 0; i < requestCount; i++)
            {
                userIds.Add(provider.GetPerson().Email);
            }

            // Assert
            foreach (string userId in userIds)
            {
                int userIdCount = userIds.Count(u => u.Equals(userId));
                Assert.Equal(requestSets, userIdCount);
            }
        }