forked from omaxel/SimplePatch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for child class patch.
- Loading branch information
Showing
10 changed files
with
95 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace SimplePatch.Tests | ||
{ | ||
[TestClass, TestCategory(TestCategories.ClassInheritance)] | ||
public class ClassInheritTests : TestBase | ||
{ | ||
[ClassInitialize] | ||
public static void ClassInit(TestContext context) | ||
{ | ||
DeltaConfig.Init(cfg => cfg.AddEntity<PersonExtended>()); | ||
} | ||
|
||
[ClassCleanup] | ||
public static void ClassCleanup() | ||
{ | ||
DeltaConfig.Clean(); | ||
} | ||
|
||
private class PersonExtended : Person | ||
{ | ||
public string Address { get; set; } | ||
} | ||
|
||
[TestMethod] | ||
public void TestMethod() | ||
{ | ||
const string name = "John"; | ||
const string surname = "Doe"; | ||
const string address = "Person address"; | ||
|
||
var johnExtended = new PersonExtended(); | ||
|
||
var delta = new Delta<PersonExtended>(); | ||
delta.Add(x => x.Name, name); | ||
delta.Add(x => x.Surname, surname); | ||
delta.Add(x => x.Address, address); | ||
delta.Patch(johnExtended); | ||
|
||
Assert.AreEqual(name, johnExtended.Name); | ||
Assert.AreEqual(surname, johnExtended.Surname); | ||
Assert.AreEqual(address, johnExtended.Address); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,33 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>net451;netstandard1.4</TargetFrameworks> | ||
<Version>3.0.0</Version> | ||
<TargetFrameworks>net461;netstandard1.4</TargetFrameworks> | ||
<Version>3.0.1</Version> | ||
<Authors>Omar Muscatello</Authors> | ||
<Company>Omar Muscatello</Company> | ||
<Description>A simple library for partial entity changes in ASP.NET and ASP.NET Core.</Description> | ||
<Copyright>Copyright (c) Omar Muscatello 2018</Copyright> | ||
<PackageLicenseUrl>https://github.com/OmarMuscatello/SimplePatch/blob/master/LICENSE</PackageLicenseUrl> | ||
<PackageReleaseNotes>* Break change: All entities types which is used in Delta<T> or DeltaCollection<T> must be declared in DeltaConfig.Init(). | ||
* Break change: excluded property and 'ignore null value' option must be declared in DeltaConfig.Init(). | ||
* Added global and properties mapping functions. | ||
* Added support to add property using expressions in Delta<T>.Add method. | ||
* Added unit tests.</PackageReleaseNotes> | ||
<PackageReleaseNotes>* Added support for child class patch.</PackageReleaseNotes> | ||
<PackageProjectUrl>https://github.com/OmarMuscatello/SimplePatch</PackageProjectUrl> | ||
<RepositoryUrl>https://github.com/OmarMuscatello/SimplePatch</RepositoryUrl> | ||
<PackageIconUrl>http://raw.github.com/OmarMuscatello/SimplePatch/master/simplepatch-icon.png</PackageIconUrl> | ||
<RepositoryType></RepositoryType> | ||
<PackageTags>patch http-patch partial-entity-changes web-api asp-net-web-api entity-framework entity-framework-core asp-net asp-net-core</PackageTags> | ||
<ApplicationIcon></ApplicationIcon> | ||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> | ||
<AssemblyVersion>3.0.0.0</AssemblyVersion> | ||
<FileVersion>3.0.0.0</FileVersion> | ||
<AssemblyVersion>3.0.1.0</AssemblyVersion> | ||
<FileVersion>3.0.1.0</FileVersion> | ||
</PropertyGroup> | ||
|
||
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.4'"> | ||
<PackageReference Include="System.Reflection.TypeExtensions"> | ||
<Version>4.5.1</Version> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.5.1" /> | ||
</ItemGroup> | ||
|
||
</Project> |