public void Register_Should_SaveUserToDatabase() { // Arrange var provider = new SessionAuthProvider(mockAccessor.Object, mockUserDal.Object); // Act provider.Register("test", "*****@*****.**", "password123", "asdj", 15217, "user"); // Assert mockUserDal.Verify(m => m.CreateUser(It.IsAny <User>())); mockSession.Verify(m => m.Set(SessionAuthProvider.SessionKey, It.IsAny <byte[]>())); }
public void Register_Should_SaveUserToDatabase() { // Arrange var provider = new SessionAuthProvider(mockAccessor.Object, mockUserDal.Object); // Act provider.Register("test", "password123", "user", "OH", new System.DateTime(1992, 01, 01), "user"); // Assert mockUserDal.Verify(m => m.CreateUser(It.IsAny <User>())); mockSession.Verify(m => m.Set(SessionAuthProvider.SessionKey, It.IsAny <byte[]>())); }
public void Register_Should_SaveUserToDatabase() { // Arrange var provider = new SessionAuthProvider(mockAccessor.Object, mockUserDal.Object); RegisterViewModel registerViewModel = new RegisterViewModel(); registerViewModel.Username = "******"; registerViewModel.Email = "*****@*****.**"; registerViewModel.Password = "******"; registerViewModel.ConfirmPassword = "******"; registerViewModel.FirstName = "testA"; registerViewModel.LastName = "testB"; registerViewModel.BirthDate = new DateTime(2002, 2, 2); // Act provider.Register(registerViewModel); // Assert mockUserDal.Verify(m => m.CreateUser(It.IsAny <User>())); mockSession.Verify(m => m.Set(SessionAuthProvider.SessionKey, It.IsAny <byte[]>())); }