Esempio n. 1
0
        public void GetNamedClient_WithWrongName_GetNull()
        {
            var deliveryClientFactoryOptions = new DeliveryClientFactoryOptions();

            deliveryClientFactoryOptions.DeliveryClientsOptions.Add(() => _deliveryOptionsMock.Value);

            A.CallTo(() => _deliveryClientFactoryOptionsMock.Get(_clientName))
            .Returns(deliveryClientFactoryOptions);

            var deliveryClientFactory = new Delivery.DeliveryClientFactory(_deliveryClientFactoryOptionsMock, _serviceProvider);

            var result = deliveryClientFactory.Get("WrongName");

            result.Should().BeNull();
        }
        public void GetNamedClient_WithCorrectName_GetClient()
        {
            var deliveryClient = new DeliveryClient(_deliveryOptionsMock);
            var deliveryClientFactoryOptions = new DeliveryClientFactoryOptions();

            deliveryClientFactoryOptions.DeliveryClientsActions.Add(() => deliveryClient);

            A.CallTo(() => _deliveryClientFactoryOptionsMock.Get(_clientName))
            .Returns(deliveryClientFactoryOptions);

            var deliveryClientFactory = new Delivery.DeliveryClientFactory(_deliveryClientFactoryOptionsMock, _serviceProviderMock);

            var result = deliveryClientFactory.Get(_clientName);

            result.Should().Be(deliveryClient);
        }