Пример #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);
        }