예제 #1
0
        public void OnAuthenticationEvent_SettingsAreUpdated()
        {
            // Arrange.
            var eventAggregator = Mock.Create<IEventAggregator>(Behavior.Loose);
            var communicationService = Mock.Create<IConcurrencyCommunicationService>(Behavior.Loose);
            var utils = Mock.Create<IUtils>(Behavior.Loose);
            Mock.Arrange(() => utils.CurrentUserAuthenticated).Returns(true);

            var emailSettingsRetriever = Mock.Create<EmailSettingsRetriever>(Behavior.Loose);
            Mock.Arrange(() => EmailSettingsRetriever.GetEmailSettingsAsync()).Returns(TaskHelper.FromResult(emailSettingsRetriever));

            var settings = new EmailSettings(eventAggregator, communicationService, utils);
            settings.OnImportsSatisfied();

            Mock.Arrange(() => emailSettingsRetriever.DetailsFromAddress).Returns("*****@*****.**");

            // Act.
            settings.HandleEvent(new AuthenticationEvent());

            // Assert.
            Assert.IsTrue(settings.CanSendFromDetails);
        }