public void MissingMetadata_Throws() { var fakedContext = new XrmFakedContext(); fakedContext.InitializeMetadata(typeof(CrmEarlyBound.CrmServiceContext).Assembly); fakedContext.Initialize(SupportMethods.GetCustomerTypeEntity()); fakedContext.AddExecutionMock <RetrieveEntityRequest>(req => { var entityMetadata = fakedContext.GetEntityMetadataByName(String.Empty); var response = new RetrieveEntityResponse() { Results = new ParameterCollection { { "EntityMetadata", entityMetadata } } }; return(response); }); IOrganizationService fakedService = new Client.Services.OrganizationService(new Client.CrmConnection()); // fakedContext.GetOrganizationService(); DataBuilder DataBuilder = new DataBuilder(fakedService); var ex = Assert.ThrowsException <Exception>(() => DataBuilder.AppendData(SupportMethods.GetCustomerTypeFetch())); }
public void BrokenConnection_Throws() { XrmFakedContext fakedContext = SupportMethods.SetupPrimitiveFakedService( SupportMethods.IncidentLogicalName, SupportMethods.IncidentDisplayName, SupportMethods.GetCustomerTypeEntity()); IOrganizationService fakedService = new Client.Services.OrganizationService(new Client.CrmConnection()); // fakedContext.GetOrganizationService(); DataBuilder DataBuilder = new DataBuilder(fakedService); var ex = Assert.ThrowsException <Exception>(() => DataBuilder.AppendData(SupportMethods.GetCustomerTypeFetch())); }