Skip to content
This repository was archived by the owner on Dec 1, 2021. It is now read-only.

Commit 993bede

Browse files
author
jacek_socialcee_com
committed
Initial commit
1 parent 652cb87 commit 993bede

File tree

75 files changed

+5143
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+5143
-0
lines changed

.gitattributes

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
###############################################################################
2+
# Set default behavior to automatically normalize line endings.
3+
###############################################################################
4+
* text=auto
5+
6+
###############################################################################
7+
# Set default behavior for command prompt diff.
8+
#
9+
# This is need for earlier builds of msysgit that does not have it on by
10+
# default for csharp files.
11+
# Note: This is only used by command line
12+
###############################################################################
13+
#*.cs diff=csharp
14+
15+
###############################################################################
16+
# Set the merge driver for project and solution files
17+
#
18+
# Merging from the command prompt will add diff markers to the files if there
19+
# are conflicts (Merging from VS is not affected by the settings below, in VS
20+
# the diff markers are never inserted). Diff markers may cause the following
21+
# file extensions to fail to load in VS. An alternative would be to treat
22+
# these files as binary and thus will always conflict and require user
23+
# intervention with every merge. To do so, just uncomment the entries below
24+
###############################################################################
25+
#*.sln merge=binary
26+
#*.csproj merge=binary
27+
#*.vbproj merge=binary
28+
#*.vcxproj merge=binary
29+
#*.vcproj merge=binary
30+
#*.dbproj merge=binary
31+
#*.fsproj merge=binary
32+
#*.lsproj merge=binary
33+
#*.wixproj merge=binary
34+
#*.modelproj merge=binary
35+
#*.sqlproj merge=binary
36+
#*.wwaproj merge=binary
37+
38+
###############################################################################
39+
# behavior for image files
40+
#
41+
# image files are treated as binary by default.
42+
###############################################################################
43+
#*.jpg binary
44+
#*.png binary
45+
#*.gif binary
46+
47+
###############################################################################
48+
# diff behavior for common document formats
49+
#
50+
# Convert binary document formats to text before diffing them. This feature
51+
# is only available from the command line. Turn it on by uncommenting the
52+
# entries below.
53+
###############################################################################
54+
#*.doc diff=astextplain
55+
#*.DOC diff=astextplain
56+
#*.docx diff=astextplain
57+
#*.DOCX diff=astextplain
58+
#*.dot diff=astextplain
59+
#*.DOT diff=astextplain
60+
#*.pdf diff=astextplain
61+
#*.PDF diff=astextplain
62+
#*.rtf diff=astextplain
63+
#*.RTF diff=astextplain

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,3 +194,4 @@ FakesAssemblies/
194194

195195
# Visual Studio 6 workspace options file
196196
*.opt
197+
/NJsonApi.sln.ide
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
using System.Collections.Generic;
2+
using Microsoft.VisualStudio.TestTools.UnitTesting;
3+
using NJsonApi.Common.Infrastructure;
4+
using SoftwareApproach.TestingExtensions;
5+
6+
namespace SocialCee.Framework.Common.Test.Infrastructure
7+
{
8+
[TestClass]
9+
public class DeltaTest
10+
{
11+
[TestMethod]
12+
public void SimpleTestOfFunction()
13+
{
14+
//Arange
15+
var simpleObject = new SimpleTestClass();
16+
var classUnderTest = new Delta<SimpleTestClass>();
17+
18+
classUnderTest.AddFilter(t => t.Prop1NotIncluded);
19+
classUnderTest.ObjectPropertyValues = new Dictionary<string, object>()
20+
{
21+
{"Prop2","b"}
22+
};
23+
//Act
24+
classUnderTest.Apply(simpleObject);
25+
//Assert
26+
simpleObject.Prop2.ShouldNotBeNull();
27+
simpleObject.Prop2.ShouldEqual("b");
28+
simpleObject.Prop1NotIncluded.ShouldBeNull();
29+
}
30+
31+
[TestMethod]
32+
public void TestNotIncludedProperties()
33+
{
34+
//Arrange
35+
var simpleObject = new SimpleTestClass();
36+
var objectUnderTest = new Delta<SimpleTestClass>();
37+
38+
objectUnderTest.AddFilter(t => t.Prop1NotIncluded);
39+
objectUnderTest.ObjectPropertyValues = new Dictionary<string, object>()
40+
{
41+
{"Prop2","b"},
42+
{"Prop1NotIncluded",5}
43+
};
44+
//Act
45+
objectUnderTest.Apply(simpleObject);
46+
//Assert
47+
simpleObject.Prop2.ShouldNotBeNull();
48+
simpleObject.Prop2.ShouldEqual("b");
49+
simpleObject.Prop1NotIncluded.ShouldBeNull();
50+
}
51+
52+
[TestMethod]
53+
public void TestEmptyPropertiesValues()
54+
{
55+
//Arrange
56+
var simpleObject = new SimpleTestClass();
57+
var objectUnderTest = new Delta<SimpleTestClass>();
58+
//Act
59+
objectUnderTest.AddFilter(t => t.Prop1NotIncluded);
60+
objectUnderTest.Apply(simpleObject);
61+
//Assert
62+
simpleObject.Prop1NotIncluded.ShouldBeNull();
63+
simpleObject.Prop1.ShouldBeNull();
64+
simpleObject.Prop2.ShouldBeNull();
65+
}
66+
}
67+
68+
public class SimpleTestClass
69+
{
70+
public string Prop1 { get; set; }
71+
public string Prop2 { get; set; }
72+
public int? Prop1NotIncluded { get; set; }
73+
}
74+
public class SecondSimpleTestClass
75+
{
76+
public string Prop1 { get; set; }
77+
public string Prop2 { get; set; }
78+
public int Prop1NotIncluded { get; set; }
79+
}
80+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using System.Collections.Generic;
2+
using Microsoft.VisualStudio.TestTools.UnitTesting;
3+
using NJsonApi.Common.Infrastructure;
4+
using SoftwareApproach.TestingExtensions;
5+
6+
namespace SocialCee.Framework.Common.Test.Infrastructure
7+
{
8+
[TestClass]
9+
public class MetadataWrapperTest
10+
{
11+
[TestMethod]
12+
public void MetadataWrapper_using_ctor_string_ok()
13+
{
14+
// Arrange
15+
const string testString = "Test String";
16+
17+
// Act
18+
var sut = new MetaDataWrapper<string>(testString);
19+
20+
// Assert
21+
sut.Value.ShouldEqual(testString);
22+
sut.MetaData.ShouldBeEmpty();
23+
}
24+
25+
[TestMethod]
26+
public void MetadataWrapper_add_result_collection_ok()
27+
{
28+
// Arrange
29+
var testsStrings = new List<string>(){ "test1", "test2" };
30+
31+
// Act
32+
var sut = new MetaDataWrapper<List<string>>(testsStrings);
33+
34+
// Assert
35+
sut.MetaData.ShouldBeEmpty();
36+
sut.Value.ShouldEqual(testsStrings);
37+
}
38+
}
39+
}
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProjectGuid>{346A3785-EB5B-43C0-9C0C-ADF5A22BC8E2}</ProjectGuid>
7+
<OutputType>Library</OutputType>
8+
<AppDesignerFolder>Properties</AppDesignerFolder>
9+
<RootNamespace>SocialCee.Framework.Common.Test</RootNamespace>
10+
<AssemblyName>SocialCee.Framework.Common.Test</AssemblyName>
11+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
14+
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
15+
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
16+
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
17+
<IsCodedUITest>False</IsCodedUITest>
18+
<TestProjectType>UnitTest</TestProjectType>
19+
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
20+
</PropertyGroup>
21+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
22+
<DebugSymbols>true</DebugSymbols>
23+
<DebugType>full</DebugType>
24+
<Optimize>false</Optimize>
25+
<OutputPath>bin\Debug\</OutputPath>
26+
<DefineConstants>DEBUG;TRACE</DefineConstants>
27+
<ErrorReport>prompt</ErrorReport>
28+
<WarningLevel>4</WarningLevel>
29+
</PropertyGroup>
30+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
31+
<DebugType>pdbonly</DebugType>
32+
<Optimize>true</Optimize>
33+
<OutputPath>bin\Release\</OutputPath>
34+
<DefineConstants>TRACE</DefineConstants>
35+
<ErrorReport>prompt</ErrorReport>
36+
<WarningLevel>4</WarningLevel>
37+
</PropertyGroup>
38+
<ItemGroup>
39+
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
40+
<Reference Include="SoftwareApproach.TestingExtensions">
41+
<HintPath>..\packages\VisualStudioTestingExtensions.1.2.0.0\lib\net40\SoftwareApproach.TestingExtensions.dll</HintPath>
42+
</Reference>
43+
<Reference Include="System" />
44+
</ItemGroup>
45+
<Choose>
46+
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
47+
<ItemGroup>
48+
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
49+
</ItemGroup>
50+
</When>
51+
<Otherwise />
52+
</Choose>
53+
<ItemGroup>
54+
<Compile Include="Infrastructure\DeltaTest.cs" />
55+
<Compile Include="Infrastructure\MetadataWrapperTest.cs" />
56+
<Compile Include="Properties\AssemblyInfo.cs" />
57+
</ItemGroup>
58+
<ItemGroup>
59+
<ProjectReference Include="..\NJsonApi.Common\NJsonApi.Common.csproj">
60+
<Project>{59e4c7f0-daa5-462c-bab2-6bd36787d122}</Project>
61+
<Name>NJsonApi.Common</Name>
62+
</ProjectReference>
63+
</ItemGroup>
64+
<ItemGroup>
65+
<None Include="packages.config" />
66+
</ItemGroup>
67+
<Choose>
68+
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
69+
<ItemGroup>
70+
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
71+
<Private>False</Private>
72+
</Reference>
73+
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
74+
<Private>False</Private>
75+
</Reference>
76+
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
77+
<Private>False</Private>
78+
</Reference>
79+
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
80+
<Private>False</Private>
81+
</Reference>
82+
</ItemGroup>
83+
</When>
84+
</Choose>
85+
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
86+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
87+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
88+
Other similar extension points exist, see Microsoft.Common.targets.
89+
<Target Name="BeforeBuild">
90+
</Target>
91+
<Target Name="AfterBuild">
92+
</Target>
93+
-->
94+
</Project>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("SocialCee.Framework.Common.Test")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("SocialCee.Framework.Common.Test")]
13+
[assembly: AssemblyCopyright("Copyright © 2014")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("e34905a4-50c4-4163-bfa9-f4dd1b3b0e5d")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="VisualStudioTestingExtensions" version="1.2.0.0" targetFramework="net45" />
4+
</packages>

0 commit comments

Comments
 (0)