コード例 #1
0
        public UsingCommandRepository()
        {
            MockedWriter = new();

            MockedTwitchClientManager = new();

            MockedUserCommandValidator = new();

            MockedCommandConfigurationStrategy = new();

            MockedTwitchClientManager.SetupAllProperties();

            MockedTwitchClient = MockedTwitchClientManager.SetupClient();

            MockedSetting1     = new();
            MockedSetting2     = new();
            MockedSetting3     = new();
            MockedCommand      = new();
            MockedUserCommand1 = new();
            MockedUserCommand2 = new();

            MockedSetting1.SetupAllProperties();
            MockedSetting2.SetupAllProperties();
            MockedSetting3.SetupAllProperties();
            MockedCommand.SetupAllProperties();
            MockedUserCommand1.SetupAllProperties();
            MockedUserCommand2.SetupAllProperties();

            MockedSetting1.Setup(x => x.Name).Returns(Name.From("s1"));
            MockedSetting2.Setup(x => x.Name).Returns(Name.From("s2"));
            MockedSetting3.Setup(x => x.Name).Returns(Name.From("s3"));
            MockedCommand.Setup(x => x.Name).Returns(Name.From("c"));
            MockedUserCommand1.Setup(x => x.Name).Returns(Name.From("uc1"));
            MockedUserCommand2.Setup(x => x.Name).Returns(Name.From("uc2"));

            MockedSetting1.Setup(x => x.Status).Returns("1");
            MockedSetting2.Setup(x => x.Status).Returns("2");
            MockedSetting3.Setup(x => x.Status).Returns("3");

            Sut = new CommandRepository(
                MockedWriter.Object,
                MockedTwitchClientManager.Object,
                MockedUserCommandValidator.Object,
                MockedCommandConfigurationStrategy.Object);
        }
コード例 #2
0
 public void ShouldInvokeRelevantUserCommand()
 {
     MockedUserCommand1.Verify(x => x.Invoke(Sut, UserCommandArgs), Times.Once());
     MockedUserCommand2.Verify(x => x.Invoke(Sut, UserCommandArgs), Times.Never());
 }