Beispiel #1
0
 public TokenMsgResponse(ISmartpoolDB smartpoolDb)
 {
     _smartpoolDb = smartpoolDb;
     _poolKeeper = new FakePoolKeeper(_smartpoolDb);
     if(_smartpoolDb.UserAccess.IsEmailInUse("1"))
         _poolKeeper.GeneratePoolsForUser("1");
     if (_smartpoolDb.UserAccess.IsEmailInUse("2"))
         _poolKeeper.GeneratePoolsForUser("2");
 }
Beispiel #2
0
 public FakePool(int amountOfSensors, int secondsBetweenSensorReadings, string userName, string poolName, ISmartpoolDB smartpoolDb)
 {
     UserName = userName;
     PoolName = poolName;
     SmartpoolDb = smartpoolDb;
     //_amountOfSensors = amountOfSensors;
     _fakeSensors = new List<ISensor>();
     GenerateSensors();
     SaveSensorValue(null, null);
     var timer = new Timer { Interval = 1000 * secondsBetweenSensorReadings };
     timer.Elapsed += SaveSensorValue;
     timer.Start();
 }
Beispiel #3
0
 public ResponseManager(ISmartpoolDB smartpoolDb)
 {
     _tokenKeeper = new TokenKeeper(new TokenStringGenerator(), 10);
     _smartpoolDb = smartpoolDb;
     _tokenMsgResponse = new TokenMsgResponse(_smartpoolDb);
     try
     {
         _smartpoolDb.UserAccess.IsEmailInUse("qa"); //error with first call to db taking an excess amount of time
     }
     catch (Exception)
     {
         Console.WriteLine("Could not connect to database. Make sure VPN is active");
     }
     
 }
Beispiel #4
0
 public void SetUp()
 {
     _subForSmartpoolDb = Substitute.For<ISmartpoolDB>();
     _uut = new FakePool(4, 1, "username", "poolname", _subForSmartpoolDb);
 }
        public void SetUp()
        {
            _tokenKeeperSub = Substitute.For<ITokenKeeper>();
            _tokenMsgResponseSub = Substitute.For<ITokenMsgResponse>();
            _smartpoolDbSub = Substitute.For<ISmartpoolDB>();
            _uut = new ResponseManager(_tokenKeeperSub, _tokenMsgResponseSub, _smartpoolDbSub);

            _smartpoolDbSub.UserAccess.ValidatePassword("KnownEmail", "CorrectPassword").Returns(true);

            //_tokenMsgResponse.HandleTokenMsg(new TokenMsg("KnownEmail", "CorrectTokenString")).Returns(new TokenResponseMsg(true));

            _tokenKeeperSub.CreateNewToken("KnownEmail").Returns("CorrectTokenString");
            _tokenKeeperSub.TokenActive("KnownEmail", "CorrectTokenString").Returns(true);
            _tokenKeeperSub.TokenActive("KnownEmail", "IncorrectTokenString").Returns(false);
        }
 public void Setup()
 {
     _subForSmartpoolDb = Substitute.For<ISmartpoolDB>();
     _subForTokenKeeper = Substitute.For<ITokenKeeper>();
     _uut = new TokenMsgResponse(_subForSmartpoolDb);
 }
Beispiel #7
0
 public FakePoolKeeper(ISmartpoolDB smartpoolDb)
 {
     _smartpoolDb = smartpoolDb;
 }
 public void Setup()
 {
     _subForSmartpoolDb = Substitute.For<ISmartpoolDB>();
     _uut = new FakePoolKeeper(_subForSmartpoolDb);
 }
Beispiel #9
0
 public ResponseManager(ITokenKeeper tokenKeeper, ITokenMsgResponse tokenMsgResponse, ISmartpoolDB smartpoolDb)
 {
     _tokenKeeper = tokenKeeper;
     _tokenMsgResponse = tokenMsgResponse;
     _smartpoolDb = smartpoolDb;
 }