示例#1
0
        public void GetAll_returns_expected_when_empty()
        {
            var sut    = new DefaultCommandRegistry();
            var result = sut.GetAll();

            Assert.Empty(result);
        }
示例#2
0
        public void registers_with_expected_command_name(Type commandType, string expectedCommandName)
        {
            var sut = new DefaultCommandRegistry();

            sut.Register(commandType);

            var result = sut.GetAll().Single();

            Assert.Equal(expectedCommandName, result.CommandName);
        }
示例#3
0
        public void favor_command_name_from_class_annotation()
        {
            var sut = new DefaultCommandRegistry();

            sut.Register(typeof(NamedByClassAnnotationCommand));

            var result = sut.GetAll().Single();

            Assert.Equal("foo", result.CommandName);
        }
示例#4
0
        public void GetAll_returns_expected_when_single_command_is_added()
        {
            var sut = new DefaultCommandRegistry();

            sut.Register(typeof(FooCommand));

            var result = sut
                         .GetAll()
                         .Select(x => x.ImplementationType)
                         .ToArray();

            Assert.Equal(new[] { typeof(FooCommand) }, result);
        }
示例#5
0
        public void can_add_multiple_commands_at_once()
        {
            var sut = new DefaultCommandRegistry();

            sut.Register(new[]
            {
                typeof(FooCommand),
                typeof(BarCommand),
            });

            var result = sut
                         .GetAll()
                         .Select(x => x.ImplementationType)
                         .ToArray();

            Assert.Equal(new[]
            {
                typeof(FooCommand),
                typeof(BarCommand),
            }, result);
        }