<commit_before>﻿using System;
using FluentAssertions;
using Shouldly;
using Xunit;

namespace Maestro.Tests.Factories
{
	public class type_instance_factory
	{
		[Fact]
		public void should_instantiate_type_without_dependencies()
		{
			var container = new Container(x => x.For<IZeroDependencies>().Use<ZeroDependencies>());
			container.Get<IZeroDependencies>();
		}

		[Fact]
		public void should_instantiate_type_with_dependencies()
		{
			var container = new Container(x =>
			{
				x.For<IZeroDependencies>().Use<ZeroDependencies>();
				x.For<IOneDependency>().Use<OneRequiredDependency>();
			});

			var instance = container.Get<IOneDependency>();

			instance.Dependency.ShouldNotBe(null);
		}

		[Fact]
		public void should_use_constructor_with_most_resolvable_dependencies()
		{
			var container = new Container(x =>
			{
				x.For<IZeroDependencies>().Use<ZeroDependencies>();
				x.For<IOneDependency>().Use<OneOptionalDependency>();
			});

			var instance = container.Get<IOneDependency>();

			instance.Dependency.ShouldNotBe(null);
		}

		[Fact]
		public void should_reevaluate_constructor_to_use_when_config_changes()
		{
			var container = new Container(x => x.For<IOneDependency>().Use<OneOptionalDependency>());
			var instance = container.Get<IOneDependency>();
			instance.Dependency.ShouldBe(null);

			container.Configure(x => x.For<IZeroDependencies>().Use<ZeroDependencies>());
			instance = container.Get<IOneDependency>();
			instance.Dependency.ShouldNotBe(null);
		}

		[Fact]
		public void should_instantiate_open_generic_type()
		{
			var container = new Container(x => x.For(typeof(IZeroDependencies<>)).Use(typeof(ZeroDependencies)));
			container.Get<IZeroDependencies<object>>();
		}
<commit_msg>added tests for TypeFactory<commit_after>﻿using System;
using Shouldly;
using Xunit;

namespace Maestro.Tests.Factories
{
	public class type_instance_factory
	{
		[Fact]
		public void should_instantiate_type_without_dependencies()
		{
			var container = new Container(x => x.For<IZeroDependencies>().Use<ZeroDependencies>());
			container.Get<IZeroDependencies>();
		}

		[Fact]
		public void should_instantiate_type_with_dependencies()
		{
			var container = new Container(x =>
			{
				x.For<IZeroDependencies>().Use<ZeroDependencies>();
				x.For<IOneDependency>().Use<OneRequiredDependency>();
			});

			var instance = container.Get<IOneDependency>();

			instance.Dependency.ShouldNotBe(null);
		}

		[Fact]
		public void should_use_constructor_with_most_resolvable_dependencies()
		{
			var container = new Container(x =>
			{
				x.For<IZeroDependencies>().Use<ZeroDependencies>();
				x.For<IOneDependency>().Use<OneOptionalDependency>();
			});

			var instance = container.Get<IOneDependency>();

			instance.Dependency.ShouldNotBe(null);
		}

		[Fact]
		public void should_reevaluate_constructor_to_use_when_config_changes()
		{
			var container = new Container(x => x.For<IOneDependency>().Use<OneOptionalDependency>());
			var instance = container.Get<IOneDependency>();
			instance.Dependency.ShouldBe(null);

			container.Configure(x => x.For<IZeroDependencies>().Use<ZeroDependencies>());
			instance = container.Get<IOneDependency>();
			instance.Dependency.ShouldNotBe(null);
		}

		[Fact]
		public void should_instantiate_open_generic_type()
		{
			var container = new Container(x => x.For(typeof(IZeroDependencies<>)).Use(typeof(ZeroDependencies)));
			container.Get<IZeroDependencies<object>>();
		}

		[Fact]
		public void should_use_specified_constructor()
		{
			throw new NotImplementedException();
		}

		[Fact]
		public void should_use_provided_dependency()
		{
			throw new NotImplementedException();
		}

{'fraction_non_alphanumeric': 0.13011456628477905, 'fraction_numerical': 0.0, 'mean_word_length': 5.257679180887372, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 59, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4735192', 'n_tokens_mistral': 1313, 'n_tokens_neox': 1099, 'n_words': 173}