Beispiel #1
0
 public SaveDashboardData(HomePageInfo homePageInfo, ValidStaticCommands staticCommandInfo, TriviaMessages triviaMessages, ChatNotificationInfo chatNotificationInfo)
 {
     HomePageInfo         = homePageInfo;
     StaticCommandInfo    = staticCommandInfo;
     TriviaMessages       = triviaMessages;
     ChatNotificationInfo = chatNotificationInfo;
 }
        public async Task SaveDashboardData_has_correct_serialized_objects_from_strings()
        {
            // arrange
            var homePageInfo = new HomePageInfo {
                Badges = new List <SocialMediaBadge> {
                    new SocialMediaBadge {
                        Icon = "tumblr", Text = "mgroves"
                    }
                }
            };
            var staticContentCommands = new ValidStaticCommands {
                Commands = new List <StaticCommandInfo> {
                    new StaticCommandInfo {
                        Command = "defend", Content = "defend the channel against invaders!"
                    }
                }
            };
            var triviaMessages = new TriviaMessages {
                Messages = new List <string> {
                    "hey what's up"
                }
            };
            var chatNotificationInfo = new ChatNotificationInfo();

            var homePageInfoJson          = JsonConvert.SerializeObject(homePageInfo);
            var chatNotificationInfoJson  = JsonConvert.SerializeObject(chatNotificationInfo);
            var staticContentCommandsJson = JsonConvert.SerializeObject(staticContentCommands);
            var triviaMessagesJson        = JsonConvert.SerializeObject(triviaMessages);

            // act
            await _controller.DashboardPost(homePageInfoJson, staticContentCommandsJson, triviaMessagesJson, chatNotificationInfoJson);

            // assert
            _mockMediator.Verify(m => m.Send(
                                     It.Is <SaveDashboardData>(x =>
                                                               x.HomePageInfo.Badges[0].Icon == homePageInfo.Badges[0].Icon
                                                               &&
                                                               x.StaticCommandInfo.Commands[0].Command == staticContentCommands.Commands[0].Command),
                                     It.IsAny <CancellationToken>()), Times.Once);
        }
Beispiel #3
0
 public SaveDashboardData(HomePageInfo homePageInfo, ValidStaticCommands staticCommandInfo, TriviaMessages triviaMessages)
 {
     HomePageInfo      = homePageInfo;
     StaticCommandInfo = staticCommandInfo;
     TriviaMessages    = triviaMessages;
 }