Example #1
0
        public void Command_type_can_be_found_by_its_descriptor(MessageDescriptorStore sut)
        {
            var descriptor = new MessageDescriptor(typeof(FirstTestCommand));

            sut.RegisterCommandType <FirstTestCommand>();

            var isFound = sut.FindCommandTypeForDescriptor(descriptor, out var typeFound);

            Assert.That(isFound, Is.True);
            Assert.That(typeFound, Is.EqualTo(typeof(FirstTestCommand)).Using <Type>((first, second) => string.Equals(first.FullName, second.FullName, StringComparison.OrdinalIgnoreCase)));
        }
Example #2
0
        public void Same_command_type_wont_be_registered_twice(MessageDescriptorStore sut)
        {
            Assume.That(sut.RegisterCommandType <FirstTestCommand>(), Is.True);

            Assert.That(sut.RegisterCommandType <FirstTestCommand>(), Is.False);
        }