public void HandleCreateUser() { var handler = GetHandler(); var newGuid = Guid.NewGuid(); var command = new CreateUser(newGuid, "user2", "123abc", "*****@*****.**", true, "TestApp"); //devo usare la handler.Handle(command); repository.Verify(x => x.Save(It.Is<User>(u => u.Id == newGuid && u.UserName == "user2" && u.Password == "123abc"), It.IsAny<Guid>(), It.IsAny<Action<IDictionary<string, object>>>()), Times.Once()); }
public void CreateUser() { var userId = Guid.NewGuid(); var command = new CreateUser(userId, "username", "password", "email", true, "pApplicationName"); Assert.AreEqual(userId, command.AggregateId); Assert.AreEqual("username", command.UserName); Assert.AreEqual("password", command.Password); Assert.AreEqual("email", command.Email); Assert.AreEqual(true, command.IsApproved); Assert.Less(DateTime.MinValue, command.CreationDate); Assert.AreEqual(command.CreationDate, command.LastPasswordChangedDate); Assert.AreEqual(command.CreationDate, command.LastActivityDate); Assert.AreEqual("pApplicationName", command.ApplicationName); Assert.AreEqual(false, command.IsLockedOut); Assert.AreEqual(command.CreationDate, command.LastLockedOutDate); Assert.AreEqual(0, command.FailedPasswordAttemptCount); Assert.AreEqual(command.CreationDate, command.FailedPasswordAttemptWindowStart); Assert.AreEqual(0, command.FailedPasswordAnswerAttemptCount); Assert.AreEqual(command.CreationDate, command.FailedPasswordAnswerAttemptWindowStart); }