public void TestSerializationOfUserLoginInfoAdded() { var evt = new UserLoginInfoAdded(new ImmutableUserLoginInfo("LOGINPROVIDER", "PROVIDERKEY", "DISPLAYNAME")); var bytes = LZ4MessagePackSerializer.Serialize <IEvent>(evt, AspnetIdentityResolver.Instance); var eventChk = LZ4MessagePackSerializer.Deserialize <IEvent>(bytes, AspnetIdentityResolver.Instance) as UserLoginInfoAdded; Assert.NotNull(eventChk); Assert.Equal(evt.UserloginInfo.LoginProvider, eventChk.UserloginInfo.LoginProvider); Assert.Equal(evt.UserloginInfo.ProviderKey, eventChk.UserloginInfo.ProviderKey); Assert.Equal(evt.UserloginInfo.DisplayName, eventChk.UserloginInfo.DisplayName); }
private void HandleEvent(IActorRef _, UserLoginInfoAdded evt) { if (user.Logins == null) { user.Logins = new List <ImmutableUserLoginInfo>(); } var loginInfo = evt.UserloginInfo; user.Logins.Add(loginInfo); if (!inSync) { return; } coordinator.Tell(new ActorMessages.UserCoordinator.NotifyUserEvent(new ActorMessages.UserCoordinator.UserLoginAdded <TKey>(userId, loginInfo))); }
private bool TestCommand(AddUserLoginInfo evt, out IEvent e) { e = null; if (user == null) { return(false); } if (user.Logins == null) { e = new UserLoginInfoAdded(evt.UserLoginInfo); } else { var login = user.Logins.FirstOrDefault(x => x.Equals(evt.UserLoginInfo)); if (login == default(ImmutableUserLoginInfo)) { e = new UserLoginInfoAdded(evt.UserLoginInfo); } } return(true); }