Skip to content

Commit

Permalink
Added XmlExtensions Unit Tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michel van Os committed Oct 13, 2016
1 parent df44e89 commit 55aa866
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
namespace MoreDotNet.Tests.Extensions.Common.XmlExtensions
{
using System;

using MoreDotNet.Extensions.Common;

using Xunit;

public class XmlExtensionsTests
{
[Fact]
public void XmlSerialize_GivenNullArgument_ShouldThrowException()
{
object testObject = null;

Assert.Throws<ArgumentNullException>(() => testObject.XmlSerialize());
}

[Fact]
public void XmlSerialize_GivenNonNullArgument_ShouldReturnSerialized()
{
object testObject = new object();

Assert.NotNull(testObject.XmlSerialize());
}

[Fact]
public void XmlDeserialize_GivenNullArgument_ShouldThrowException()
{
string testSerializedObject = null;

Assert.Throws<ArgumentNullException>(() => testSerializedObject.XmlDeserialize<object>());
}

[Fact]
public void XmlDeserialize_GivenNonNullArgument_ShouldReturnDeserialized()
{
object testObject = new object();
string testSerializedObject = testObject.XmlSerialize();

Assert.NotNull(testSerializedObject.XmlDeserialize<object>());
}
}
}
5 changes: 5 additions & 0 deletions Source/MoreDotNet.Test/MoreDotNet.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,13 @@
<CodeAnalysisRuleSet>MoreDotNet.Tests.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml" />
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
<Private>True</Private>
Expand Down Expand Up @@ -90,6 +94,7 @@
<Compile Include="Extensions\Common\StringExtensions\ToTitleCaseTests.cs" />
<Compile Include="Extensions\Common\StringExtensions\CaseToWordsTests.cs" />
<Compile Include="Extensions\Common\TypeExtensions\TypeExtensionsTests.cs" />
<Compile Include="Extensions\Common\XmlExtensions\XmlExtensionsTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Wrappers\CharWrappersTests.cs" />
<Compile Include="Wrappers\DecimalWrappersTests.cs" />
Expand Down

0 comments on commit 55aa866

Please # to comment.