コード例 #1
0
        public void AddDataLoader_Services_ServicesIsNull()
        {
            // arrange
            // act
            Action action = () =>
                            DataLoaderServiceCollectionExtensions.AddDataLoader <TestDataLoader>(null);

            // assert
            Assert.Throws <ArgumentNullException>(action);
        }
コード例 #2
0
        public void AddDataLoader_ServicesFactory_FactoryIsNull()
        {
            // arrange
            var services = new ServiceCollection();

            // act
            Action action = () =>
                            DataLoaderServiceCollectionExtensions.AddDataLoader <TestDataLoader>(
                services, null);

            // assert
            Assert.Throws <ArgumentNullException>(action);
        }
コード例 #3
0
        public void AddDataLoader_Services()
        {
            // arrange
            var services = new ServiceCollection();

            // act
            DataLoaderServiceCollectionExtensions.AddDataLoader <TestDataLoader>(services);

            // assert
            services
            .Select(t => t.ServiceType.GetTypeName())
            .OrderBy(t => t)
            .ToArray()
            .MatchSnapshot();
        }
コード例 #4
0
        public void AddDataLoader_ServicesFactory_ServiceToImplementation_MultipleTimes()
        {
            // arrange
            var services = new ServiceCollection();

            // act
            DataLoaderServiceCollectionExtensions
            .AddDataLoader <ITestDataLoader, TestDataLoader>(services);
            DataLoaderServiceCollectionExtensions
            .AddDataLoader <ITestDataLoader, TestDataLoader>(services);
            DataLoaderServiceCollectionExtensions
            .AddDataLoader <ITestDataLoader, TestDataLoader>(services);

            // assert
            services
            .Select(t => t.ServiceType.GetTypeName())
            .OrderBy(t => t)
            .ToArray()
            .MatchSnapshot();
        }