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.")); }
public void RegisterCommands_WhenInvokedWithInvalidData_DoesNotThrow() { Assert.DoesNotThrow( () => { systemUnderTest.RegisterCommands( MockCommandGenerator.GenerateCommandCollectionWithDuplicateSelectors()); }); }
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)); }