예제 #1
0
        public void ShouldAddCommand()
        {
            Sut.AddCommand(MockedUserCommand1.Object);

            Assert.Single(Sut.Commands);
            Assert.Equal(MockedUserCommand1.Object, Sut.Commands[MockedUserCommand1.Object.Name]);
        }
예제 #2
0
        public WhenUserCommandReceived()
        {
            Sut
            .AddCommand(MockedUserCommand1.Object)
            .AddCommand(MockedUserCommand2.Object);

            ChatMessage = ChatMessageBuilder
                          .Create()
                          .Build();

            Sut.Enable(MockedUserCommand1.Object.Name);

            var userCommandName = MockedUserCommand1.Object.Name;

            UserCommandArgs = new OnUserCommandReceivedArgs(ChatMessage, Array.Empty <String>());

            var userCommandArgs = UserCommandArgs;

            MockedUserCommandValidator
            .Setup(x => x.TryValidateCommand(ChatMessage, out userCommandName, out userCommandArgs))
            .Returns(true);

            MessageArgs = new OnMessageReceivedArgs()
            {
                ChatMessage = ChatMessage
            };

            MockedTwitchClient.Raise(x => x.OnMessageReceived += null, MessageArgs);
        }
예제 #3
0
        public void ShouldReturnSetting()
        {
            Sut.AddCommand(MockedSetting1.Object);
            Sut.AddCommand(MockedCommand.Object);

            Assert.Contains(MockedSetting1.Object, Sut.Settings.Disabled);
            Assert.Single(Sut.Settings.Disabled);
        }
예제 #4
0
 public WhenAllSettingsAreDisabled()
 {
     Sut
     .AddCommand(MockedSetting1.Object)
     .AddCommand(MockedSetting2.Object)
     .AddCommand(MockedSetting3.Object)
     .AddCommand(MockedCommand.Object);
 }
예제 #5
0
 public WhenGettingStatus()
 {
     Sut
     .AddCommand(MockedSetting2.Object)
     .AddCommand(MockedSetting1.Object)
     .AddCommand(MockedSetting3.Object)
     .AddCommand(MockedCommand.Object);
 }
예제 #6
0
        public WhenGettingProperty()
        {
            MockedSetting = new Mock <ISetting>().SetupAllProperties();
            MockedSetting
            .Setup(x => x.Name)
            .Returns(Name.From(Guid.NewGuid().ToString()));

            Sut.AddCommand(MockedSetting.Object);
        }
예제 #7
0
        public void ShouldAddUserCommand()
        {
            Sut.AddCommand(MockedUserCommand1.Object);

            Assert.Single(Sut.Commands);
            Assert.Equal(MockedUserCommand1.Object, Sut.Commands[MockedUserCommand1.Object.Name]);

            Assert.Single(Sut.Settings.Disabled);
            Assert.Contains(MockedUserCommand1.Object, Sut.Settings.Disabled);
            Assert.Contains(MockedUserCommand1.Object, Sut.UserCommands.Values);
            Assert.DoesNotContain(MockedUserCommand1.Object, Sut.Settings.Enabled);
        }
        public void ShouldDisableAllSettings()
        {
            Sut.AddCommand(MockedSetting1.Object);
            Sut.AddCommand(MockedCommand.Object);
            Sut.AddCommand(MockedSetting2.Object);

            Sut.Settings.Enable(MockedSetting1.Object.Name);

            Sut.DisableAllSettings();

            Assert.Empty(Sut.Settings.Enabled);
            Assert.Contains(MockedSetting1.Object, Sut.Settings.Disabled);
            Assert.Contains(MockedSetting2.Object, Sut.Settings.Disabled);
        }
예제 #9
0
 public WhenSettingProperty()
 {
     Sut.AddCommand(MockedSetting1.Object);
 }