Esempio n. 1
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>();
                }
            }
        }
Esempio n. 2
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>();
                }
            }
        }