public void SupportedProductTypes_ShouldReturnConfiguredTypes() { // Arrange. var configuration = new ConfigurationBuilder().Build(); using (var target = new SimulatedInstrumentFactory(configuration)) { // Act. var supportedProductTypes = target.SupportedProductTypes; // Assert. supportedProductTypes.Should().Contain(typeof(PinnedStructureArray <Int16>)); supportedProductTypes.Should().Contain(typeof(CircularBuffer <Int32>)); } }
public void Produce_ShouldReturnNewObjectOfSpecifiedType_ForSupportedType() { // Arrange. var configuration = new ConfigurationBuilder().Build(); using (var target = new SimulatedInstrumentFactory(configuration)) { // Act. var result = target.Produce <CircularBuffer <Int32> >(); // Assert. result.Should().NotBeNull(); result.Should().BeOfType <CircularBuffer <Int32> >(); } }
public void Produce_ShouldRaiseArgumentException_ForUnsupportedType() { // Arrange. var configuration = new ConfigurationBuilder().Build(); using (var target = new SimulatedInstrumentFactory(configuration)) { // Act. var action = new Action(() => { target.Produce <ReferenceManager>(); }); // Assert. action.Should().Throw <ArgumentException>(); } }
public void Get_ShouldReturnValidInstance_ForSupportedTypes() { // Arrange. var configuration = new ConfigurationBuilder().Build(); using (var factory = new SimulatedInstrumentFactory(configuration)) { using (var target = new FactoryProducedInstanceGroup(factory)) { // Act. var result = target.Get <SimulatedInstrument>(); // Assert. result.Should().NotBeNull(); result.Should().BeOfType <SimulatedInstrument>(); } } }
public void Get_ShouldRaiseArgumentException_ForUnsupportedTypes() { // Arrange. var configuration = new ConfigurationBuilder().Build(); using (var factory = new SimulatedInstrumentFactory(configuration)) { using (var target = new FactoryProducedInstanceGroup(factory)) { // Act. var action = new Action(() => { target.Get <DateTimeRange>(); }); // Assert. action.Should().Throw <ArgumentException>(); } } }