示例#1
0
 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
         });
     }
 }
示例#2
0
        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();
        }