public void IntegrationTest_TrustRelation_RequestWithAutoResponse() { var providerFactory = ProviderFactory.Instance; var typeProvider = providerFactory.CreateTrustRelationTypeServiceProvider(); var builder = new TrustRelationRequestBuilder(); builder.SetFromTenant(_sourceTenant.ID).SetToTenant(_targetTenant.ID); builder.SetMessage("TestMsg").SetTitle("title").SetLanguageISO("en"); builder.AddOfferedTrustType(_trustRelationType.ID).AddRequestedTrustType(_trustRelationType.ID); var request = builder.Build(); var requestProvider = providerFactory.CreateTrustRelationRequestServiceProvider(); requestProvider.SendTrustRelationRequest(request, true); Thread.Sleep(1000); var incomingReqests = requestProvider.GetAllIncomingTrustRelationRequests(_targetTenant.ID); Assert.AreEqual(1, incomingReqests.Count); Assert.AreEqual(TrustRequestStatus.Accepted, incomingReqests[0].Status); var outgoingReqests = requestProvider.GetAllOutgoingTrustRelationRequests(_sourceTenant.ID); Assert.AreEqual(1, outgoingReqests.Count); Assert.AreEqual(TrustRequestStatus.Accepted, outgoingReqests[0].Status); }
public void IntegrationTest_TrustRelation_TestErrorHandling() { try { var provider = ProviderFactory.Instance.CreateTrustRelationRequestServiceProvider(); var builder = new TrustRelationRequestBuilder(); builder.SetFromTenant(Guid.Empty); var request = builder.Build(); provider.SendTrustRelationRequest(request); } catch (SDKServiceException ex) { Assert.AreEqual(ex.ServerResponseCode, System.Net.HttpStatusCode.BadRequest); //Should throw exception } }