public void can_log_failed_authentication() { var providerId = Guid.NewGuid(); const string providerName = "TestProvider"; const string ipAddress = "127.0.0.1"; var provider = new ExternalProvider( providerId, providerName, _command); provider.NotAuthenticatedInvalidCredentials(ipAddress); var events = provider.TakeEvents(); Assert.Collection( events, e => Assert.IsType <ExternalProviderMsgs.ProviderCreated>(e), e => { if (e is ExternalProviderMsgs.AuthenticationFailedInvalidCredentials failed) { Assert.Equal(providerId, failed.ProviderId); Assert.Equal(ipAddress, failed.HostIPAddress); } else { throw new Exception("wrong event."); } }); }
public void can_add_external_provider() { var providerId = Guid.NewGuid(); const string providerName = "TestProvider"; var provider = new ExternalProvider( providerId, providerName, _command); var events = provider.TakeEvents(); Assert.Collection( events, e => { if (e is ExternalProviderMsgs.ProviderCreated created) { Assert.Equal(providerId, created.ProviderId); Assert.Equal(providerName, created.ProviderName); } else { throw new Exception("wrong event."); } }); }