コード例 #1
0
        public void TestFramework_FTP()
        {
            this.Configuration.RouteTable.Add("Investigations_overview", "Investigations/overview", "overview.dothtml", null);
            var context = new TestDotvvmRequestContext()
            {
                Configuration       = this.Configuration,
                ApplicationHostPath = "../Netfox.Web.App/",
                Parameters          = new Dictionary <string, object>()
            };

            this.AddUser();
            this.AddInvestigation();

            Investigation investigation;

            using (var uow = this.UnitOfWorkProvider.Create())
            {
                var ctx = EntityFrameworkUnitOfWork.TryGetDbContext <NetfoxWebDbContext>(this.UnitOfWorkProvider);
                investigation = ctx.Investigations.First();
            }

            var NetfoxAPIFacadeFactory = this.Container.Resolve <Func <IWindsorContainer, Guid, string, NetfoxAPIFacade> >();
            var netfoxAPI = NetfoxAPIFacadeFactory(this.ContainerAPI, investigation.Id, Directory.GetCurrentDirectory());
            var snooper   = Container.Resolve <SnooperFTP.SnooperFTP>();

            Assert.NotNull(netfoxAPI);

            netfoxAPI.ProcessCapture(NetfoxWebTest.Default.FTPPcap);

            var capturelList = CaptureFacade.GetCaptureList(investigation.Id).ToList();

            Assert.AreEqual(capturelList.Count, 1);

            var l3    = new GridViewDataSet <L3ConversationDTO>();
            var l4    = new GridViewDataSet <L4ConversationDTO>();
            var l7    = new GridViewDataSet <L7ConversationDTO>();
            var frame = new GridViewDataSet <PmFrameBaseDTO>();

            l3.PagingOptions.PageSize        = 15;
            l3.SortingOptions.SortDescending = false;
            l3.SortingOptions.SortExpression = nameof(L3ConversationDTO.Id);

            l4.PagingOptions.PageSize        = 15;
            l4.SortingOptions.SortDescending = false;
            l4.SortingOptions.SortExpression = nameof(L4ConversationDTO.Id);

            l7.PagingOptions.PageSize        = 15;
            l7.SortingOptions.SortDescending = false;
            l7.SortingOptions.SortExpression = nameof(L7ConversationDTO.Id);

            frame.PagingOptions.PageSize        = 15;
            frame.SortingOptions.SortDescending = false;
            frame.SortingOptions.SortExpression = nameof(PmFrameBaseDTO.Id);

            this.CaptureFacade.FillL3ConversationDataSet(l3, capturelList.First().Id, investigation.Id, new ConversationFilterDTO());
            Assert.AreEqual(l3.PagingOptions.TotalItemsCount, 1);
            this.CaptureFacade.FillL4ConversationDataSet(l4, capturelList.First().Id, investigation.Id, new ConversationFilterDTO());
            Assert.AreEqual(l4.PagingOptions.TotalItemsCount, 5);
            this.CaptureFacade.FillL7ConversationDataSet(l7, capturelList.First().Id, investigation.Id, new ConversationFilterDTO());
            Assert.AreEqual(l7.PagingOptions.TotalItemsCount, 5);
            this.CaptureFacade.FillPmFrameDataSet(frame, capturelList.First().Id, investigation.Id, new FrameFilterDTO());
            Assert.AreEqual(frame.PagingOptions.TotalItemsCount, 69);

            var listSnooper = new List <string>();

            listSnooper.Add(snooper.GetType().FullName);

            netfoxAPI.ExportData(listSnooper);
            var exports = new GridViewDataSet <SnooperFTPListDTO>();

            exports.PagingOptions.PageSize        = 15;
            exports.SortingOptions.SortDescending = false;
            exports.SortingOptions.SortExpression = nameof(SnooperFTPListDTO.FirstSeen);

            ExportFTPFacade.FillDataSet(exports, investigation.Id, new ExportFilterDTO());

            Assert.AreEqual(exports.PagingOptions.TotalItemsCount, 21);
        }
コード例 #2
0
 public ExportFTPViewModel(InvestigationFacade investigationFacade, HangfireFacade hangfireFacade, CaptureFacade captureFacade, ExportFacade exportFacade, SnooperFTPWeb snooperInfo, ExportFTPFacade exportFTPFacade) : base(investigationFacade, hangfireFacade, captureFacade, exportFacade)
 {
     this.SnooperInfo     = snooperInfo;
     this.ExportFTPFacade = exportFTPFacade;
 }