public void GetClientType_Should_Return_ExpandoObject_When_No_ClientSettingsType_Defined() { IPluginSettings settings = new PluginSettings("a4t.typed.xml"); IDictionary <string, object> person = (ExpandoObject)settings.GetAsClientType(); person.ContainsKey("WasServerKeyLoaded").Should().BeFalse(); person.ContainsKey("Name").Should().BeTrue(); person["Name"].Should().Be("SDLGuy"); }
public void GetClientType_Should_Return_Deserialized_Type_Defined_In_Service() { IAlchemyPlugin plugin = new PluginTestsPlugin(); plugin.Services.SettingsDeserialization = new SettingsDeserializationService(); plugin.Services.SettingsDeserialization.ClientSettingsType = typeof(StronglyTypedPerson); IPluginSettings settings = new PluginSettings("a4t.typed.xml", plugin); var person = (StronglyTypedPerson)settings.GetAsClientType(); person.WasServerKeyLoaded.Should().BeFalse(); person.Name.Should().Be("SDLGuy"); person.Age.Should().Be(99); person.IsOld.Should().BeTrue(); person.Favorites.Count().Should().Be(3); person.Favorites.Last().Should().Be("Johny Walker"); }
public void GetClientType_Should_Return_ExpandoObject_When_No_ClientSettingsType_Defined() { IPluginSettings settings = new PluginSettings("a4t.typed.xml"); IDictionary<string, object> person = (ExpandoObject)settings.GetAsClientType(); person.ContainsKey("WasServerKeyLoaded").Should().BeFalse(); person.ContainsKey("Name").Should().BeTrue(); person["Name"].Should().Be("SDLGuy"); }