private LoggingContext CreateContext() { DbContextOptions <LoggingContext> options = new DbContextOptionsBuilder <LoggingContext>() .UseInMemoryDatabase(databaseName: "LoggingRepository") .Options; LoggingContext context = new LoggingContext(options); repo = new LogInfoRepository(context); return(context); }
private void CreateDisconnectedDatabase() { DbContextOptions <LoggingContext> options = new DbContextOptionsBuilder <LoggingContext>() .UseInMemoryDatabase(databaseName: "UserRepositoryTest") .Options; Mock <LoggingContext> contextMock = new Mock <LoggingContext>(options); Mock <DbException> toThrow = new Mock <DbException>(); contextMock.Setup(c => c.Logs).Throws(toThrow.Object); repo = new LogInfoRepository(contextMock.Object); }
public void Initialize() { aLog = new LogInfo() { Id = 1, Date = DateTime.Now, LogType = LogType.LOGIN, Message = "Logged using API", Username = "******" }; logRepo = new Mock <ILogInfoRepository>().Object; Mock.Get(logRepo).Setup(l => l.Get(aLog.Id)).Throws(new LogNotFoundException()); Mock.Get(logRepo).Setup(l => l.GetAll()).Returns(new List <LogInfo>()); Mock.Get(logRepo).Setup(l => l.Exists(aLog.Id)).Returns(false); Mock.Get(logRepo).Setup(l => l.Delete(aLog.Id)).Callback(DeleteALog); Mock.Get(logRepo).Setup(l => l.Add(It.IsAny <LogInfo>())).Returns(aLog).Callback(AddALog); Mock <IAuthenticationService> auth = new Mock <IAuthenticationService>(); logger = new LoggerService(logRepo, auth.Object); }
public LogInfoService(ILogInfoRepository logInfoRepository) { _logInfoRepository = logInfoRepository; }
public LoggerService(ILogInfoRepository logRepo, IAuthenticationService authService) { this.logRepo = logRepo; authenticator = authService; }
public LogInfoService(ILogInfoRepository repository) : base(repository) { this._repository = repository; }
public LogInfoService(ILogInfoRepository logInfoRepository, IActionContextAccessor actionContext) { _logInfoRepository = logInfoRepository; _actionContext = actionContext; }
public AuthenticationService(IUserRepository aRepo, ILogInfoRepository aLogger) { users = aRepo; logger = aLogger; mapper = new UserDtoMapper(); }
public LogInfoController(ILogInfoRepository logInfoRepository) { m_logInfoRepository = (logInfoRepository != null) ? logInfoRepository : throw new ArgumentNullException(); }
public LogInfoController(LogInfoService logInfoService, ILogInfoRepository logInfoRepository) { LogInfoService = logInfoService; LogInfoRepository = logInfoRepository; }