public void Initialize_WhenInvalidParameters_ThrowsException(int count) { //Given IPersonProvider provider = new PersonProvider(new PersonCreator(new BogusFabricator(), new InMemoryUserDataProvider())); //When Action initializeAction = () => provider.Initialize(count); //Then Assert.Throws <PersonProviderNotInitializedException>(initializeAction); }
public void GetPeople_WhenInitialized_ReturnsSameCountOfPeople() { //Given IPersonProvider provider = new PersonProvider(new PersonCreator(new BogusFabricator(), new InMemoryUserDataProvider())); const int count = 4; provider.Initialize(count); //When List <Person> users = provider.GetPeople(); //Then Assert.Equal(count, users.Count); }
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); } }