Exemple #1
0
 public SessionServiceUT()
 {
     //Arrange
     tu  = new TestingUtils();
     _db = tu.CreateDataBaseContext();
     ss  = new SessionService(_db);
 }
Exemple #2
0
 public PointControllerIT()
 {
     controller = new PointController();
     _tu        = new TestingUtils();
     _db        = _tu.CreateDataBaseContext();
     _ss        = new SessionService(_db);
 }
Exemple #3
0
        public void Create_Point_Success()
        {
            // Arrange
            newPoint = tu.CreatePointObject();
            var expected = newPoint;

            using (_db = tu.CreateDataBaseContext())
            {
                // Act
                var response = ps.CreatePoint(newPoint);
                _db.SaveChanges();

                //Assert
                Assert.IsNotNull(response);
                Assert.AreSame(response, expected);
            }
        }
Exemple #4
0
        public void IsServiceDisabled_Sucecss()
        {
            service1 = _ts.CreateServiceInDb(false);

            var responseExpected = true;
            var resultExpected   = true;

            using (var _db = _ts.CreateDataBaseContext())
            {
                var response = _os.IsServiceDisabled(_db, service1.Id);
                var result   = _db.Services.Find(service1.Id);

                Assert.IsNotNull(response);
                Assert.IsNotNull(result);
                Assert.AreEqual(responseExpected, response);
                Assert.AreNotEqual(resultExpected, result);
            }
        }
        public void CreateClient()
        {
            //Arrange
            Client newClient        = tu.CreateClientObject();
            var    expectedResponse = newClient;

            using (_db = tu.CreateDataBaseContext()) {
                //Act
                Client response = cs.CreateClient(_db, newClient);
                _db.SaveChanges();

                //Assert
                var result = _db.Clients.Find(newClient.Id);
                Assert.IsNotNull(response);
                Assert.IsNotNull(result);
                Assert.AreSame(result, expectedResponse);
            }
        }
Exemple #6
0
        public void Create_Session_Success()
        {
            // Arrange
            newUser    = tu.CreateUserObject();
            newSession = tu.CreateSessionObject(newUser);
            var expected = newSession;

            using (_db = tu.CreateDataBaseContext())
            {
                // Act
                var response = ss.CreateSession(newSession);
                _db.SaveChanges();

                //Assert
                Assert.IsNotNull(response);
                Assert.AreEqual(response.Id, expected.Id);
            }
        }
Exemple #7
0
        public async void Login_NewUser_InvalidUserName_Failure_ExceptionThrown()
        {
            var invalid_username = Guid.NewGuid() + ".com";
            var valid_ssoID      = Guid.NewGuid();
            var timestamp        = 8283752242;

            MockLoginPayload mock_payload = new MockLoginPayload
            {
                email     = invalid_username,
                ssoUserId = valid_ssoID,
                timestamp = timestamp
            };

            var signature = mock_payload.Signature();

            using (var _db = ut.CreateDataBaseContext())
            {
                _ssoLoginManager = new KFC_SSO_Manager(_db);
                var result = await _ssoLoginManager.LoginFromSSO(invalid_username, valid_ssoID, timestamp, signature);
            }

            //Assert - catch exception
        }
        public void Create_User_Success()
        {
            // Arrange
            newUser = tu.CreateUserObject();
            var expected = newUser;

            using (_db = tu.CreateDataBaseContext())
            {
                us = new UserService(_db);

                // Act
                var response = us.CreateUser(newUser);
                _db.SaveChanges();

                //Assert
                Assert.IsNotNull(response);
                Assert.AreSame(response, expected);
            }
        }
Exemple #9
0
 public PointServiceUT()
 {
     tu  = new TestingUtils();
     _db = tu.CreateDataBaseContext();
     ps  = new PointService(_db);
 }