示例#1
0
        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>));
            }
        }
示例#2
0
        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> >();
            }
        }
示例#3
0
        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>();
            }
        }
示例#4
0
        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>();
                }
            }
        }
示例#5
0
        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>();
                }
            }
        }