Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Passing Tests for Documentation Examples #322

Merged
merged 6 commits into from
Nov 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ExtendedXmlSerializer addresses a lot of these problems and much much more!
- Property encryption
- Support `XmlElementAttribute`, `XmlRootAttribute`, and `XmlTypeAttribute` for identity resolution
- Additional attribute support: `XmlIgnoreAttribute`, `XmlAttributeAttribute`, and `XmlEnumAttribute`
- Deserialization xml from classic `XmlSerializer` (mostly, [details in FAQ](https://github.com/ExtendedXmlSerializer/home/wiki/01.-FAQs#systemxmlserializer-vs-extendedxmlserializer))
- Deserialization xml from classic `XmlSerializer` (mostly, [details in FAQ](https://github.com/ExtendedXmlSerializer/home/wiki/FAQs#systemxmlserializer-vs-extendedxmlserializer))

Supported platforms:

Expand Down
5 changes: 5 additions & 0 deletions documentation/conceptual/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Concepts and Topics

Here you will find articles that give a general overview and introduction to ExtendedXmlSerializer.

**Note:** This section is a mirrored view of our [repository wiki](https://github.com/ExtendedXmlSerializer/home/wiki). All topics here can also be viewed in our wiki. Whereas the content found on site is published and refreshed with each new release of our project, our wiki is updated instantly. As a result, the information on the wiki may differ from the content found within this site.
1 change: 0 additions & 1 deletion documentation/conceptual/intro.md

This file was deleted.

12 changes: 9 additions & 3 deletions documentation/conceptual/toc.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
- name: Introduction
href: intro.md
href: index.md
- name: FAQs
href: documents/01.-FAQs.md
href: documents/FAQs.md
- name: The Basics
href: documents/02.-The-Basics.md
href: documents/The-Basics.md
- name: Features
href: documents/Features.md
- name: API Overview
href: documents/API-Overview.md
- name: Example Scenarios
href: documents/Example-Scenarios.md
31 changes: 27 additions & 4 deletions documentation/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
# This is the **HOMEPAGE**.
Refer to [Markdown](http://daringfireball.net/projects/markdown/) for how to write markdown files.
## Quick Start Notes:
1. Add images to the *images* folder if the file is referencing an image.
# Welcome!

Welcome to the ExtendedXmlSerializer documentation site. This is an automated site that is part of our continuous integration workflow and is generated on each new release.

### [Conceptual Topics](https://extendedxmlserializer.github.io/documentation/conceptual/)

If you are new to ExtendedXmlSerializer, you might benefit most by [reviewing our conceptual topics](/conceptual/) first to get an overview of our offering.

### [API Reference](https://extendedxmlserializer.github.io/documentation/reference/)

Our [API reference](/reference/) is generated from the publicly-accessible surface API of our code.

### [Releases](https://github.com/ExtendedXmlSerializer/home/releases)

Want to see a history of our product? Then [check out our releases](https://github.com/ExtendedXmlSerializer/home/releases).

### [CHANGELOG](https://github.com/ExtendedXmlSerializer/home/blob/master/CHANGELOG.md)

A [single-page history](https://github.com/ExtendedXmlSerializer/home/blob/master/CHANGELOG.md) of our releases starting with `v2.2.0`.

### [README](https://github.com/ExtendedXmlSerializer/home/blob/master/README.md)

[Our repository document](https://github.com/ExtendedXmlSerializer/home/blob/master/README.md) that highlights important high-level information, as most repository README's do.

### [Submit an issue](https://github.com/ExtendedXmlSerializer/home/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc)

Found a bug or have a question? [Check out our issues](https://github.com/ExtendedXmlSerializer/home/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc) and see if we can help.
9 changes: 7 additions & 2 deletions documentation/reference/index.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
# PLACEHOLDER
TODO: Add .NET projects to the *src* folder and run `docfx` to generate **REAL** *API Documentation*!
# ExtendedXmlSerializer API Reference

Welcome to the API Reference documentation. Here you will find all documented classes from code defined within the ExtendedXmlSerializer project.

Start by visiting a topic within the Table of Contents.

If you are unsure of a topic to start with, we recommend visiting the `ConfigurationContainer` ([link](/reference/ExtendedXmlSerializer.Configuration.ConfigurationContainer.html)) as that is where all the fun starts. 👍
1 change: 1 addition & 0 deletions documentation/templates/default/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ article h4 {
.sidetoc, .sidefilter {
margin-left: -15px;
}
.row { margin-left: unset; margin-right: unset; }
}

@media (max-width: 767px) {
Expand Down
2 changes: 1 addition & 1 deletion src/ExtendedXmlSerializer/ExtensionMethodsForContent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public static ITypeConfiguration<T> WithMonitor<T>(this ITypeConfiguration<T> @t
/// </summary>
/// <param name="this">The container to configure.</param>
/// <returns>The configured container.</returns>
/// <seealso href="https://github.com/ExtendedXmlSerializer/home/wiki/04.-Features#immutable-classes-and-content"/>
/// <seealso href="https://github.com/ExtendedXmlSerializer/home/wiki/Features#immutable-classes-and-content"/>
public static IConfigurationContainer EnableParameterizedContent(this IConfigurationContainer @this)
=> @this.Extend(ParameterizedMembersExtension.Default);

Expand Down
12 changes: 6 additions & 6 deletions src/ExtendedXmlSerializer/ExtensionMethodsForExtensionModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml;

// ReSharper disable TooManyArguments

using System.Xml;
// ReSharper disable TooManyArguments
namespace ExtendedXmlSerializer
{
{
/// <summary>
/// Extension methods that assist or enable functionality found within the extension model namespace (
/// <see cref="ExtensionModel"/>).
Expand Down Expand Up @@ -110,7 +110,7 @@ public static IConfigurationContainer EnableExpressions(this IConfigurationConta
/// <param name="this">The configuration container to configure.</param>
/// <returns>The configured configuration container.</returns>
/// <seealso href="https://docs.microsoft.com/en-us/dotnet/framework/wpf/advanced/markup-extensions-and-wpf-xaml"/>
/// <seealso href="https://github.com/ExtendedXmlSerializer/home/wiki/04.-Features#xaml-ness-markup-extensions"/>
/// <seealso href="https://github.com/ExtendedXmlSerializer/home/wiki/Features#xaml-ness-markup-extensions"/>
/// <seealso href="https://github.com/ExtendedXmlSerializer/home/blob/25514a768f7dc6b3166119254a1bd80ea13e1dbe/test/ExtendedXmlSerializer.Tests/ExtensionModel/Markup/MarkupExtensionTests.cs"/>
public static IConfigurationContainer EnableMarkupExtensions(this IConfigurationContainer @this)
=> @this.EnableExpressions()
Expand Down
58 changes: 58 additions & 0 deletions test/ExtendedXmlSerializer.Tests.ReportedIssues/Issue282Tests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
using ExtendedXmlSerializer.Configuration;
using ExtendedXmlSerializer.ContentModel;
using ExtendedXmlSerializer.ContentModel.Format;
using ExtendedXmlSerializer.Tests.ReportedIssues.Support;
using FluentAssertions;
using Xunit;

namespace ExtendedXmlSerializer.Tests.ReportedIssues
{
public sealed class Issue282Tests
{
[Fact]
void Verify()
{
var serializer = new ConfigurationContainer().Type<Subject>()
.Register()
.Serializer()
.Using(SubjectSerializer.Default)
.Create()
.ForTesting();

var instance = new Subject("Hello World!", 123);
serializer.Assert(instance, @"<?xml version=""1.0"" encoding=""utf-8""?><Issue282Tests-Subject xmlns=""clr-namespace:ExtendedXmlSerializer.Tests.ReportedIssues;assembly=ExtendedXmlSerializer.Tests.ReportedIssues"">Hello World!|123</Issue282Tests-Subject>");
serializer.Cycle(instance).Should().BeEquivalentTo(instance);
}

public sealed class SubjectSerializer : ISerializer<Subject>
{
public static SubjectSerializer Default { get; } = new SubjectSerializer();

SubjectSerializer() {}

public Subject Get(IFormatReader parameter)
{
var parts = parameter.Content().Split('|');
var result = new Subject(parts[0], int.Parse(parts[1]));
return result;
}

public void Write(IFormatWriter writer, Subject instance)
{
writer.Content($"{instance.Text}|{instance.Number}");
}
}

public class Subject
{
public Subject(string text, int number)
{
Text = text;
Number = number;
}

public string Text { get; }
public int Number { get; }
}
}
}