Ejemplo n.º 1
0
        public void Delete(UserBasedProxy basedProxy)
        {
            var foundUser = ModelDatabase.GetUser(basedProxy);

            ModelDatabase.Users.Remove(foundUser);
            ModelDatabase.SaveChanges();
        }
Ejemplo n.º 2
0
        public void DeleteUserFunctionTest_ShouldBeSuccess()
        {
            var user = new UserBasedProxy {
                Login = "******"
            };

            RunServer(new DeleteUserFunction(DatabaseAuthorizer, databaseUserEditor));
            SendRequest("DeleteUser", GetDefaultParameters(), user.ToJson());

            A.CallTo(() => databaseUserEditor.Delete(user)).MustHaveHappened(Repeated.Exactly.Once);
        }
        public void GetExtendedUserFunctionTest_ShouldBeSuccess()
        {
            var inputBasedUser = new UserBasedProxy {
                Login = "******"
            };
            var inputExtendedUser = new UserExtendedProxy {
                Login = "******"
            };

            A.CallTo(() => databaseUserReader.GetExtendedProxy(inputBasedUser)).Returns(inputExtendedUser);

            RunServer(new GetExtendedUserFunction(DatabaseAuthorizer, databaseUserReader));
            var receivedUser = SendRequest <UserExtendedProxy>("GetExtendedUser", GetDefaultParameters(), inputBasedUser.ToJson());

            A.CallTo(() => databaseUserReader.GetExtendedProxy(inputBasedUser)).MustHaveHappened(Repeated.Exactly.Once);
            Assert.That(receivedUser, Is.EqualTo(inputExtendedUser));
        }
Ejemplo n.º 4
0
 public User GetUser(UserBasedProxy user)
 {
     return(Users.First(u => u.Login == user.Login));
 }
Ejemplo n.º 5
0
 public UserExtendedProxy GetExtendedProxy(UserBasedProxy basedProxy)
 {
     return(SendRequest <UserExtendedProxy>("GetExtendedUser", GetDefaultParameters(), basedProxy.ToJson()));
 }
Ejemplo n.º 6
0
 public void Delete(UserBasedProxy basedProxy)
 {
     SendRequest("DeleteUser", GetDefaultParameters(), basedProxy.ToJson());
 }
Ejemplo n.º 7
0
 public UserExtendedProxy GetExtendedProxy(UserBasedProxy basedProxy)
 {
     return(modelDatabase.GetUser(basedProxy).ToExtendedProxy());
 }