public async Task LogOutDoesNotForgetCRMServerURL() { AuthenticationTestable auth = new AuthenticationTestable(); string url = "crmserverurl"; OrganizationServiceProxy.Current.ServiceUrl = url; //auth.ServiceUrl = url; await auth.LogOut(); Assert.AreEqual(url, auth.ServiceUrl); }
public async Task AppendAndPrependToServerUrl() { var auth = new AuthenticationTestable(); SettingsViewModel vm = new SettingsViewModel(auth, null); string testUrl = "psatime.crm"; vm.ServiceUrl = testUrl; await vm.LogIn(); Assert.AreEqual("https://psatime.crm.dynamics.com", auth.ActualLogInServiceUrl); }
public async Task ChangeHttpToHttpsForServerUrl() { var auth = new AuthenticationTestable(); SettingsViewModel vm = new SettingsViewModel(auth, null); string testUrl = "http://test.crm.dynamics.com"; vm.ServiceUrl = testUrl; await vm.LogIn(); Assert.AreEqual("https://test.crm.dynamics.com", auth.ActualLogInServiceUrl); }
public async Task DoNotAppendAppendServerUrlWhenCrmlivetieComIsPresent() { var auth = new AuthenticationTestable(); SettingsViewModel vm = new SettingsViewModel(auth, null); string testUrl = "https://promxtestmicrosoft.crmlivetie.com"; vm.ServiceUrl = testUrl; await vm.LogIn(); Assert.AreEqual("https://promxtestmicrosoft.crmlivetie.com", auth.ActualLogInServiceUrl); }
public void ServiceUrlDefaultedFromAuthentication() { const string TESTURL = "MYTESTURL"; SettingsViewModel vm = new SettingsViewModel(new AuthenticationTestable(), null); Assert.IsTrue(string.IsNullOrEmpty(vm.ServiceUrl), "Expect empty URL by default."); // Test Auth AuthenticationTestable auth = new AuthenticationTestable(TESTURL); vm = new SettingsViewModel(auth, null); Assert.AreEqual(TESTURL, vm.ServiceUrl, "Unexpected value for SettingsViewModel.ServiceUrl."); }
public void GenerateSuggestedServiceUrlTest() { var auth = new AuthenticationTestable(); SettingsViewModel vm = new SettingsViewModel(auth, null); vm.ServiceUrl = null; Assert.IsNull(vm.SuggestedServiceUrl); vm.ServiceUrl = "p"; Assert.AreEqual("p.crm.dynamics.com", vm.SuggestedServiceUrl); vm.ServiceUrl = "psaml"; Assert.AreEqual("psaml.crm.dynamics.com", vm.SuggestedServiceUrl); vm.ServiceUrl = "psa"; Assert.AreEqual("psa.crm.dynamics.com", vm.SuggestedServiceUrl); vm.ServiceUrl = "psaml.c"; Assert.AreEqual("psaml.crm.dynamics.com", vm.SuggestedServiceUrl); vm.ServiceUrl = "psaml.crm"; Assert.AreEqual("psaml.crm.dynamics.com", vm.SuggestedServiceUrl); vm.ServiceUrl = "psaml.crm."; Assert.AreEqual("psaml.crm.dynamics.com", vm.SuggestedServiceUrl); vm.ServiceUrl = "psaml.crm.a"; Assert.AreEqual("psaml.crm.a.crm.dynamics.com", vm.SuggestedServiceUrl); vm.ServiceUrl = "psaml.crm.a "; Assert.AreEqual("psaml.crm.a.crm.dynamics.com", vm.SuggestedServiceUrl); vm.ServiceUrl = " psaml.crm.a"; Assert.AreEqual("psaml.crm.a.crm.dynamics.com", vm.SuggestedServiceUrl); vm.ServiceUrl = "psaml.crm.c"; Assert.AreEqual("psaml.crm.crm.dynamics.com", vm.SuggestedServiceUrl); vm.ServiceUrl = "psaml.crm.c "; Assert.AreEqual("psaml.crm.crm.dynamics.com", vm.SuggestedServiceUrl); vm.ServiceUrl = " psaml.crm.c"; Assert.AreEqual("psaml.crm.crm.dynamics.com", vm.SuggestedServiceUrl); vm.ServiceUrl = "psaml.crm.d"; Assert.AreEqual("psaml.crm.dynamics.com", vm.SuggestedServiceUrl); vm.ServiceUrl = "psaml.crm.dynamics.com"; Assert.IsNull(vm.SuggestedServiceUrl); vm.ServiceUrl = "psaml.crm.dynamics.com "; Assert.IsNull(vm.SuggestedServiceUrl); vm.ServiceUrl = " psaml.crm.dynamics.com"; Assert.IsNull(vm.SuggestedServiceUrl); vm.ServiceUrl = "psaml.crm.dynamics.co"; Assert.AreEqual("psaml.crm.dynamics.com", vm.SuggestedServiceUrl); vm.ServiceUrl = "psaml.crm.dynamics.co "; Assert.AreEqual("psaml.crm.dynamics.com", vm.SuggestedServiceUrl); vm.ServiceUrl = " psaml.crm.dynamics.co"; Assert.AreEqual("psaml.crm.dynamics.com", vm.SuggestedServiceUrl); vm.ServiceUrl = "psaml.crm4"; Assert.AreEqual("psaml.crm4.crm.dynamics.com", vm.SuggestedServiceUrl); vm.ServiceUrl = "psaml.crm4."; Assert.AreEqual("psaml.crm4.crm.dynamics.com", vm.SuggestedServiceUrl); vm.ServiceUrl = "psaml.crm4.d"; Assert.AreEqual("psaml.crm4.dynamics.com", vm.SuggestedServiceUrl); vm.ServiceUrl = "psaml.crm4.d"; Assert.AreEqual("psaml.crm4.dynamics.com", vm.SuggestedServiceUrl); vm.ServiceUrl = "psaml.abc.crml"; Assert.AreEqual("psaml.abc.crmlivetie.com", vm.SuggestedServiceUrl); }