Skip to content

Commit

Permalink
Add unit test cleanup to fix failing other test.
Browse files Browse the repository at this point in the history
  • Loading branch information
dicky authored and dicky committed Jul 8, 2019
1 parent b656e83 commit bf1dee6
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions UnitTests/DotNetifyConfigurationTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,24 @@ public void UseJsonSerializerSettings_OverridesCurrentSettings()
Assert.IsInstanceOfType(VMSerializer.SerializerSettings.ContractResolver, typeof(MyContractResolver));

VMSerializer.SerializerSettings = currentSettings;
}
}

[TestMethod]
public void UseJsonSerializerSettings_OverridesCurrentSettings_WithAccessToDefaultSettings()
{
var config = new DotNetifyConfiguration();
[TestMethod]
public void UseJsonSerializerSettings_OverridesCurrentSettings_WithAccessToDefaultSettings()
{
var currentResolver = VMSerializer.SerializerSettings.ContractResolver;
var config = new DotNetifyConfiguration();

config.UseJsonSerializerSettings(settings =>
{
Assert.AreSame(settings.ContractResolver, VMSerializer.SerializerSettings.ContractResolver);
Assert.IsInstanceOfType(settings.ContractResolver, typeof(VMContractResolver));
config.UseJsonSerializerSettings(settings =>
{
Assert.AreSame(settings.ContractResolver, VMSerializer.SerializerSettings.ContractResolver);
Assert.IsInstanceOfType(settings.ContractResolver, typeof(VMContractResolver));

settings.ContractResolver = new MyContractResolver();
});
settings.ContractResolver = new MyContractResolver();
});

Assert.IsInstanceOfType(VMSerializer.SerializerSettings.ContractResolver, typeof(MyContractResolver));
}
}
}
Assert.IsInstanceOfType(VMSerializer.SerializerSettings.ContractResolver, typeof(MyContractResolver));
VMSerializer.SerializerSettings.ContractResolver = currentResolver;
}
}
}

0 comments on commit bf1dee6

Please sign in to comment.