Example #1
0
        public void AreDependenciesRegistered()
        {
            ExecWithRetriesForNuGetPush task = new ExecWithRetriesForNuGetPush();

            var collection = new ServiceCollection();

            task.ConfigureServices(collection);
            var provider = collection.BuildServiceProvider();

            foreach (var dependency in task.GetExecuteParameterTypes())
            {
                var service = provider.GetRequiredService(dependency);
                service.Should().NotBeNull();
            }

            DependencyInjectionValidation.IsDependencyResolutionCoherent(
                s =>
            {
                task.ConfigureServices(s);
            },
                out string message
                )
            .Should()
            .BeTrue(message);
        }
Example #2
0
        public void AreDependenciesRegistered()
        {
            ExecWithRetriesForNuGetPush task = new ExecWithRetriesForNuGetPush();

            var collection = new ServiceCollection();

            task.ConfigureServices(collection);
            var provider = collection.BuildServiceProvider();

            DependencyInjectionValidation.IsDependencyResolutionCoherent(
                s =>
            {
                task.ConfigureServices(s);
            },
                out string message,
                additionalSingletonTypes: task.GetExecuteParameterTypes()
                )
            .Should()
            .BeTrue(message);
        }