Skip to content

Commit

Permalink
Merge branch 'hotfix/2.16.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
GeertvanHorrik committed Apr 26, 2017
2 parents 4452e36 + 0756f97 commit 4cc0007
Show file tree
Hide file tree
Showing 21 changed files with 416 additions and 33 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
188 changes: 188 additions & 0 deletions src/Catel.Fody.TestAssembly/Bugs/GH0008.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="GH0008.cs" company="Catel development team">
// Copyright (c) 2008 - 2017 Catel development team. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------


namespace Catel.Fody.TestAssembly
{
using Data;
using MVVM;
using Services;

public class GH0008 : ViewModelBase
{
private readonly IProcessService _processService;
private readonly IValidationContext _injectedValidationContext;

public GH0008(IProcessService processService)
{
Argument.IsNotNull(() => processService);

_processService = processService;

ExpandAll = new Command(OnExpandAllExecute);
CollapseAll = new Command(OnCollapseAllExecute);
Copy = new Command(OnCopyExecute, OnCopyCanExecute);
Open = new Command(OnOpenExecute);

InvalidateCommandsOnPropertyChanged = true;
}

public GH0008(ValidationContext validationContext, IProcessService processService)
: this(processService)
{
_injectedValidationContext = validationContext;
}

public bool IsExpandedAllOnStartup { get; set; }
public IValidationContext ValidationContext { get; set; }
public bool ShowErrors { get; set; } = true;
public bool ShowWarnings { get; set; } = true;
public bool IsExpanded { get; private set; }
public bool IsCollapsed => !IsExpanded;

#region Commands
public Command ExpandAll { get; }

private void OnExpandAllExecute()
{
}

public Command CollapseAll { get; }

private void OnCollapseAllExecute()
{
}

public Command Copy { get; }

private bool OnCopyCanExecute()
{
return true;
}

private void OnCopyExecute()
{

}

public Command Open { get; }

private void OnOpenExecute()
{

}
#endregion
}

public class GH0008_Expected : ViewModelBase
{
private readonly IProcessService _processService;
private readonly IValidationContext _injectedValidationContext;

public GH0008_Expected(IProcessService processService)
{
ShowErrors = true;
ShowWarnings = true;

Argument.IsNotNull("processService", processService);

_processService = processService;

ExpandAll = new Command(OnExpandAllExecute);
CollapseAll = new Command(OnCollapseAllExecute);
Copy = new Command(OnCopyExecute, OnCopyCanExecute);
Open = new Command(OnOpenExecute);

InvalidateCommandsOnPropertyChanged = true;
}

public GH0008_Expected(ValidationContext validationContext, IProcessService processService)
: this(processService)
{
_injectedValidationContext = validationContext;
}

public bool IsExpandedAllOnStartup
{
get { return GetValue<bool>(IsExpandedAllOnStartupProperty); }
set { SetValue(IsExpandedAllOnStartupProperty, value); }
}

public static readonly PropertyData IsExpandedAllOnStartupProperty = RegisterProperty("IsExpandedAllOnStartup", typeof(bool), false);


public IValidationContext ValidationContext
{
get { return GetValue<IValidationContext>(ValidationContextProperty); }
set { SetValue(ValidationContextProperty, value); }
}

public static readonly PropertyData ValidationContextProperty = RegisterProperty("ValidationContext", typeof(IValidationContext), null);


public bool ShowErrors
{
get { return GetValue<bool>(ShowErrorsProperty); }
set { SetValue(ShowErrorsProperty, value); }
}

public static readonly PropertyData ShowErrorsProperty = RegisterProperty("ShowErrors", typeof(bool), true);


public bool ShowWarnings
{
get { return GetValue<bool>(ShowWarningsProperty); }
set { SetValue(ShowWarningsProperty, value); }
}

public static readonly PropertyData ShowWarningsProperty = RegisterProperty("ShowWarnings", typeof(bool), true);


public bool IsExpanded
{
get { return GetValue<bool>(IsExpandedProperty); }
private set { SetValue(IsExpandedProperty, value); }
}

public static readonly PropertyData IsExpandedProperty = RegisterProperty("IsExpanded", typeof(bool), false);


public bool IsCollapsed => !IsExpanded;

#region Commands
public Command ExpandAll { get; }

private void OnExpandAllExecute()
{
}

public Command CollapseAll { get; }

private void OnCollapseAllExecute()
{
}

public Command Copy { get; }

private bool OnCopyCanExecute()
{
return true;
}

private void OnCopyExecute()
{

}

public Command Open { get; }

private void OnOpenExecute()
{

}
#endregion
}
}
19 changes: 18 additions & 1 deletion src/Catel.Fody.TestAssembly/CSharp6.AutoPropertyInitializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,23 @@ public class CSharp6_AutoPropertyInitializer : ModelBase
#endregion
}

public class CSharp6_AutoPropertyInitializerWithMultipleConstructors : ModelBase
{
public CSharp6_AutoPropertyInitializerWithMultipleConstructors()
{

}

public CSharp6_AutoPropertyInitializerWithMultipleConstructors(int someValue)
{

}

#region Properties
public bool ShowErrors { get; set; } = true;
#endregion
}

public class CSharp6_AutoPropertyInitializer_Generic<T> : ModelBase
{
public CSharp6_AutoPropertyInitializer_Generic()
Expand Down Expand Up @@ -57,7 +74,7 @@ public CSharp6_AutoPropertyInitializer_ExpectedCode()
}

[NoWeaving]
public class CSharp6_AutoPropertyInitializer_Generic_ExpectedCode<T>
public class CSharp6_AutoPropertyInitializer_Generic_ExpectedCode<T> : ModelBase
{
public CSharp6_AutoPropertyInitializer_Generic_ExpectedCode()
{
Expand Down
9 changes: 5 additions & 4 deletions src/Catel.Fody.TestAssembly/Catel.Fody.TestAssembly.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,12 @@
<ItemGroup>
<Compile Include="ArgumentChecksAsExpressionsClass.cs" />
<Compile Include="ArgumentChecksClass.cs" />
<Compile Include="Bugs\GH0008.cs" />
<Compile Include="CSharp6.AutoPropertyInitializer.cs" />
<Compile Include="CTL504.cs" />
<Compile Include="CTL569.cs" />
<Compile Include="CTL768.cs" />
<Compile Include="CTL908.cs" />
<Compile Include="Bugs\CTL504.cs" />
<Compile Include="Bugs\CTL569.cs" />
<Compile Include="Bugs\CTL768.cs" />
<Compile Include="Bugs\CTL908.cs" />
<Compile Include="DependentPropertyModel.cs" />
<Compile Include="GenericModel.cs" />
<Compile Include="LoggingClass.cs" />
Expand Down
9 changes: 9 additions & 0 deletions src/Catel.Fody.Tests/CSharp6Facts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ public void AutoPropertyInitializer()
Assert.IsNotNull(obj.SimpleModels);
}

[TestCase]
public void AutoPropertyInitializerWithMultipleConstructors()
{
var type = AssemblyWeaver.Instance.Assembly.GetType("Catel.Fody.TestAssembly.CSharp6_AutoPropertyInitializerWithMultipleConstructors");
var obj = (dynamic)Activator.CreateInstance(type);

Assert.IsTrue(obj.ShowErrors);
}

[TestCase]
public void AutoPropertyInitializer_Generic()
{
Expand Down
21 changes: 13 additions & 8 deletions src/Catel.Fody.Tests/Catel.Fody.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,20 @@
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Mono.Cecil, Version=0.10.0.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
<HintPath>..\..\lib\FodyCecil.2.0.2\lib\net40\Mono.Cecil.dll</HintPath>
<HintPath>..\..\lib\FodyCecil.2.0.5\lib\net40\Mono.Cecil.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Mono.Cecil.Mdb, Version=0.10.0.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
<HintPath>..\..\lib\FodyCecil.2.0.2\lib\net40\Mono.Cecil.Mdb.dll</HintPath>
<HintPath>..\..\lib\FodyCecil.2.0.5\lib\net40\Mono.Cecil.Mdb.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Mono.Cecil.Pdb, Version=0.10.0.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
<HintPath>..\..\lib\FodyCecil.2.0.2\lib\net40\Mono.Cecil.Pdb.dll</HintPath>
<HintPath>..\..\lib\FodyCecil.2.0.5\lib\net40\Mono.Cecil.Pdb.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Mono.Cecil.Rocks, Version=0.10.0.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
<HintPath>..\..\lib\FodyCecil.2.0.2\lib\net40\Mono.Cecil.Rocks.dll</HintPath>
<HintPath>..\..\lib\FodyCecil.2.0.5\lib\net40\Mono.Cecil.Rocks.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<HintPath>..\..\lib\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
Expand All @@ -82,10 +86,11 @@
<Compile Include="AssemblyWeaver.cs" />
<Compile Include="ConfigurationFacts.cs" />
<Compile Include="CSharp6Facts.cs" />
<Compile Include="CTL504.cs" />
<Compile Include="CTL569.cs" />
<Compile Include="CTL768.cs" />
<Compile Include="CTL908.cs" />
<Compile Include="Repros\CTL504.cs" />
<Compile Include="Repros\CTL569.cs" />
<Compile Include="Repros\CTL768.cs" />
<Compile Include="Repros\GH0008.cs" />
<Compile Include="Repros\CTL908.cs" />
<Compile Include="DefaultValueFacts.cs" />
<Compile Include="DependentPropertyFacts.cs" />
<Compile Include="ExposeFacts.cs" />
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
39 changes: 39 additions & 0 deletions src/Catel.Fody.Tests/Repros/GH0008.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="CTL908.cs" company="Catel development team">
// Copyright (c) 2008 - 2016 Catel development team. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------


namespace Catel.Fody.Tests
{
using System;
using System.ComponentModel;
using Catel.Services;
using Data;
using NUnit.Framework;

[TestFixture]
public class GH0008TestFixture
{
[TestCase]
public void WeavingConstructorWithValidationContext()
{
var type = AssemblyWeaver.Instance.Assembly.GetType("Catel.Fody.TestAssembly.GH0008");

var model = Activator.CreateInstance(type, new object[] { new ValidationContext(), new ProcessService() });

Assert.IsNotNull(model);
}

[TestCase]
public void WeavingConstructorWithoutValidationContext()
{
var type = AssemblyWeaver.Instance.Assembly.GetType("Catel.Fody.TestAssembly.GH0008");

var model = Activator.CreateInstance(type, new object[] { new ProcessService() });

Assert.IsNotNull(model);
}
}
}
2 changes: 1 addition & 1 deletion src/Catel.Fody.Tests/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<packages>
<package id="Catel.Core" version="4.5.4" targetFramework="net45" />
<package id="Catel.MVVM" version="4.5.4" targetFramework="net45" />
<package id="FodyCecil" version="2.0.2" targetFramework="net45" developmentDependency="true" />
<package id="FodyCecil" version="2.0.5" targetFramework="net45" developmentDependency="true" />
<package id="NUnit" version="2.6.4" targetFramework="net45" />
</packages>
12 changes: 8 additions & 4 deletions src/Catel.Fody/Catel.Fody.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,20 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Mono.Cecil, Version=0.10.0.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
<HintPath>..\..\lib\FodyCecil.2.0.2\lib\net40\Mono.Cecil.dll</HintPath>
<HintPath>..\..\lib\FodyCecil.2.0.5\lib\net40\Mono.Cecil.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Mono.Cecil.Mdb, Version=0.10.0.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
<HintPath>..\..\lib\FodyCecil.2.0.2\lib\net40\Mono.Cecil.Mdb.dll</HintPath>
<HintPath>..\..\lib\FodyCecil.2.0.5\lib\net40\Mono.Cecil.Mdb.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Mono.Cecil.Pdb, Version=0.10.0.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
<HintPath>..\..\lib\FodyCecil.2.0.2\lib\net40\Mono.Cecil.Pdb.dll</HintPath>
<HintPath>..\..\lib\FodyCecil.2.0.5\lib\net40\Mono.Cecil.Pdb.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Mono.Cecil.Rocks, Version=0.10.0.0, Culture=neutral, PublicKeyToken=50cebf1cceb9d05e, processorArchitecture=MSIL">
<HintPath>..\..\lib\FodyCecil.2.0.2\lib\net40\Mono.Cecil.Rocks.dll</HintPath>
<HintPath>..\..\lib\FodyCecil.2.0.5\lib\net40\Mono.Cecil.Rocks.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down
Loading

0 comments on commit 4cc0007

Please sign in to comment.