public void AddLinksToDB(List <string> collection, int iteration) { foreach (var item in collection) { if (linkService.ContainsByLink(item)) { continue; } var id = linkService.AddNewLink(new LinkInfo() { Link = item, Iteration = iteration }); } }
public void ShouldAddLinkToDatabase() { //Arrange LinkInfo link = new LinkInfo() { Link = "https://en.wikipedia.org/wiki/The_Mummy_(1999_film)", Iteration = 1 }; //Act var linkId = linkService.AddNewLink(link); //Assert this.linkTableRepository.Received(1).Add(Arg.Is <LinkEntity>( w => w.Link == link.Link && w.Iteration == link.Iteration)); this.linkTableRepository.Received(1).SaveChanges(); }