Ejemplo n.º 1
0
        public void Initialize()
        {
            var mockSet = new Mock <DbSet <NetworkEvent> >();

            mockSet.As <IDbAsyncEnumerable <NetworkEvent> >()
            .Setup(m => m.GetAsyncEnumerator())
            .Returns(new TestDbAsyncEnumerator <NetworkEvent>(data.GetEnumerator()));

            mockSet.As <IQueryable <NetworkEvent> >()
            .Setup(m => m.Provider)
            .Returns(new TestDbAsyncQueryProvider <NetworkEvent>(data.Provider));

            mockSet.As <IQueryable <NetworkEvent> >().Setup(m => m.Expression).Returns(data.Expression);
            mockSet.As <IQueryable <NetworkEvent> >().Setup(m => m.ElementType).Returns(data.ElementType);
            mockSet.As <IQueryable <NetworkEvent> >().Setup(m => m.GetEnumerator()).Returns(data.GetEnumerator());

            var mockContext = new Mock <PortnoxEntities>();

            mockContext.Setup(c => c.NetworkEvents).Returns(mockSet.Object);
            context = mockContext.Object;
        }
Ejemplo n.º 2
0
 public ScannerService(PortnoxEntities context)
 {
     db = context;
 }
Ejemplo n.º 3
0
 public ScannerService()
 {
     db = new PortnoxEntities();
 }