Esempio n. 1
0
 public void Load_WhenInvokedWithDuplicateSelectors_Throws()
 {
     Assert.That(
         () => { systemUnderTest.Load(MockCommandGenerator.GenerateCommandCollectionWithDuplicateSelectors()); },
         Throws.InstanceOf <DuplicateCommandSelectorException>().With.Message
         .EqualTo("Cannot add 'T'. Command Selector values must be unique."));
 }
Esempio n. 2
0
 public void RegisterCommands_WhenInvokedWithInvalidData_DoesNotThrow()
 {
     Assert.DoesNotThrow(
         () =>
     {
         systemUnderTest.RegisterCommands(
             MockCommandGenerator.GenerateCommandCollectionWithDuplicateSelectors());
     });
 }
Esempio n. 3
0
        public void RegisterCommands_WhenInvokedWithInvalidData_FiresErrorEventResetsStatus()
        {
            var       invalidCommands = MockCommandGenerator.GenerateCommandCollectionWithDuplicateSelectors();
            var       sourceError     = new Exception("Test Exception");
            Exception actualError     = null;

            systemUnderTest.CommandRegistrationError += (sender, args) => { actualError = args.Exception; };
            commandRepositoryMock.When(x => x.Load(invalidCommands)).Do(x => throw sourceError);

            systemUnderTest.RegisterCommands(invalidCommands);

            Assert.AreSame(actualError, sourceError);
            Assert.That(systemUnderTest.Status, Is.EqualTo(CommandLineStatus.WaitingForCommandRegistration));
        }