private void AssertThatUserIsRegistered(string token, string actualToken) { var user = new User("abc", "username", "*****@*****.**", "password", new DateTime(2021, 9, 22)); var currentUser = userRepository.GetUsers().Single(); Assert.Equal(user, currentUser); Assert.Equal(user.RegisterDate, currentUser.RegisterDate); var domainEvent = domainEventsAccessor.GetDomainEvents().SingleOrDefault(); Assert.Equal(new UserRegistered("abc", "*****@*****.**", "username"), domainEvent); Assert.Equal(token, actualToken); Assert.Collection(domainEventsAccessor.GetDomainEvents(), x => { Assert.Equal("abc", (x as UserRegistered).Id); Assert.Equal("username", (x as UserRegistered).Username); Assert.Equal("*****@*****.**", (x as UserRegistered).Email); }); }