Exemplo n.º 1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            // Add framework services.
            services.AddMvc();
            string cs = Configuration.GetConnectionString("Mongo");
            MongoRepository <ScanResult, ObjectId> repo
                = new MongoRepository <ScanResult, ObjectId>(cs);

            ScansManager manager = new ScansManager(repo);

            services.AddSingleton(manager);
            WebSocketHandler.Manager = manager;
        }
Exemplo n.º 2
0
        public void AddingToScanned_GetAll_ContainsScanned()
        {
            // Arrange
            string uri = "https://stackoverflow.com";
            string cs  = "mongodb://*****:*****@ds157500.mlab.com:57500/storeage";
            MongoRepository <ScanResult, ObjectId> repo
                = new MongoRepository <ScanResult, ObjectId>(cs);

            ScansManager manager = new ScansManager(repo);
            // Act
            ScanResult res = new ScanResult(new Uri(uri));

            manager.Create(res);
            // Assert
            Assert.Contains(manager.GetAll(), r => r.Id.Equals(res.Id));
        }
Exemplo n.º 3
0
 public RayController(ScansManager manager)
 {
     _manager = manager;
 }