<commit_before>﻿using Core;
using StructureMap;
using System;
using Xunit;

namespace Tests
{
    public class BasicConfigationTests
    {
        [Fact]
        public void NamedInstance()
        {
            ObjectFactory.Initialize(x =>
            {
                x.For<IService>().Use<Service>().Named("A");
                x.For<IService>().Use<ServiceB>().Named("B");
            });

            var service = ObjectFactory.GetNamedInstance<IService>("A");

            Assert.IsType<Service>(service);
        }<commit_msg>Add multiple named instances on same type test<commit_after>﻿using Core;
using StructureMap;
using System;
using Xunit;

namespace Tests
{
    public class BasicConfigationTests
    {
        [Fact]
        public void NamedInstance()
        {
            ObjectFactory.Initialize(x =>
            {
                x.For<IService>().Use<Service>().Named("A");
                x.For<IService>().Use<ServiceB>().Named("B");
            });

            var service = ObjectFactory.GetNamedInstance<IService>("A");

            Assert.IsType<Service>(service);
        }

        [Fact]
        public void GetInstanceT_MultipleNamedInstances_LastInWins()
        {
            ObjectFactory.Initialize(x =>
            {
                x.For<IService>().Use<Service>().Named("A");
                x.For<IService>().Use<ServiceB>().Named("B");
            });

            var service = ObjectFactory.GetInstance<IService>();

            Assert.IsType<ServiceB>(service);
        }
{'fraction_non_alphanumeric': 0.1324110671936759, 'fraction_numerical': 0.0, 'mean_word_length': 1.9726027397260273, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 24, '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': '7195613', 'n_tokens_mistral': 420, 'n_tokens_neox': 408, 'n_words': 66}