public async Task LOAD_FILE_EXPECT_SUCCESS() { var mockConfig = new Mock <IConfiguration>(); mockConfig.Setup(x => x["BookLocation"]).Returns(projectDirectory + "/Data/AddressBook"); var addressBook = new AddressBookStore(mockLogger, mockConfig.Object); await addressBook.LoadAddressBook(); Assert.True(addressBook.HasLoaded); var addressBookArray = (Person[])addressBook.AddressBook; Assert.Equal(5, addressBookArray.Length); }
public async Task LOAD_FILE_EXPECT_SUCCESS_WITH_FOUR_PEOPLE() { var mockConfig = new Mock <IConfiguration>(); mockConfig.Setup(x => x["BookLocation"]).Returns(projectDirectory + "/Data/InvalidAddressBook"); var addressBook = new AddressBookStore(mockLogger, mockConfig.Object); await addressBook.LoadAddressBook(); Assert.True(addressBook.HasLoaded); var addressBookArray = (Person[])addressBook.AddressBook; Assert.Equal(4, addressBookArray.Length); Assert.Empty(addressBookArray.Where(x => x == default(Person))); }