public void Merge_Test() { var mainOptions = new SamuraiOptions() { Site = "http://www.example.com/v1/", MerchantKey = "111" }; var anotherOptions = new SamuraiOptions() { MerchantPassword = "******", MerchantKey = "222" }; // merge main with another var mainWithAnother = mainOptions.ReverseMerge(anotherOptions); // check it Assert.AreEqual(mainOptions.Site, mainWithAnother.Site); Assert.AreEqual(mainOptions.MerchantKey, mainWithAnother.MerchantKey); Assert.AreEqual(anotherOptions.MerchantPassword,mainWithAnother.MerchantPassword); Assert.IsTrue(string.IsNullOrEmpty(mainWithAnother.ProcessorToken)); // merge another with main var anotherWithMain = anotherOptions.ReverseMerge(mainOptions); // check it Assert.AreEqual(mainOptions.Site, anotherWithMain.Site); Assert.AreEqual(anotherOptions.MerchantKey, anotherWithMain.MerchantKey); Assert.AreEqual(anotherOptions.MerchantPassword,anotherWithMain.MerchantPassword); Assert.IsTrue(string.IsNullOrEmpty(anotherWithMain.ProcessorToken)); }
public void SetNewOptionsTest() { var options = new SamuraiOptions() { MerchantKey = "a1ebafb6da5238fb8a3ac9f6", MerchantPassword = "******", ProcessorToken = "5a0e1ca1e5a11a2997bbf912" }; Samurai.Options = options; Assert.AreEqual(Samurai.Site, "https://api.samurai.feefighters.com/v1/"); Assert.AreEqual(Samurai.MerchantKey, options.MerchantKey); Assert.AreEqual(Samurai.MerchantPassword, options.MerchantPassword); Assert.AreEqual(Samurai.ProcessorToken, options.ProcessorToken); }