Exemple #1
0
 public ParserPages(
     MultithreadDbContext multithreadDbContext,
     ILinksHistoryRepositoroes linksHistoryRepositoroes,
     LinksHistoryServices linksHistoryServices)
 {
     this.multithreadDbContext     = multithreadDbContext;
     this.linksHistoryRepositoroes = linksHistoryRepositoroes;
     this.linksHistoryServices     = linksHistoryServices;
 }
Exemple #2
0
 public StartApp(
     MultithreadDbContext dbContext,
     ILinksHistoryRepositoroes linksHistoryRepositoroes,
     LinksHistoryServices linksHistoryServices,
     ParserPages parserPages)
 {
     this.dbContext = dbContext;
     this.linksHistoryRepositoroes = linksHistoryRepositoroes;
     this.linksHistoryServices     = linksHistoryServices;
     this.parserPages = parserPages;
 }
        public void ShouldRegisterdNewLinksHistory()
        {
            var linksHistoryRepositoroes = Substitute.For <ILinksHistoryRepositoroes>();
            LinksHistoryServices linksHistoryServices = new LinksHistoryServices(linksHistoryRepositoroes);
            LinksHistoryEntity   args = new LinksHistoryEntity();

            args.Links        = "https://www.google.ru/webhp?source=search_app";
            args.PreviousLink = "https://www.google.ru";

            linksHistoryServices.ContainsLinks(args);

            linksHistoryRepositoroes.Contains(Arg.Is <LinksHistoryEntity>(w => w.Links == args.Links && w.PreviousLink == args.PreviousLink)).Returns(true);
            linksHistoryServices.ContainsLinks(args);
        }
        public void ShouldRegisterNewLinksHistory()
        {
            var linksHistoryRepositoroes = Substitute.For <ILinksHistoryRepositoroes>();
            LinksHistoryServices linksHistoryServices = new LinksHistoryServices(linksHistoryRepositoroes);
            LinksHistoryEntity   args = new LinksHistoryEntity();

            args.Links        = "https://www.google.ru/webhp?source=search_app";
            args.PreviousLink = "https://www.google.ru";

            linksHistoryServices.RegisterNewLinks(args);

            linksHistoryRepositoroes.Received(1).Add(Arg.Is <LinksHistoryEntity>(w => w.Links == args.Links && w.PreviousLink == args.PreviousLink));
            linksHistoryRepositoroes.Received(1).SaveChanges();
        }