public void GetPeople_WhenNotInitialized_ThrowsException() { //Given IPersonProvider provider = new PersonProvider(new PersonCreator(new BogusFabricator(), new InMemoryUserDataProvider())); //When Action action = () => provider.GetPeople(); //Then Assert.Throws <PersonProviderNotInitializedException>(action); }
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 Read_3_item_2_person_valid__expect__2_person_returned() { Mock <IStringListProvider> slMock = new Mock <IStringListProvider>(); slMock.Setup(provider => provider.GetStrings()) .Returns(new string[] { "Johan Sebastian", "Andre Satya", "" }); PersonParser pp = new PersonParser(); PersonProvider teste = new PersonProvider(slMock.Object, pp); var result = teste.GetPeople().ToList(); Assert.IsNotNull(result); slMock.Verify(mock => mock.GetStrings(), Times.Once); Assert.AreEqual(2, result.Count); Assert.AreEqual("Johan Sebastian", result[0].ToString()); Assert.AreEqual("Andre Satya", result[1].ToString()); }