<commit_before>﻿// 
// This file is part of - Castle Windsor Extensions
// Copyright (C) 2016 <NAME>
// 
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 2.1 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.
// 
// You should have received a copy of the GNU Lesser General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

using System.IO;
using Castle.Windsor.Extensions.Interpreters;
using Castle.Windsor.Extensions.SubSystems;
using Castle.Windsor.Extensions.Test.Helpers;
using Castle.Windsor.Extensions.Util;
using NUnit.Framework;

namespace Castle.Windsor.Extensions.Test
{
  /// <summary>
  ///   <see cref="PropertyResolvingWindsorContainer" /> unit tests
  /// </summary>
  [TestFixture]
  public class PropertyResolvingWindsorContainerTest
  {
    /// <summary>
    ///   Test that the constructor intiailises the properties sub system internally
    /// </summary>
    [Test]
    public void Ctor_Test()
    {
      // arrange
      EmbeddedResourceUtil.ExportToPath("Castle.Windsor.Extensions.Test.data", "castle.config", Path.GetTempPath());
      string path = Path.GetTempPath() + "\\castle.config";

      // act
      PropertyResolvingWindsorContainer container = new PropertyResolvingWindsorContainer(path);

      // assert
      Assert.IsInstanceOf<PropertiesInterpreter>(container.Interpreter);

      // get properties subsystem from kernel
      PropertiesSubSystem subsystem = container.Kernel.GetSubSystem<PropertiesSubSystem>(PropertiesSubSystem.SubSystemKey);

      // assert
      Assert.IsNotNull(subsystem);
      Assert.AreEqual("this is string", subsystem.Resolver.GetValue("strParam"));
    }

    /// <summary>
    ///   Test that the default constructor which initialises the properties subsystem from
    ///   the app.config/web.config file works as expected
    /// </summary>
    [Test]
    public void Ctor_With_No_Parameters_Test()
    {
      // act
      PropertyResolvingWindsorContainer container = new PropertyResolvingWindsorContainer();

      // assert
      Assert.IsInstanceOf<PropertiesInterpreter>(container.Interpreter);

      // get properties subsystem from kernel
      PropertiesSubSystem subsystem = container.Kernel.GetSubSystem<PropertiesSubSystem>(PropertiesSubSystem.SubSystemKey);
<commit_msg>More unit test updates.<commit_after>﻿// 
// This file is part of - Castle Windsor Extensions
// Copyright (C) 2016 <NAME>
// 
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 2.1 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.
// 
// You should have received a copy of the GNU Lesser General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

using System.IO;
using Castle.Windsor.Extensions.Interpreters;
using Castle.Windsor.Extensions.SubSystems;
using Castle.Windsor.Extensions.Test.Helpers;
using Castle.Windsor.Extensions.Util;
using NUnit.Framework;

namespace Castle.Windsor.Extensions.Test
{
  /// <summary>
  ///   <see cref="PropertyResolvingWindsorContainer" /> unit tests
  /// </summary>
  [TestFixture]
  public class PropertyResolvingWindsorContainerTest
  {
    /// <summary>
    ///   Test that the constructor intiailises the properties sub system internally
    /// </summary>
    [Test]
    public void Ctor_Test()
    {
      // arrange
      string path = EmbeddedResourceUtil.ExportToPath("Castle.Windsor.Extensions.Test.data", "castle.config", Path.GetTempPath());

      // act
      PropertyResolvingWindsorContainer container = new PropertyResolvingWindsorContainer(path);

      // assert
      Assert.IsInstanceOf<PropertiesInterpreter>(container.Interpreter);

      // get properties subsystem from kernel
      PropertiesSubSystem subsystem = container.Kernel.GetSubSystem<PropertiesSubSystem>(PropertiesSubSystem.SubSystemKey);

      // assert
      Assert.IsNotNull(subsystem);
      Assert.AreEqual("this is string", subsystem.Resolver.GetValue("strParam"));
    }

    /// <summary>
    ///   Test that the default constructor which initialises the properties subsystem from
    ///   the app.config/web.config file works as expected
    /// </summary>
    [Test]
    public void Ctor_With_No_Parameters_Test()
    {
      // act
      PropertyResolvingWindsorContainer container = new PropertyResolvingWindsorContainer();

      // assert
      Assert.IsInstanceOf<PropertiesInterpreter>(container.Interpreter);

      // get properties subsystem from kernel
      PropertiesSubSystem subsystem = container.Kernel.GetSubSystem<PropertiesSubSystem>(PropertiesSubSystem.SubSystemKey);

{'fraction_non_alphanumeric': 0.09477002967359051, 'fraction_numerical': 0.002225519287833828, 'mean_word_length': 3.4570247933884297, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5938536', 'n_tokens_mistral': 1429, 'n_tokens_neox': 1370, 'n_words': 445}