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)); }
public ActionResult Edit(int id) { var model = new EditViewModel(); var person = personProvider.GetPerson(id); AutoMapper.Mapper.DynamicMap(person, model); return(View(model)); }
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); }
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); } }
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); } }