public async void Can_send_mobile_verification_sms() { await RegisterPlayer(false); var playerId = FakePlayerRepository.Players.First().Id; _playerCommands.SendMobileVerificationCode(playerId); var events = FakeEventRepository.GetEvents <MobileVerificationCodeSentSms>().ToArray(); Assert.That(events.Length, Is.EqualTo(1)); Assert.That(events.First().PlayerId, Is.EqualTo(playerId)); }
public async void Can_send_activation_sms() { _smsNotificationWorker.Start(); FakeBrandRepository.Brands.First().PlayerActivationMethod = PlayerActivationMethod.Sms; FakeBrandRepository.SaveChanges(); await RegisterPlayer(false); var events = FakeEventRepository.GetEvents <NotificationSentEvent>().ToArray(); Assert.That(events.Length, Is.EqualTo(1)); Assert.That(events.First().Type, Is.EqualTo(NotificationType.Sms)); }
public async void Can_send_activation_email_and_sms() { _emailNotificationWorker.Start(); _smsNotificationWorker.Start(); FakeBrandRepository.Brands.First().PlayerActivationMethod = PlayerActivationMethod.EmailOrSms; FakeBrandRepository.SaveChanges(); await RegisterPlayer(false); var notificationSentEvents = FakeEventRepository.GetEvents <NotificationSentEvent>().ToArray(); Assert.That(notificationSentEvents.Length, Is.EqualTo(2)); Assert.That(notificationSentEvents.Count(x => x.Type == NotificationType.Email), Is.EqualTo(1)); Assert.That(notificationSentEvents.Count(x => x.Type == NotificationType.Sms), Is.EqualTo(1)); }
public async void Can_resend_activation_email() { _emailNotificationWorker.Start(); FakeBrandRepository.Brands.First().PlayerActivationMethod = PlayerActivationMethod.Email; FakeBrandRepository.SaveChanges(); await RegisterPlayer(false); var playerId = FakePlayerRepository.Players.First().Id; _playerCommands.ResendActivationEmail(playerId); var events = FakeEventRepository.GetEvents <NotificationSentEvent>().ToArray(); Assert.That(events.Length, Is.EqualTo(2)); }
public void RunTest(ICommand command) { Setup(); var repository = new FakeEventRepository(); repository.InitialEvents = Given(); var queryDataStore = new FakeQueryDataStore(); var queryService = new QueryHandler(queryDataStore); var commandRepository = new Mock<ICommandRepository>(); HandleEvents(repository.InitialEvents, queryDataStore); Exception caughtException = null; var commandHandlerFactory = new CommandHandlerFactory(repository, queryService, commandRepository.Object); try { commandHandlerFactory.ExecuteCommand(command); } catch (Exception e) { if (ExpectedException() == null) { throw; } caughtException = e; } if (caughtException != null || ExpectedException() != null) { if (caughtException != null && ExpectedException() != null) { Assert.AreEqual(ExpectedException().GetType(), caughtException.GetType()); } else { Assert.Fail("There was an Expected Exception but none was thrown."); } } ValidateExpectedEvents(ExpectedEvents(), repository.EventList); }
public void SetUp() { series = CreateEntry.EventSeries("M3"); existingEvent = new ReleaseEvent(string.Empty, null, series, 2013, "Spring", null, false); repository = new FakeEventRepository(); repository.Save(series); repository.Save(existingEvent); album = CreateEntry.Album(name: "Day's Footsteps"); album.OriginalReleaseEvent = existingEvent; repository.Save(album); user = CreateEntry.User(group: UserGroupId.Trusted); repository.Save(user); permissionContext = new FakePermissionContext(user); queries = new EventQueries(repository, new FakeEntryLinkFactory(), permissionContext, new InMemoryImagePersister()); }
public void SetUp() { series = CreateEntry.EventSeries("M3"); existingEvent = new ReleaseEvent(string.Empty, null, series, 2013, "Spring"); repository = new FakeEventRepository(); repository.Save(series); repository.Save(existingEvent); album = CreateEntry.Album(name: "Day's Footsteps"); album.OriginalReleaseEventName = "M3 2013 Spring"; repository.Save(album); var user = CreateEntry.User(); repository.Save(user); queries = new EventQueries(repository, new FakeEntryLinkFactory(), new FakePermissionContext(user)); }
public void SetUp() { series = CreateEntry.EventSeries("M3"); existingEvent = CreateEntry.SeriesEvent(series, 2013, "Spring"); series.AllEvents.Add(existingEvent); repository = new FakeEventRepository(); repository.Save(series); repository.Save(existingEvent); repository.SaveNames(series); repository.SaveNames(existingEvent); album = CreateEntry.Album(name: "Day's Footsteps"); album.OriginalReleaseEvent = existingEvent; repository.Save(album); user = CreateEntry.User(group: UserGroupId.Trusted); repository.Save(user); permissionContext = new FakePermissionContext(user); queries = new EventQueries(repository, new FakeEntryLinkFactory(), permissionContext, new InMemoryImagePersister(), new FakeUserIconFactory(), new EnumTranslations(), mailer); }
public EditEventModel() { repo = FakeEventRepository.Instance; }
public IndexModel() { repo = FakeEventRepository.Instance; }
public CreateEventsModel() { repo = FakeEventRepository.Instance; }