Example #1
0
        public void ConfigurationManagerSaveUsersNewFile()
        {
            var users = new Dictionary <string, string>();

            users.Add("*****@*****.**", CryptographyController.EncryptPassword("bobLikesThaiFood"));
            Assert.DoesNotThrowAsync(async() => await _configurationManager.SaveUsersAsync(users), "Failed", null);
        }
Example #2
0
        public void SetUp()
        {
            Dictionary <string, string> users = new Dictionary <string, string>
            {
                { "*****@*****.**", CryptographyController.EncryptPassword("bobLikesThaiFood") },
                { "*****@*****.**", CryptographyController.EncryptPassword("stuartLikesThaiFood") },
                { "*****@*****.**", CryptographyController.EncryptPassword("kevinLikesThaiFood") }
            };

            _loginManager = new LoginManager(users);
        }
Example #3
0
        public async Task ConfigurationManagerGetUsers()
        {
            var users = new Dictionary <string, string>();

            users.Add("*****@*****.**", CryptographyController.EncryptPassword("bobLikesThaiFood"));
            await _configurationManager.SaveUsersAsync(users);

            users = _configurationManager.GetUsersAsync().Result;

            Assert.AreEqual(1, users.Count());
            Assert.AreEqual("*****@*****.**", users.First().Key);
            Assert.AreEqual(CryptographyController.EncryptPassword("bobLikesThaiFood"), users.First().Value);
        }
Example #4
0
        public void Setup()
        {
            string filePath = AppDomain.CurrentDomain.BaseDirectory + "user.dat";

            _configurationManager = Substitute.For <ConfigurationManager>(filePath);
            var users = new Dictionary <string, string>
            {
                { "*****@*****.**", CryptographyController.EncryptPassword("bobLikesThaiFood") },
                { "*****@*****.**", CryptographyController.EncryptPassword("stuartLikesThaiFood") },
                { "*****@*****.**", CryptographyController.EncryptPassword("kevinLikesThaiFood") }
            };

            _loginManager        = Substitute.For <LoginManager>(users);
            _registrationManager = Substitute.For <RegistrationManager>(users);

            _signupManager = new SignUpManager(_loginManager, _registrationManager, _configurationManager, filePath);
        }