public void SetUp()
        {
            _mediator       = new Mock <IMediator>();
            _hashingService = new Mock <IHashingService>();

            _hashingService.Setup(m => m.DecodeValue("ABBA777")).Returns(777);
            _hashingService.Setup(m => m.DecodeValue("ABBA888")).Returns(888);
            _hashingService.Setup(m => m.DecodeValue("ABBA999")).Returns(999);
            _mediator.Setup(m => m.SendAsync(It.IsAny <GetUserNotificationSettingsQuery>()))
            .ReturnsAsync(new GetUserNotificationSettingsQueryResponse
            {
                NotificationSettings = new List <UserNotificationSetting>
                {
                    new UserNotificationSetting
                    {
                        AccountId       = 999,
                        HashedAccountId = "ABBA999",
                        Id   = 10999,
                        Name = "Super Account 999",
                        ReceiveNotifications = true,
                        UserId = 110099
                    },
                    new UserNotificationSetting
                    {
                        AccountId       = 888,
                        HashedAccountId = "ABBA888",
                        Id   = 10888,
                        Name = "Super Account 888",
                        ReceiveNotifications = false,
                        UserId = 110088
                    }
                }
            });
            _sut = new Web.Orchestrators.UserSettingsOrchestrator(_mediator.Object, _hashingService.Object, Mock.Of <ILog>());
        }
Exemple #2
0
        public void Arrange()
        {
            _mediator       = new Mock <IMediator>();
            _logger         = new Mock <ILog>();
            _hashingService = new Mock <IHashingService>();

            _hashingService.Setup(x => x.DecodeValue(It.IsAny <string>())).Returns(() => 123);

            _orchestrator = new Web.Orchestrators.UserSettingsOrchestrator(_mediator.Object, _hashingService.Object, _logger.Object);

            _mediator.Setup(x => x.SendAsync(It.IsAny <GetUserNotificationSettingsQuery>()))
            .ReturnsAsync(new GetUserNotificationSettingsQueryResponse
            {
                NotificationSettings = new List <UserNotificationSetting>()
            });

            _mediator.Setup(x => x.SendAsync(It.IsAny <UpdateUserNotificationSettingsCommand>()))
            .Returns(() => Task.FromResult(new Unit()));
        }