Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mykolav committed Aug 25, 2020
1 parent 1e86130 commit 5379b99
Show file tree
Hide file tree
Showing 29 changed files with 137 additions and 226 deletions.
17 changes: 17 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
using System;
using FluentAssertions;
using ParameterizedAutoFactory.Tests.Support;
using ParameterizedAutoFactory.Tests.Support.InjectedTypes;
using ParameterizedAutoFactory.Unity4.Tests.Support;
using Xunit;
#if UNITY4_0_1
using Microsoft.Practices.Unity;
#elif UNITY5_X
using Unity;
#endif


namespace ParameterizedAutoFactory.Tests.Automatic_factory.Creates_instance.Of_type_with
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
using System;
using FluentAssertions;
using ParameterizedAutoFactory.Tests.Support;
using ParameterizedAutoFactory.Tests.Support.InjectedTypes;
using ParameterizedAutoFactory.Unity4.Tests.Support;
using Xunit;
#if UNITY4_0_1
using Microsoft.Practices.Unity;
#elif UNITY5_X
using Unity;
#endif


namespace ParameterizedAutoFactory.Tests.Automatic_factory.Creates_instance.Of_type_with
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
using System;
using FluentAssertions;
using ParameterizedAutoFactory.Tests.Support;
using ParameterizedAutoFactory.Tests.Support.InjectedTypes;
using ParameterizedAutoFactory.Unity4.Tests.Support;
using Xunit;
#if UNITY4_0_1
using Microsoft.Practices.Unity;
#elif UNITY5_X
using Unity;
#endif

namespace ParameterizedAutoFactory.Tests.Automatic_factory.Creates_instance.Of_type_with
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
using System;
using FluentAssertions;
using ParameterizedAutoFactory.Tests.Support;
using Microsoft.Practices.Unity;
using ParameterizedAutoFactory.Tests.Support.InjectedTypes;
using ParameterizedAutoFactory.Unity4.Tests.Support;
using Xunit;
#if UNITY4_0_1
using Microsoft.Practices.Unity;
#elif UNITY5_X
using Unity;
#endif

namespace ParameterizedAutoFactory.Tests.Automatic_factory.Creates_instance.When_null_supplied
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
using System;
using FluentAssertions;
using ParameterizedAutoFactory.Tests.Support;
using Microsoft.Practices.Unity;
using ParameterizedAutoFactory.Tests.Support.InjectedTypes;
using ParameterizedAutoFactory.Unity4.Tests.Support;
using Xunit;
#if UNITY4_0_1
using Microsoft.Practices.Unity;
#elif UNITY5_X
using Unity;
using Unity.Lifetime;
using Unity.Resolution;
#endif

namespace ParameterizedAutoFactory.Tests.Automatic_factory
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
using System;
using FluentAssertions;
using ParameterizedAutoFactory.Tests.Support;
using ParameterizedAutoFactory.Tests.Support.InjectedTypes;
using ParameterizedAutoFactory.Unity4.Tests.Support;
using Xunit;
#if UNITY4_0_1
using Microsoft.Practices.Unity;
#elif UNITY5_X
using Unity;
#endif

namespace ParameterizedAutoFactory.Tests.Automatic_factory.For_type_with
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
using System;
using FluentAssertions;
using ParameterizedAutoFactory.Tests.Support;
using ParameterizedAutoFactory.Tests.Support.InjectedTypes;
using ParameterizedAutoFactory.Unity4.Tests.Support;
using Xunit;
#if UNITY4_0_1
using Microsoft.Practices.Unity;
#elif UNITY5_X
using Unity;
using Unity.Exceptions;
#endif


namespace ParameterizedAutoFactory.Tests.Automatic_factory.For_type_with
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
using System;
using FluentAssertions;
using ParameterizedAutoFactory.Tests.Support;
using ParameterizedAutoFactory.Tests.Support.InjectedTypes;
using ParameterizedAutoFactory.Unity4.Tests.Support;
using Xunit;
#if UNITY4_0_1
using Microsoft.Practices.Unity;
#elif UNITY5_X
using Unity;
using Unity.Lifetime;
#endif

namespace ParameterizedAutoFactory.Tests.Automatic_factory
{
Expand Down Expand Up @@ -42,9 +37,7 @@ public void Creates_product_which_is_not_ReferenceEquals_with_product_of_autofac
container.RegisterType<TypeWithCtorWithTwoDependencyParams>(new HierarchicalLifetimeManager());

var childContainer = container.CreateChildContainer();
#if UNITY4_0_1
childContainer.AddParameterizedAutoFactoryExtension();
#endif

var autofactory0 = container.Resolve<Func<
TypeWithParameterlessCtor,
Expand Down
71 changes: 35 additions & 36 deletions ParameterizedAutoFactory.Unity4.Tests/Sandbox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
using FluentAssertions;
using Microsoft.Practices.Unity;
using ParameterizedAutoFactory.Unity;
using ParameterizedAutoFactory.Unity4;
using Xunit;

namespace ParameterizedAutoFactory.Tests
namespace ParameterizedAutoFactory.Unity4.Tests
{
public class Sandbox
{
Expand All @@ -14,22 +13,22 @@ public interface IUserListDataSource { }

public class UsersGridWindow
{
public UsersGridWindow(string windowTitle,
IUserListDataSource userListDataSource,
IDialogBoxService dialogBoxService)
{
WindowTitle = windowTitle;
UserListDataSource = userListDataSource;
DialogBoxService = dialogBoxService;

/* ... */
}

public string WindowTitle { get; }
public IUserListDataSource UserListDataSource { get; }
public IDialogBoxService DialogBoxService { get; }

/* ... */
public UsersGridWindow(string windowTitle,
IUserListDataSource userListDataSource,
IDialogBoxService dialogBoxService)
{
WindowTitle = windowTitle;
UserListDataSource = userListDataSource;
DialogBoxService = dialogBoxService;

/* ... */
}

public string WindowTitle { get; }
public IUserListDataSource UserListDataSource { get; }
public IDialogBoxService DialogBoxService { get; }

/* ... */
}

public class CachedUserListDataSource : IUserListDataSource
Expand Down Expand Up @@ -92,12 +91,12 @@ public Page(INavigationService navigationService, IPageDialogService pageDialogS
}

public class Frame
{
public Frame(Page page, INavigationService navigationService, IPageDialogService pageDialogService)
{
Page = page;
NavigationService = navigationService;
PageDialogService = pageDialogService;
{
public Frame(Page page, INavigationService navigationService, IPageDialogService pageDialogService)
{
Page = page;
NavigationService = navigationService;
PageDialogService = pageDialogService;
}

public Page Page { get; }
Expand All @@ -117,15 +116,15 @@ public void CanCreatePageUsingDependencyOverride()
var overriddenNavigationService = new NavigationService();
var overriddenPageDialogService = new PageDialogService();

var overrides = new ResolverOverride[]
{
var overrides = new ResolverOverride[]
{
new DependencyOverride(
typeof(INavigationService),
typeof(INavigationService),
overriddenNavigationService
).OnType<Frame>(),

new DependencyOverride(
typeof(IPageDialogService),
typeof(IPageDialogService),
overriddenPageDialogService
).OnType<Frame>(),
};
Expand Down Expand Up @@ -153,8 +152,8 @@ public void CanCreatePageUsingParameterByTypeOverride()
var overriddenNavigationService = new NavigationService();
var overriddenPageDialogService = new PageDialogService();

var overrides = new ResolverOverride[]
{
var overrides = new ResolverOverride[]
{
new ParameterByTypeOverride(
targetType: typeof(Frame),
parameterType: typeof(INavigationService),
Expand Down Expand Up @@ -193,12 +192,12 @@ public Frobnitz(Widget widget, Gadget gadget)
}

public class Gizmo
{
public Gizmo(Frobnitz frobnitz, Widget widget, Gadget gadget)
{
Frobnitz = frobnitz;
Widget = widget;
Gadget = gadget;
{
public Gizmo(Frobnitz frobnitz, Widget widget, Gadget gadget)
{
Frobnitz = frobnitz;
Widget = widget;
Gadget = gadget;
}

public Frobnitz Frobnitz { get; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
using ParameterizedAutoFactory.Unity;
#if UNITY4_0_1
using Microsoft.Practices.Unity;
using Microsoft.Practices.Unity;
using Microsoft.Practices.Unity.InterceptionExtension;
#elif UNITY5_X
using Unity;
using Unity.Interception;
#endif
using ParameterizedAutoFactory.Unity;

namespace ParameterizedAutoFactory.Tests.Support
namespace ParameterizedAutoFactory.Unity4.Tests.Support
{
internal class ContainerBuilder
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
#if UNITY4_0_1
using Microsoft.Practices.Unity;
using Microsoft.Practices.Unity.ObjectBuilder;
#elif UNITY5_X
using Unity;
using Unity.Builder;
using Unity.Extension;

#endif

namespace ParameterizedAutoFactory.Unity
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
using System;
using FluentAssertions;
using ParameterizedAutoFactory.Tests.Support;
using ParameterizedAutoFactory.Tests.Support.InjectedTypes;
using ParameterizedAutoFactory.Unity5.Tests.Support;
using Xunit;
#if UNITY4_0_1
using Microsoft.Practices.Unity;
#elif UNITY5_X
using Unity;
#endif


namespace ParameterizedAutoFactory.Tests.Automatic_factory.Creates_instance.Of_type_with
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
using System;
using FluentAssertions;
using ParameterizedAutoFactory.Tests.Support;
using ParameterizedAutoFactory.Tests.Support.InjectedTypes;
using ParameterizedAutoFactory.Unity5.Tests.Support;
using Xunit;
#if UNITY4_0_1
using Microsoft.Practices.Unity;
#elif UNITY5_X
using Unity;
#endif


namespace ParameterizedAutoFactory.Tests.Automatic_factory.Creates_instance.Of_type_with
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
using System;
using FluentAssertions;
using ParameterizedAutoFactory.Tests.Support;
using ParameterizedAutoFactory.Tests.Support.InjectedTypes;
using ParameterizedAutoFactory.Unity5.Tests.Support;
using Xunit;
#if UNITY4_0_1
using Microsoft.Practices.Unity;
#elif UNITY5_X
using Unity;
#endif

namespace ParameterizedAutoFactory.Tests.Automatic_factory.Creates_instance.Of_type_with
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
using System;
using FluentAssertions;
using ParameterizedAutoFactory.Tests.Support;
using ParameterizedAutoFactory.Tests.Support.InjectedTypes;
using ParameterizedAutoFactory.Unity5.Tests.Support;
using Xunit;
#if UNITY4_0_1
using Microsoft.Practices.Unity;
#elif UNITY5_X
using Unity;
#endif

namespace ParameterizedAutoFactory.Tests.Automatic_factory.Creates_instance.When_null_supplied
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
using System;
using FluentAssertions;
using ParameterizedAutoFactory.Tests.Support;
using ParameterizedAutoFactory.Tests.Support.InjectedTypes;
using ParameterizedAutoFactory.Unity5.Tests.Support;
using Xunit;
#if UNITY4_0_1
using Microsoft.Practices.Unity;
#elif UNITY5_X
using Unity;
using Unity.Lifetime;
using Unity.Resolution;
#endif

namespace ParameterizedAutoFactory.Tests.Automatic_factory
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
using System;
using FluentAssertions;
using ParameterizedAutoFactory.Tests.Support;
using ParameterizedAutoFactory.Tests.Support.InjectedTypes;
using ParameterizedAutoFactory.Unity5.Tests.Support;
using Xunit;
#if UNITY4_0_1
using Microsoft.Practices.Unity;
#elif UNITY5_X
using Unity;
#endif

namespace ParameterizedAutoFactory.Tests.Automatic_factory.For_type_with
{
Expand Down
Loading

0 comments on commit 5379b99

Please sign in to comment.