Exemple #1
0
        public override void Validate(string userName, string password)
        {
            var users = new UserDto[]
            {
                new UserDto
                {
                    Email    = "test1Email",
                    FullName = "test1FullName",
                    Password = "******",
                    Username = "******"
                },
                new UserDto
                {
                    Email    = "test2Email",
                    FullName = "test2FullName",
                    Password = "******",
                    Username = "******"
                },
                new UserDto
                {
                    Email    = "test3Email",
                    FullName = "test3FullName",
                    Password = "******",
                    Username = "******"
                },
                new UserDto
                {
                    Email    = "test4Email",
                    FullName = "test4FullName",
                    Password = "******",
                    Username = "******"
                },
                new UserDto
                {
                    Email    = "test5Email",
                    FullName = "test5FullName",
                    Password = "******",
                    Username = "******"
                },
                new UserDto
                {
                    Email    = "test6Email",
                    FullName = "test6FullName",
                    Password = "******",
                    Username = "******"
                }
            };

            if (userName == null || password == null)
            {
                throw new ArgumentException();
            }

            if (!users.Any(u => u.Username == u.Username && u.Password == u.Password))
            {
                throw new FaultException("Unknown username or incorrect password");
            }
        }