forked from microsoft/botbuilder-dotnet
-
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.
Merge pull request microsoft#1096 from Microsoft/johtaylo/serializati…
…on-fix change serialization settings so anonymous supported
- Loading branch information
Showing
5 changed files
with
61 additions
and
30 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
libraries/Microsoft.Bot.Builder/Integration/MessageSerializerSettings.cs
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,18 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using Microsoft.Bot.Connector; | ||
using Newtonsoft.Json; | ||
|
||
namespace Microsoft.Bot.Builder.Integration | ||
{ | ||
public static class MessageSerializerSettings | ||
{ | ||
public static JsonSerializerSettings Create() | ||
{ | ||
var connector = new ConnectorClient(new Uri("http://localhost/")); | ||
return connector.DeserializationSettings; | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using Microsoft.Bot.Builder.Integration; | ||
using Microsoft.Bot.Connector; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using Newtonsoft.Json.Serialization; | ||
|
||
namespace Microsoft.Bot.Builder.Tests | ||
{ | ||
[TestClass] | ||
[TestCategory("BotAdapter")] | ||
|
||
public class Integration | ||
{ | ||
[TestMethod] | ||
public void CheckSerializerSettings() | ||
{ | ||
// used in the integration layer | ||
var settings = MessageSerializerSettings.Create(); | ||
|
||
// connector exposes the serializer settings it uses | ||
var connector = new ConnectorClient(new Uri("http://localhost/")); | ||
|
||
Assert.IsInstanceOfType(settings.ContractResolver, typeof(DefaultContractResolver)); | ||
Assert.IsInstanceOfType(connector.DeserializationSettings.ContractResolver, typeof(DefaultContractResolver)); | ||
Assert.IsInstanceOfType(connector.SerializationSettings.ContractResolver, typeof(DefaultContractResolver)); | ||
} | ||
} | ||
} |