Пример #1
0
 public void ResetDefaults_ResetsFlurlConfiguration()
 {
     OpenStackNet.Configure();
     Assert.NotNull(FlurlHttp.Configuration.BeforeCall);
     OpenStackNet.ResetDefaults();
     Assert.Null(FlurlHttp.Configuration.BeforeCall);
 }
Пример #2
0
 public void ResetDefaults_ResetsJsonNetConfiguration()
 {
     OpenStackNet.Configure();
     Assert.IsType <OpenStackContractResolver>(JsonSerializer.CreateDefault().ContractResolver);
     OpenStackNet.ResetDefaults();
     Assert.IsType <DefaultContractResolver>(JsonSerializer.CreateDefault().ContractResolver);
 }
Пример #3
0
        public void WhenResetDefaultsIsCalled_GlobalJsonConfiguration_IsNotAltered()
        {
            // User makes their own tweaks to the serialization
            JsonConvert.DefaultSettings = () => new JsonSerializerSettings();

            // We configure openstack.net
            OpenStackNet.ResetDefaults();

            // We shouldn't have clobbered their settings
            var serializer = JsonSerializer.CreateDefault();

            Assert.IsNotType <OpenStackContractResolver>(serializer.ContractResolver);
        }
Пример #4
0
        public void WhenResetDefaultsIsCalled_GlobalFlurlConfiguration_IsNotAltered()
        {
            // User makes their own tweaks to Flurl
            Action <HttpCall> customErrorHandler = call => Debug.WriteLine("I saw an error!");

            FlurlHttp.GlobalSettings.OnError = customErrorHandler;

            // We configure openstack.net
            OpenStackNet.ResetDefaults();

            // We shouldn't have clobbered their settings
            Assert.Null(FlurlHttp.GlobalSettings.AfterCall);
            Assert.Null(FlurlHttp.GlobalSettings.AfterCallAsync);
            Assert.Null(FlurlHttp.GlobalSettings.BeforeCall);
            Assert.Null(FlurlHttp.GlobalSettings.BeforeCallAsync);
            Assert.Equal(customErrorHandler, FlurlHttp.GlobalSettings.OnError);
        }
Пример #5
0
 public void Dispose()
 {
     OpenStackNet.ResetDefaults();
 }
Пример #6
0
 public OpenStackNetTests()
 {
     OpenStackNet.ResetDefaults();
 }