Fixed generated code when a class extends multiple classes (#38)
* . * . * pnp * ok * compiles * ? * e * set * .ToArray() * n * ... * ok * pnp * . * . * mapster
This commit is contained in:
+4
-3
@@ -16,8 +16,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
public partial class ClientContextProxy : ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientRuntimeContextProxy, IClientContext
|
||||
{
|
||||
public new Microsoft.SharePoint.Client.ClientContext _Instance { get; }
|
||||
public Microsoft.SharePoint.Client.ClientRuntimeContext _InstanceBase { get; }
|
||||
|
||||
public Microsoft.SharePoint.Client.ClientRuntimeContext _InstanceClientRuntimeContext { get; }
|
||||
|
||||
public ProxyInterfaceSourceGeneratorTests.Source.PnP.IWeb Web { get => _mapper.Map<ProxyInterfaceSourceGeneratorTests.Source.PnP.IWeb>(_Instance.Web); }
|
||||
|
||||
@@ -53,7 +52,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
public ClientContextProxy(Microsoft.SharePoint.Client.ClientContext instance) : base(instance)
|
||||
{
|
||||
_Instance = instance;
|
||||
_InstanceBase = instance;
|
||||
_InstanceClientRuntimeContext = instance;
|
||||
|
||||
_mapper = new MapperConfiguration(cfg =>
|
||||
{
|
||||
@@ -61,6 +60,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
cfg.CreateMap<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext, Microsoft.SharePoint.Client.ClientRuntimeContext>().ConstructUsing(proxy1345472640 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientRuntimeContextProxy) proxy1345472640)._Instance);
|
||||
cfg.CreateMap<Microsoft.SharePoint.Client.ClientObject, ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject>().ConstructUsing(instance_895746668 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientObjectProxy(instance_895746668));
|
||||
cfg.CreateMap<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject, Microsoft.SharePoint.Client.ClientObject>().ConstructUsing(proxy1674261376 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientObjectProxy) proxy1674261376)._Instance);
|
||||
cfg.CreateMap<Microsoft.SharePoint.Client.SecurableObject, ProxyInterfaceSourceGeneratorTests.Source.PnP.ISecurableObject>().ConstructUsing(instance592284880 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.SecurableObjectProxy(instance592284880));
|
||||
cfg.CreateMap<ProxyInterfaceSourceGeneratorTests.Source.PnP.ISecurableObject, Microsoft.SharePoint.Client.SecurableObject>().ConstructUsing(proxy_300636294 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.SecurableObjectProxy) proxy_300636294)._Instance);
|
||||
cfg.CreateMap<Microsoft.SharePoint.Client.ClientContext, ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientContext>().ConstructUsing(instance_1283184912 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientContextProxy(instance_1283184912));
|
||||
cfg.CreateMap<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientContext, Microsoft.SharePoint.Client.ClientContext>().ConstructUsing(proxy1267236400 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientContextProxy) proxy1267236400)._Instance);
|
||||
cfg.CreateMap<Microsoft.SharePoint.Client.Web, ProxyInterfaceSourceGeneratorTests.Source.PnP.IWeb>().ConstructUsing(instance_1865313808 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.WebProxy(instance_1865313808));
|
||||
|
||||
+2
@@ -152,6 +152,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
cfg.CreateMap<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext, Microsoft.SharePoint.Client.ClientRuntimeContext>().ConstructUsing(proxy1345472640 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientRuntimeContextProxy) proxy1345472640)._Instance);
|
||||
cfg.CreateMap<Microsoft.SharePoint.Client.ClientObject, ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject>().ConstructUsing(instance_895746668 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientObjectProxy(instance_895746668));
|
||||
cfg.CreateMap<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject, Microsoft.SharePoint.Client.ClientObject>().ConstructUsing(proxy1674261376 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientObjectProxy) proxy1674261376)._Instance);
|
||||
cfg.CreateMap<Microsoft.SharePoint.Client.SecurableObject, ProxyInterfaceSourceGeneratorTests.Source.PnP.ISecurableObject>().ConstructUsing(instance592284880 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.SecurableObjectProxy(instance592284880));
|
||||
cfg.CreateMap<ProxyInterfaceSourceGeneratorTests.Source.PnP.ISecurableObject, Microsoft.SharePoint.Client.SecurableObject>().ConstructUsing(proxy_300636294 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.SecurableObjectProxy) proxy_300636294)._Instance);
|
||||
cfg.CreateMap<Microsoft.SharePoint.Client.ClientContext, ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientContext>().ConstructUsing(instance_1283184912 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientContextProxy(instance_1283184912));
|
||||
cfg.CreateMap<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientContext, Microsoft.SharePoint.Client.ClientContext>().ConstructUsing(proxy1267236400 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientContextProxy) proxy1267236400)._Instance);
|
||||
}).CreateMapper();
|
||||
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
//----------------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by https://github.com/StefH/ProxyInterfaceSourceGenerator.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#nullable enable
|
||||
using System;
|
||||
using AutoMapper;
|
||||
|
||||
namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
{
|
||||
public partial class SecurableObjectProxy : ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientObjectProxy, ISecurableObject
|
||||
{
|
||||
public new Microsoft.SharePoint.Client.SecurableObject _Instance { get; }
|
||||
public Microsoft.SharePoint.Client.ClientObject _InstanceClientObject { get; }
|
||||
|
||||
public ProxyInterfaceSourceGeneratorTests.Source.PnP.ISecurableObject FirstUniqueAncestorSecurableObject { get => _mapper.Map<ProxyInterfaceSourceGeneratorTests.Source.PnP.ISecurableObject>(_Instance.FirstUniqueAncestorSecurableObject); }
|
||||
|
||||
public bool HasUniqueRoleAssignments { get => _Instance.HasUniqueRoleAssignments; }
|
||||
|
||||
public Microsoft.SharePoint.Client.RoleAssignmentCollection RoleAssignments { get => _Instance.RoleAssignments; }
|
||||
|
||||
|
||||
|
||||
public virtual void ResetRoleInheritance()
|
||||
{
|
||||
_Instance.ResetRoleInheritance();
|
||||
}
|
||||
|
||||
public virtual void BreakRoleInheritance(bool copyRoleAssignments, bool clearSubscopes)
|
||||
{
|
||||
bool copyRoleAssignments_ = copyRoleAssignments;
|
||||
bool clearSubscopes_ = clearSubscopes;
|
||||
_Instance.BreakRoleInheritance(copyRoleAssignments_, clearSubscopes_);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public SecurableObjectProxy(Microsoft.SharePoint.Client.SecurableObject instance) : base(instance)
|
||||
{
|
||||
_Instance = instance;
|
||||
_InstanceClientObject = instance;
|
||||
|
||||
_mapper = new MapperConfiguration(cfg =>
|
||||
{
|
||||
cfg.CreateMap<Microsoft.SharePoint.Client.ClientRuntimeContext, ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext>().ConstructUsing(instance_205293328 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientRuntimeContextProxy(instance_205293328));
|
||||
cfg.CreateMap<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext, Microsoft.SharePoint.Client.ClientRuntimeContext>().ConstructUsing(proxy1345472640 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientRuntimeContextProxy) proxy1345472640)._Instance);
|
||||
cfg.CreateMap<Microsoft.SharePoint.Client.ClientObject, ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject>().ConstructUsing(instance_895746668 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientObjectProxy(instance_895746668));
|
||||
cfg.CreateMap<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject, Microsoft.SharePoint.Client.ClientObject>().ConstructUsing(proxy1674261376 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientObjectProxy) proxy1674261376)._Instance);
|
||||
cfg.CreateMap<Microsoft.SharePoint.Client.SecurableObject, ProxyInterfaceSourceGeneratorTests.Source.PnP.ISecurableObject>().ConstructUsing(instance592284880 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.SecurableObjectProxy(instance592284880));
|
||||
cfg.CreateMap<ProxyInterfaceSourceGeneratorTests.Source.PnP.ISecurableObject, Microsoft.SharePoint.Client.SecurableObject>().ConstructUsing(proxy_300636294 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.SecurableObjectProxy) proxy_300636294)._Instance);
|
||||
}).CreateMapper();
|
||||
|
||||
}
|
||||
|
||||
private readonly IMapper _mapper;
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
+131
-104
@@ -13,16 +13,17 @@ using AutoMapper;
|
||||
|
||||
namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
{
|
||||
public partial class WebProxy : ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientObjectProxy, IWeb
|
||||
public partial class WebProxy : ProxyInterfaceSourceGeneratorTests.Source.PnP.SecurableObjectProxy, IWeb
|
||||
{
|
||||
public new Microsoft.SharePoint.Client.Web _Instance { get; }
|
||||
public Microsoft.SharePoint.Client.ClientObject _InstanceBase { get; }
|
||||
|
||||
public Microsoft.SharePoint.Client.SecurableObject _InstanceSecurableObject { get; }
|
||||
|
||||
public string AccessRequestListUrl { get => _Instance.AccessRequestListUrl; }
|
||||
|
||||
public string AccessRequestSiteDescription { get => _Instance.AccessRequestSiteDescription; }
|
||||
|
||||
public string Acronym { get => _Instance.Acronym; }
|
||||
|
||||
public Microsoft.SharePoint.Client.AlertCollection Alerts { get => _Instance.Alerts; }
|
||||
|
||||
public bool AllowAutomaticASPXPageIndexing { get => _Instance.AllowAutomaticASPXPageIndexing; set => _Instance.AllowAutomaticASPXPageIndexing = value; }
|
||||
@@ -87,6 +88,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
public string Description { get => _Instance.Description; set => _Instance.Description = value; }
|
||||
|
||||
public string DescriptionForExistingLanguage { get => _Instance.DescriptionForExistingLanguage; set => _Instance.DescriptionForExistingLanguage = value; }
|
||||
|
||||
public Microsoft.SharePoint.Client.UserResource DescriptionResource { get => _Instance.DescriptionResource; }
|
||||
|
||||
public System.Collections.Generic.IEnumerable<Microsoft.SharePoint.Client.SPResourceEntry> DescriptionTranslations { get => _Instance.DescriptionTranslations; set => _Instance.DescriptionTranslations = value; }
|
||||
@@ -137,6 +140,12 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
public System.Guid Id { get => _Instance.Id; }
|
||||
|
||||
public bool IsEduClass { get => _Instance.IsEduClass; }
|
||||
|
||||
public bool IsEduClassProvisionChecked { get => _Instance.IsEduClassProvisionChecked; }
|
||||
|
||||
public bool IsEduClassProvisionPending { get => _Instance.IsEduClassProvisionPending; }
|
||||
|
||||
public bool IsHomepageModernized { get => _Instance.IsHomepageModernized; }
|
||||
|
||||
public bool IsMultilingual { get => _Instance.IsMultilingual; set => _Instance.IsMultilingual = value; }
|
||||
@@ -247,6 +256,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
public string Title { get => _Instance.Title; set => _Instance.Title = value; }
|
||||
|
||||
public string TitleForExistingLanguage { get => _Instance.TitleForExistingLanguage; set => _Instance.TitleForExistingLanguage = value; }
|
||||
|
||||
public Microsoft.SharePoint.Client.UserResource TitleResource { get => _Instance.TitleResource; }
|
||||
|
||||
public System.Collections.Generic.IEnumerable<Microsoft.SharePoint.Client.SPResourceEntry> TitleTranslations { get => _Instance.TitleTranslations; set => _Instance.TitleTranslations = value; }
|
||||
@@ -317,6 +328,105 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
_Instance.CreateDefaultAssociatedGroups(userLogin_, userLogin2_, groupNameSeed_);
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.ClientResult<string> CreateOrganizationSharingLink(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string url, bool isEditLink)
|
||||
{
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = _mapper.Map<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
string url_ = url;
|
||||
bool isEditLink_ = isEditLink;
|
||||
var result_2070260011 = Microsoft.SharePoint.Client.Web.CreateOrganizationSharingLink(context_, url_, isEditLink_);
|
||||
return result_2070260011;
|
||||
}
|
||||
|
||||
public void DestroyOrganizationSharingLink(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string url, bool isEditLink, bool removeAssociatedSharingLinkGroup)
|
||||
{
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = _mapper.Map<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
string url_ = url;
|
||||
bool isEditLink_ = isEditLink;
|
||||
bool removeAssociatedSharingLinkGroup_ = removeAssociatedSharingLinkGroup;
|
||||
Microsoft.SharePoint.Client.Web.DestroyOrganizationSharingLink(context_, url_, isEditLink_, removeAssociatedSharingLinkGroup_);
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.ClientResult<Microsoft.SharePoint.Client.SharingLinkKind> GetSharingLinkKind(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string fileUrl)
|
||||
{
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = _mapper.Map<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
string fileUrl_ = fileUrl;
|
||||
var result_654626020 = Microsoft.SharePoint.Client.Web.GetSharingLinkKind(context_, fileUrl_);
|
||||
return result_654626020;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.ClientResult<Microsoft.SharePoint.Client.SharingLinkData> GetSharingLinkData(string linkUrl)
|
||||
{
|
||||
string linkUrl_ = linkUrl;
|
||||
var result__2107757018 = _Instance.GetSharingLinkData(linkUrl_);
|
||||
return result__2107757018;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.ClientResult<string> MapToIcon(string fileName, string progId, Microsoft.SharePoint.Client.Utilities.IconSize size)
|
||||
{
|
||||
string fileName_ = fileName;
|
||||
string progId_ = progId;
|
||||
Microsoft.SharePoint.Client.Utilities.IconSize size_ = size;
|
||||
var result_384589064 = _Instance.MapToIcon(fileName_, progId_, size_);
|
||||
return result_384589064;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.ClientResult<string> GetWebUrlFromPageUrl(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string pageFullUrl)
|
||||
{
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = _mapper.Map<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
string pageFullUrl_ = pageFullUrl;
|
||||
var result__907059837 = Microsoft.SharePoint.Client.Web.GetWebUrlFromPageUrl(context_, pageFullUrl_);
|
||||
return result__907059837;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.PushNotificationSubscriber RegisterPushNotificationSubscriber(System.Guid deviceAppInstanceId, string serviceToken)
|
||||
{
|
||||
System.Guid deviceAppInstanceId_ = deviceAppInstanceId;
|
||||
string serviceToken_ = serviceToken;
|
||||
var result__117534630 = _Instance.RegisterPushNotificationSubscriber(deviceAppInstanceId_, serviceToken_);
|
||||
return result__117534630;
|
||||
}
|
||||
|
||||
public void UnregisterPushNotificationSubscriber(System.Guid deviceAppInstanceId)
|
||||
{
|
||||
System.Guid deviceAppInstanceId_ = deviceAppInstanceId;
|
||||
_Instance.UnregisterPushNotificationSubscriber(deviceAppInstanceId_);
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.PushNotificationSubscriberCollection GetPushNotificationSubscribersByArgs(string customArgs)
|
||||
{
|
||||
string customArgs_ = customArgs;
|
||||
var result_144086076 = _Instance.GetPushNotificationSubscribersByArgs(customArgs_);
|
||||
return result_144086076;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.PushNotificationSubscriberCollection GetPushNotificationSubscribersByUser(string userName)
|
||||
{
|
||||
string userName_ = userName;
|
||||
var result__1280834962 = _Instance.GetPushNotificationSubscribersByUser(userName_);
|
||||
return result__1280834962;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.ClientResult<bool> DoesPushNotificationSubscriberExist(System.Guid deviceAppInstanceId)
|
||||
{
|
||||
System.Guid deviceAppInstanceId_ = deviceAppInstanceId;
|
||||
var result__1309404561 = _Instance.DoesPushNotificationSubscriberExist(deviceAppInstanceId_);
|
||||
return result__1309404561;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.PushNotificationSubscriber GetPushNotificationSubscriber(System.Guid deviceAppInstanceId)
|
||||
{
|
||||
System.Guid deviceAppInstanceId_ = deviceAppInstanceId;
|
||||
var result_1696633571 = _Instance.GetPushNotificationSubscriber(deviceAppInstanceId_);
|
||||
return result_1696633571;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.User GetSiteUserIncludingDeletedByPuid(string puid)
|
||||
{
|
||||
string puid_ = puid;
|
||||
var result__1448181221 = _Instance.GetSiteUserIncludingDeletedByPuid(puid_);
|
||||
return result__1448181221;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.User GetUserById(int userId)
|
||||
{
|
||||
int userId_ = userId;
|
||||
@@ -434,96 +544,26 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
Microsoft.SharePoint.Client.Web.DeleteAnonymousLinkForObject(context_, url_, isEditLink_, removeAssociatedSharingLinkGroup_);
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.ClientResult<string> CreateOrganizationSharingLink(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string url, bool isEditLink)
|
||||
public Microsoft.SharePoint.Client.ListCollection GetLists(Microsoft.SharePoint.Client.GetListsParameters getListsParams)
|
||||
{
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = _mapper.Map<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
string url_ = url;
|
||||
bool isEditLink_ = isEditLink;
|
||||
var result_2070260011 = Microsoft.SharePoint.Client.Web.CreateOrganizationSharingLink(context_, url_, isEditLink_);
|
||||
return result_2070260011;
|
||||
Microsoft.SharePoint.Client.GetListsParameters getListsParams_ = getListsParams;
|
||||
var result_1293372807 = _Instance.GetLists(getListsParams_);
|
||||
return result_1293372807;
|
||||
}
|
||||
|
||||
public void DestroyOrganizationSharingLink(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string url, bool isEditLink, bool removeAssociatedSharingLinkGroup)
|
||||
public Microsoft.SharePoint.Client.WebTemplateCollection GetAvailableWebTemplates(uint lcid, bool doIncludeCrossLanguage)
|
||||
{
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = _mapper.Map<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
string url_ = url;
|
||||
bool isEditLink_ = isEditLink;
|
||||
bool removeAssociatedSharingLinkGroup_ = removeAssociatedSharingLinkGroup;
|
||||
Microsoft.SharePoint.Client.Web.DestroyOrganizationSharingLink(context_, url_, isEditLink_, removeAssociatedSharingLinkGroup_);
|
||||
uint lcid_ = lcid;
|
||||
bool doIncludeCrossLanguage_ = doIncludeCrossLanguage;
|
||||
var result__1052443476 = _Instance.GetAvailableWebTemplates(lcid_, doIncludeCrossLanguage_);
|
||||
return result__1052443476;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.ClientResult<Microsoft.SharePoint.Client.SharingLinkKind> GetSharingLinkKind(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string fileUrl)
|
||||
public Microsoft.SharePoint.Client.List GetCatalog(int typeCatalog)
|
||||
{
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = _mapper.Map<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
string fileUrl_ = fileUrl;
|
||||
var result_654626020 = Microsoft.SharePoint.Client.Web.GetSharingLinkKind(context_, fileUrl_);
|
||||
return result_654626020;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.ClientResult<Microsoft.SharePoint.Client.SharingLinkData> GetSharingLinkData(string linkUrl)
|
||||
{
|
||||
string linkUrl_ = linkUrl;
|
||||
var result__2107757018 = _Instance.GetSharingLinkData(linkUrl_);
|
||||
return result__2107757018;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.ClientResult<string> MapToIcon(string fileName, string progId, Microsoft.SharePoint.Client.Utilities.IconSize size)
|
||||
{
|
||||
string fileName_ = fileName;
|
||||
string progId_ = progId;
|
||||
Microsoft.SharePoint.Client.Utilities.IconSize size_ = size;
|
||||
var result_384589064 = _Instance.MapToIcon(fileName_, progId_, size_);
|
||||
return result_384589064;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.ClientResult<string> GetWebUrlFromPageUrl(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string pageFullUrl)
|
||||
{
|
||||
Microsoft.SharePoint.Client.ClientRuntimeContext context_ = _mapper.Map<Microsoft.SharePoint.Client.ClientRuntimeContext>(context);
|
||||
string pageFullUrl_ = pageFullUrl;
|
||||
var result__907059837 = Microsoft.SharePoint.Client.Web.GetWebUrlFromPageUrl(context_, pageFullUrl_);
|
||||
return result__907059837;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.PushNotificationSubscriber RegisterPushNotificationSubscriber(System.Guid deviceAppInstanceId, string serviceToken)
|
||||
{
|
||||
System.Guid deviceAppInstanceId_ = deviceAppInstanceId;
|
||||
string serviceToken_ = serviceToken;
|
||||
var result__117534630 = _Instance.RegisterPushNotificationSubscriber(deviceAppInstanceId_, serviceToken_);
|
||||
return result__117534630;
|
||||
}
|
||||
|
||||
public void UnregisterPushNotificationSubscriber(System.Guid deviceAppInstanceId)
|
||||
{
|
||||
System.Guid deviceAppInstanceId_ = deviceAppInstanceId;
|
||||
_Instance.UnregisterPushNotificationSubscriber(deviceAppInstanceId_);
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.PushNotificationSubscriberCollection GetPushNotificationSubscribersByArgs(string customArgs)
|
||||
{
|
||||
string customArgs_ = customArgs;
|
||||
var result_144086076 = _Instance.GetPushNotificationSubscribersByArgs(customArgs_);
|
||||
return result_144086076;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.PushNotificationSubscriberCollection GetPushNotificationSubscribersByUser(string userName)
|
||||
{
|
||||
string userName_ = userName;
|
||||
var result__1280834962 = _Instance.GetPushNotificationSubscribersByUser(userName_);
|
||||
return result__1280834962;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.ClientResult<bool> DoesPushNotificationSubscriberExist(System.Guid deviceAppInstanceId)
|
||||
{
|
||||
System.Guid deviceAppInstanceId_ = deviceAppInstanceId;
|
||||
var result__1309404561 = _Instance.DoesPushNotificationSubscriberExist(deviceAppInstanceId_);
|
||||
return result__1309404561;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.PushNotificationSubscriber GetPushNotificationSubscriber(System.Guid deviceAppInstanceId)
|
||||
{
|
||||
System.Guid deviceAppInstanceId_ = deviceAppInstanceId;
|
||||
var result_1696633571 = _Instance.GetPushNotificationSubscriber(deviceAppInstanceId_);
|
||||
return result_1696633571;
|
||||
int typeCatalog_ = typeCatalog;
|
||||
var result__1458409307 = _Instance.GetCatalog(typeCatalog_);
|
||||
return result__1458409307;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.RecycleBinItemCollection GetRecycleBinItems(string pagingInfo, int rowLimit, bool isAscending, Microsoft.SharePoint.Client.RecycleBinOrderBy orderBy, Microsoft.SharePoint.Client.RecycleBinItemState itemState)
|
||||
@@ -620,19 +660,9 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
return result_127789125;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.WebTemplateCollection GetAvailableWebTemplates(uint lcid, bool doIncludeCrossLanguage)
|
||||
public void Update()
|
||||
{
|
||||
uint lcid_ = lcid;
|
||||
bool doIncludeCrossLanguage_ = doIncludeCrossLanguage;
|
||||
var result__1052443476 = _Instance.GetAvailableWebTemplates(lcid_, doIncludeCrossLanguage_);
|
||||
return result__1052443476;
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.List GetCatalog(int typeCatalog)
|
||||
{
|
||||
int typeCatalog_ = typeCatalog;
|
||||
var result__1458409307 = _Instance.GetCatalog(typeCatalog_);
|
||||
return result__1458409307;
|
||||
_Instance.Update();
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.View GetViewFromUrl(string listUrl)
|
||||
@@ -769,11 +799,6 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
_Instance.DeleteObject();
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
_Instance.Update();
|
||||
}
|
||||
|
||||
public Microsoft.SharePoint.Client.ClientResult<System.IO.Stream> PageContextInfo(bool includeODBSettings, bool emitNavigationInfo)
|
||||
{
|
||||
bool includeODBSettings_ = includeODBSettings;
|
||||
@@ -894,7 +919,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
public WebProxy(Microsoft.SharePoint.Client.Web instance) : base(instance)
|
||||
{
|
||||
_Instance = instance;
|
||||
_InstanceBase = instance;
|
||||
_InstanceSecurableObject = instance;
|
||||
|
||||
_mapper = new MapperConfiguration(cfg =>
|
||||
{
|
||||
@@ -902,6 +927,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
cfg.CreateMap<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext, Microsoft.SharePoint.Client.ClientRuntimeContext>().ConstructUsing(proxy1345472640 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientRuntimeContextProxy) proxy1345472640)._Instance);
|
||||
cfg.CreateMap<Microsoft.SharePoint.Client.ClientObject, ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject>().ConstructUsing(instance_895746668 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientObjectProxy(instance_895746668));
|
||||
cfg.CreateMap<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject, Microsoft.SharePoint.Client.ClientObject>().ConstructUsing(proxy1674261376 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientObjectProxy) proxy1674261376)._Instance);
|
||||
cfg.CreateMap<Microsoft.SharePoint.Client.SecurableObject, ProxyInterfaceSourceGeneratorTests.Source.PnP.ISecurableObject>().ConstructUsing(instance592284880 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.SecurableObjectProxy(instance592284880));
|
||||
cfg.CreateMap<ProxyInterfaceSourceGeneratorTests.Source.PnP.ISecurableObject, Microsoft.SharePoint.Client.SecurableObject>().ConstructUsing(proxy_300636294 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.SecurableObjectProxy) proxy_300636294)._Instance);
|
||||
cfg.CreateMap<Microsoft.SharePoint.Client.ClientContext, ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientContext>().ConstructUsing(instance_1283184912 => new ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientContextProxy(instance_1283184912));
|
||||
cfg.CreateMap<ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientContext, Microsoft.SharePoint.Client.ClientContext>().ConstructUsing(proxy1267236400 => ((ProxyInterfaceSourceGeneratorTests.Source.PnP.ClientContextProxy) proxy1267236400)._Instance);
|
||||
}).CreateMapper();
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
//----------------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by https://github.com/StefH/ProxyInterfaceSourceGenerator.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
#nullable enable
|
||||
using System;
|
||||
|
||||
namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
{
|
||||
public partial interface ISecurableObject
|
||||
{
|
||||
ProxyInterfaceSourceGeneratorTests.Source.PnP.ISecurableObject FirstUniqueAncestorSecurableObject { get; }
|
||||
|
||||
bool HasUniqueRoleAssignments { get; }
|
||||
|
||||
Microsoft.SharePoint.Client.RoleAssignmentCollection RoleAssignments { get; }
|
||||
|
||||
|
||||
|
||||
void ResetRoleInheritance();
|
||||
|
||||
void BreakRoleInheritance(bool copyRoleAssignments, bool clearSubscopes);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
#nullable disable
|
||||
+42
-26
@@ -18,6 +18,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
string AccessRequestSiteDescription { get; }
|
||||
|
||||
string Acronym { get; }
|
||||
|
||||
Microsoft.SharePoint.Client.AlertCollection Alerts { get; }
|
||||
|
||||
bool AllowAutomaticASPXPageIndexing { get; set; }
|
||||
@@ -82,6 +84,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
string Description { get; set; }
|
||||
|
||||
string DescriptionForExistingLanguage { get; set; }
|
||||
|
||||
Microsoft.SharePoint.Client.UserResource DescriptionResource { get; }
|
||||
|
||||
System.Collections.Generic.IEnumerable<Microsoft.SharePoint.Client.SPResourceEntry> DescriptionTranslations { get; set; }
|
||||
@@ -132,6 +136,12 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
System.Guid Id { get; }
|
||||
|
||||
bool IsEduClass { get; }
|
||||
|
||||
bool IsEduClassProvisionChecked { get; }
|
||||
|
||||
bool IsEduClassProvisionPending { get; }
|
||||
|
||||
bool IsHomepageModernized { get; }
|
||||
|
||||
bool IsMultilingual { get; set; }
|
||||
@@ -242,6 +252,8 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
string Title { get; set; }
|
||||
|
||||
string TitleForExistingLanguage { get; set; }
|
||||
|
||||
Microsoft.SharePoint.Client.UserResource TitleResource { get; }
|
||||
|
||||
System.Collections.Generic.IEnumerable<Microsoft.SharePoint.Client.SPResourceEntry> TitleTranslations { get; set; }
|
||||
@@ -284,6 +296,32 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
void CreateDefaultAssociatedGroups(string userLogin, string userLogin2, string groupNameSeed);
|
||||
|
||||
Microsoft.SharePoint.Client.ClientResult<string> CreateOrganizationSharingLink(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string url, bool isEditLink);
|
||||
|
||||
void DestroyOrganizationSharingLink(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string url, bool isEditLink, bool removeAssociatedSharingLinkGroup);
|
||||
|
||||
Microsoft.SharePoint.Client.ClientResult<Microsoft.SharePoint.Client.SharingLinkKind> GetSharingLinkKind(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string fileUrl);
|
||||
|
||||
Microsoft.SharePoint.Client.ClientResult<Microsoft.SharePoint.Client.SharingLinkData> GetSharingLinkData(string linkUrl);
|
||||
|
||||
Microsoft.SharePoint.Client.ClientResult<string> MapToIcon(string fileName, string progId, Microsoft.SharePoint.Client.Utilities.IconSize size);
|
||||
|
||||
Microsoft.SharePoint.Client.ClientResult<string> GetWebUrlFromPageUrl(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string pageFullUrl);
|
||||
|
||||
Microsoft.SharePoint.Client.PushNotificationSubscriber RegisterPushNotificationSubscriber(System.Guid deviceAppInstanceId, string serviceToken);
|
||||
|
||||
void UnregisterPushNotificationSubscriber(System.Guid deviceAppInstanceId);
|
||||
|
||||
Microsoft.SharePoint.Client.PushNotificationSubscriberCollection GetPushNotificationSubscribersByArgs(string customArgs);
|
||||
|
||||
Microsoft.SharePoint.Client.PushNotificationSubscriberCollection GetPushNotificationSubscribersByUser(string userName);
|
||||
|
||||
Microsoft.SharePoint.Client.ClientResult<bool> DoesPushNotificationSubscriberExist(System.Guid deviceAppInstanceId);
|
||||
|
||||
Microsoft.SharePoint.Client.PushNotificationSubscriber GetPushNotificationSubscriber(System.Guid deviceAppInstanceId);
|
||||
|
||||
Microsoft.SharePoint.Client.User GetSiteUserIncludingDeletedByPuid(string puid);
|
||||
|
||||
Microsoft.SharePoint.Client.User GetUserById(int userId);
|
||||
|
||||
Microsoft.SharePoint.Client.ClientResult<bool> EnsureTenantAppCatalog(string callerId);
|
||||
@@ -310,29 +348,11 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
void DeleteAnonymousLinkForObject(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string url, bool isEditLink, bool removeAssociatedSharingLinkGroup);
|
||||
|
||||
Microsoft.SharePoint.Client.ClientResult<string> CreateOrganizationSharingLink(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string url, bool isEditLink);
|
||||
Microsoft.SharePoint.Client.ListCollection GetLists(Microsoft.SharePoint.Client.GetListsParameters getListsParams);
|
||||
|
||||
void DestroyOrganizationSharingLink(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string url, bool isEditLink, bool removeAssociatedSharingLinkGroup);
|
||||
Microsoft.SharePoint.Client.WebTemplateCollection GetAvailableWebTemplates(uint lcid, bool doIncludeCrossLanguage);
|
||||
|
||||
Microsoft.SharePoint.Client.ClientResult<Microsoft.SharePoint.Client.SharingLinkKind> GetSharingLinkKind(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string fileUrl);
|
||||
|
||||
Microsoft.SharePoint.Client.ClientResult<Microsoft.SharePoint.Client.SharingLinkData> GetSharingLinkData(string linkUrl);
|
||||
|
||||
Microsoft.SharePoint.Client.ClientResult<string> MapToIcon(string fileName, string progId, Microsoft.SharePoint.Client.Utilities.IconSize size);
|
||||
|
||||
Microsoft.SharePoint.Client.ClientResult<string> GetWebUrlFromPageUrl(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext context, string pageFullUrl);
|
||||
|
||||
Microsoft.SharePoint.Client.PushNotificationSubscriber RegisterPushNotificationSubscriber(System.Guid deviceAppInstanceId, string serviceToken);
|
||||
|
||||
void UnregisterPushNotificationSubscriber(System.Guid deviceAppInstanceId);
|
||||
|
||||
Microsoft.SharePoint.Client.PushNotificationSubscriberCollection GetPushNotificationSubscribersByArgs(string customArgs);
|
||||
|
||||
Microsoft.SharePoint.Client.PushNotificationSubscriberCollection GetPushNotificationSubscribersByUser(string userName);
|
||||
|
||||
Microsoft.SharePoint.Client.ClientResult<bool> DoesPushNotificationSubscriberExist(System.Guid deviceAppInstanceId);
|
||||
|
||||
Microsoft.SharePoint.Client.PushNotificationSubscriber GetPushNotificationSubscriber(System.Guid deviceAppInstanceId);
|
||||
Microsoft.SharePoint.Client.List GetCatalog(int typeCatalog);
|
||||
|
||||
Microsoft.SharePoint.Client.RecycleBinItemCollection GetRecycleBinItems(string pagingInfo, int rowLimit, bool isAscending, Microsoft.SharePoint.Client.RecycleBinOrderBy orderBy, Microsoft.SharePoint.Client.RecycleBinItemState itemState);
|
||||
|
||||
@@ -360,9 +380,7 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
Microsoft.SharePoint.Client.ClientResult<System.IO.Stream> GetSPAppContextAsStream();
|
||||
|
||||
Microsoft.SharePoint.Client.WebTemplateCollection GetAvailableWebTemplates(uint lcid, bool doIncludeCrossLanguage);
|
||||
|
||||
Microsoft.SharePoint.Client.List GetCatalog(int typeCatalog);
|
||||
void Update();
|
||||
|
||||
Microsoft.SharePoint.Client.View GetViewFromUrl(string listUrl);
|
||||
|
||||
@@ -402,8 +420,6 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
|
||||
void DeleteObject();
|
||||
|
||||
void Update();
|
||||
|
||||
Microsoft.SharePoint.Client.ClientResult<System.IO.Stream> PageContextInfo(bool includeODBSettings, bool emitNavigationInfo);
|
||||
|
||||
Microsoft.SharePoint.Client.ClientResult<System.IO.Stream> PageContextCore();
|
||||
|
||||
@@ -1,33 +1,137 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CSharp.SourceGenerators.Extensions;
|
||||
using CSharp.SourceGenerators.Extensions.Models;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using ProxyInterfaceSourceGenerator;
|
||||
using ProxyInterfaceSourceGeneratorTests.Source;
|
||||
using ProxyInterfaceSourceGeneratorTests.Source.PnP;
|
||||
using Xunit;
|
||||
|
||||
namespace ProxyInterfaceSourceGeneratorTests
|
||||
namespace ProxyInterfaceSourceGeneratorTests;
|
||||
|
||||
public class PnPTests
|
||||
{
|
||||
public class PnPTests
|
||||
private bool Write = true;
|
||||
|
||||
private readonly ProxyInterfaceCodeGenerator _sut;
|
||||
|
||||
public PnPTests()
|
||||
{
|
||||
public PnPTests()
|
||||
_sut = new ProxyInterfaceCodeGenerator();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GenerateFiles_Should_GenerateCorrectFiles()
|
||||
{
|
||||
// Arrange
|
||||
var fileNames = new[]
|
||||
{
|
||||
|
||||
}
|
||||
"ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject.g.cs",
|
||||
"ProxyInterfaceSourceGeneratorTests.Source.PnP.ISecurableObject.g.cs",
|
||||
"ProxyInterfaceSourceGeneratorTests.Source.PnP.IWeb.g.cs",
|
||||
"ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext.g.cs",
|
||||
"ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientContext.g.cs",
|
||||
|
||||
[Fact]
|
||||
public void X()
|
||||
"Microsoft.SharePoint.Client.ClientObjectProxy.g.cs",
|
||||
"Microsoft.SharePoint.Client.SecurableObjectProxy.g.cs",
|
||||
"Microsoft.SharePoint.Client.WebProxy.g.cs",
|
||||
"Microsoft.SharePoint.Client.ClientRuntimeContextProxy.g.cs",
|
||||
"Microsoft.SharePoint.Client.ClientContextProxy.g.cs"
|
||||
};
|
||||
|
||||
var pathClientObject = "./Source/PnP/IClientObject.cs";
|
||||
var sourceFileClientObject = new SourceFile
|
||||
{
|
||||
var webMock = new Mock<IWeb>();
|
||||
Path = pathClientObject,
|
||||
Text = File.ReadAllText(pathClientObject),
|
||||
AttributeToAddToInterface = new ExtraAttribute
|
||||
{
|
||||
Name = "ProxyInterfaceGenerator.Proxy",
|
||||
ArgumentList = "typeof(Microsoft.SharePoint.Client.ClientObject)"
|
||||
}
|
||||
};
|
||||
|
||||
var pathSec = "./Source/PnP/ISecurableObject.cs";
|
||||
var sourceFileSec = new SourceFile
|
||||
{
|
||||
Path = pathSec,
|
||||
Text = File.ReadAllText(pathSec),
|
||||
AttributeToAddToInterface = new ExtraAttribute
|
||||
{
|
||||
Name = "ProxyInterfaceGenerator.Proxy",
|
||||
ArgumentList = "typeof(SecurableObject)" // Only name, no namespace
|
||||
}
|
||||
};
|
||||
|
||||
var ccMock = new Mock<IClientContext>();
|
||||
// ccMock.SetupGet(cc => cc.Web).Returns(webMock.Object);
|
||||
var pathWeb = "./Source/PnP/IWeb.cs";
|
||||
var sourceFileWeb = new SourceFile
|
||||
{
|
||||
Path = pathWeb,
|
||||
Text = File.ReadAllText(pathWeb),
|
||||
AttributeToAddToInterface = new ExtraAttribute
|
||||
{
|
||||
Name = "ProxyInterfaceGenerator.Proxy",
|
||||
ArgumentList = "typeof(Web)" // Only name, no namespace
|
||||
}
|
||||
};
|
||||
|
||||
var pathClientRuntimeContext = "./Source/Pnp/IClientRuntimeContext.cs";
|
||||
var sourceFileClientRuntimeContext = new SourceFile
|
||||
{
|
||||
Path = pathClientRuntimeContext,
|
||||
Text = File.ReadAllText(pathClientRuntimeContext),
|
||||
AttributeToAddToInterface = new ExtraAttribute
|
||||
{
|
||||
Name = "ProxyInterfaceGenerator.Proxy",
|
||||
ArgumentList = "typeof(Microsoft.SharePoint.Client.ClientRuntimeContext)"
|
||||
}
|
||||
};
|
||||
|
||||
var pathClientContext = "./Source/PnP/IClientContext.cs";
|
||||
var sourceFileClientContext = new SourceFile
|
||||
{
|
||||
Path = pathClientContext,
|
||||
Text = File.ReadAllText(pathClientContext),
|
||||
AttributeToAddToInterface = new ExtraAttribute
|
||||
{
|
||||
Name = "ProxyInterfaceGenerator.Proxy",
|
||||
ArgumentList = "typeof(ClientContext)" // Only name, no namespace
|
||||
}
|
||||
};
|
||||
|
||||
// Act
|
||||
var result = _sut.Execute(new[]
|
||||
{
|
||||
sourceFileClientObject,
|
||||
sourceFileSec,
|
||||
sourceFileWeb,
|
||||
sourceFileClientRuntimeContext,
|
||||
sourceFileClientContext
|
||||
});
|
||||
|
||||
// Assert
|
||||
result.Valid.Should().BeTrue();
|
||||
result.Files.Should().HaveCount(fileNames.Length + 1);
|
||||
|
||||
foreach (var fileName in fileNames.Select((fileName, index) => new { fileName, index }))
|
||||
{
|
||||
var builder = result.Files[fileName.index + 1]; // +1 means skip the attribute
|
||||
builder.Path.Should().EndWith(fileName.fileName);
|
||||
|
||||
if (Write) File.WriteAllText($"../../../Destination/{fileName.fileName}", builder.Text);
|
||||
builder.Text.Should().Be(File.ReadAllText($"../../../Destination/{fileName.fileName}"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void X()
|
||||
{
|
||||
var webMock = new Mock<IWeb>();
|
||||
|
||||
|
||||
var ccMock = new Mock<IClientContext>();
|
||||
// ccMock.SetupGet(cc => cc.Web).Returns(webMock.Object);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using CSharp.SourceGenerators.Extensions;
|
||||
using CSharp.SourceGenerators.Extensions.Models;
|
||||
using FluentAssertions;
|
||||
@@ -180,92 +179,6 @@ namespace ProxyInterfaceSourceGeneratorTests
|
||||
proxyCode.Should().NotBeNullOrEmpty().And.Be(File.ReadAllText($"../../../Destination/{proxyClassPersonFilename}"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GenerateFiles_ForPnP_Should_GenerateCorrectFiles()
|
||||
{
|
||||
// Arrange
|
||||
var fileNames = new[]
|
||||
{
|
||||
"ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject.g.cs",
|
||||
"ProxyInterfaceSourceGeneratorTests.Source.PnP.IWeb.g.cs",
|
||||
"ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientRuntimeContext.g.cs",
|
||||
"ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientContext.g.cs",
|
||||
|
||||
"Microsoft.SharePoint.Client.ClientObjectProxy.g.cs",
|
||||
"Microsoft.SharePoint.Client.WebProxy.g.cs",
|
||||
"Microsoft.SharePoint.Client.ClientRuntimeContextProxy.g.cs",
|
||||
"Microsoft.SharePoint.Client.ClientContextProxy.g.cs"
|
||||
};
|
||||
|
||||
var pathClientObject = "./Source/PnP/IClientObject.cs";
|
||||
var sourceFileClientObject = new SourceFile
|
||||
{
|
||||
Path = pathClientObject,
|
||||
Text = File.ReadAllText(pathClientObject),
|
||||
AttributeToAddToInterface = new ExtraAttribute
|
||||
{
|
||||
Name = "ProxyInterfaceGenerator.Proxy",
|
||||
ArgumentList = "typeof(Microsoft.SharePoint.Client.ClientObject)"
|
||||
}
|
||||
};
|
||||
|
||||
var pathWeb = "./Source/PnP/IWeb.cs";
|
||||
var sourceFileWeb = new SourceFile
|
||||
{
|
||||
Path = pathWeb,
|
||||
Text = File.ReadAllText(pathWeb),
|
||||
AttributeToAddToInterface = new ExtraAttribute
|
||||
{
|
||||
Name = "ProxyInterfaceGenerator.Proxy",
|
||||
ArgumentList = "typeof(Web)" // Only name, no namespace
|
||||
}
|
||||
};
|
||||
|
||||
var pathClientRuntimeContext = "./Source/Pnp/IClientRuntimeContext.cs";
|
||||
var sourceFileClientRuntimeContext = new SourceFile
|
||||
{
|
||||
Path = pathClientRuntimeContext,
|
||||
Text = File.ReadAllText(pathClientRuntimeContext),
|
||||
AttributeToAddToInterface = new ExtraAttribute
|
||||
{
|
||||
Name = "ProxyInterfaceGenerator.Proxy",
|
||||
ArgumentList = "typeof(Microsoft.SharePoint.Client.ClientRuntimeContext)"
|
||||
}
|
||||
};
|
||||
|
||||
var pathClientContext = "./Source/PnP/IClientContext.cs";
|
||||
var sourceFileClientContext = new SourceFile
|
||||
{
|
||||
Path = pathClientContext,
|
||||
Text = File.ReadAllText(pathClientContext),
|
||||
AttributeToAddToInterface = new ExtraAttribute
|
||||
{
|
||||
Name = "ProxyInterfaceGenerator.Proxy",
|
||||
ArgumentList = "typeof(ClientContext)" // Only name, no namespace
|
||||
}
|
||||
};
|
||||
|
||||
// Act
|
||||
var result = _sut.Execute(new[]
|
||||
{
|
||||
sourceFileClientObject,
|
||||
sourceFileWeb,
|
||||
sourceFileClientRuntimeContext,
|
||||
sourceFileClientContext
|
||||
});
|
||||
|
||||
// Assert
|
||||
result.Valid.Should().BeTrue();
|
||||
result.Files.Should().HaveCount(fileNames.Length + 1);
|
||||
|
||||
foreach (var fileName in fileNames.Select((fileName, index) => new { fileName, index }))
|
||||
{
|
||||
var builder = result.Files[fileName.index + 1]; // +1 means skip the attribute
|
||||
builder.Path.Should().EndWith(fileName.fileName);
|
||||
|
||||
if (Write) File.WriteAllText($"../../../Destination/{fileName.fileName}", builder.Text);
|
||||
builder.Text.Should().Be(File.ReadAllText($"../../../Destination/{fileName.fileName}"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -9,17 +9,17 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoMapper" Version="10.1.1" />
|
||||
<PackageReference Include="FluentAssertions" Version="5.10.3" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
|
||||
<PackageReference Include="Moq" Version="4.17.2" />
|
||||
<PackageReference Include="PnP.Framework" Version="1.8.0" />
|
||||
<PackageReference Include="xunit" Version="2.4.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
|
||||
<PackageReference Include="AutoMapper" Version="11.0.1" />
|
||||
<PackageReference Include="FluentAssertions" Version="6.7.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.1" />
|
||||
<PackageReference Include="Moq" Version="4.18.2" />
|
||||
<PackageReference Include="PnP.Framework" Version="1.10.0" />
|
||||
<PackageReference Include="xunit" Version="2.4.2" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="coverlet.collector" Version="3.1.0">
|
||||
<PackageReference Include="coverlet.collector" Version="3.1.2">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
@@ -30,7 +30,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CSharp.SourceGenerators.Extensions" Version="0.0.8" />
|
||||
<PackageReference Include="CSharp.SourceGenerators.Extensions" Version="0.0.9" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -9,19 +9,19 @@ namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
{
|
||||
public partial class ClientRuntimeContextProxy
|
||||
{
|
||||
public T CastTo2<T>(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject obj)
|
||||
where T : ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject
|
||||
//where TOriginal : Microsoft.SharePoint.Client.ClientObject
|
||||
{
|
||||
Microsoft.SharePoint.Client.ClientObject obj_ = _mapper.Map<Microsoft.SharePoint.Client.ClientObject>(obj);
|
||||
var result_366781530 = _Instance.CastTo<Microsoft.SharePoint.Client.ClientObject>(obj_);
|
||||
return _mapper.Map<T>(result_366781530);
|
||||
}
|
||||
//public T CastTo2<T>(ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject obj)
|
||||
// where T : ProxyInterfaceSourceGeneratorTests.Source.PnP.IClientObject
|
||||
// //where TOriginal : Microsoft.SharePoint.Client.ClientObject
|
||||
//{
|
||||
// Microsoft.SharePoint.Client.ClientObject obj_ = _mapper.Map<Microsoft.SharePoint.Client.ClientObject>(obj);
|
||||
// var result_366781530 = _Instance.CastTo<Microsoft.SharePoint.Client.ClientObject>(obj_);
|
||||
// return _mapper.Map<T>(result_366781530);
|
||||
//}
|
||||
|
||||
public void X()
|
||||
{
|
||||
var x = CastTo2<ClientObjectProxy>(new ClientObjectProxy(default));
|
||||
}
|
||||
//public void X()
|
||||
//{
|
||||
// var x = CastTo2<ClientObjectProxy>(new ClientObjectProxy(default));
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
{
|
||||
// [ProxyInterfaceGenerator.Proxy(typeof(SecurableObject))]
|
||||
public partial interface ISecurableObject : IClientObject
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@ using Microsoft.SharePoint.Client;
|
||||
|
||||
namespace ProxyInterfaceSourceGeneratorTests.Source.PnP
|
||||
{
|
||||
public partial interface IWeb
|
||||
public partial interface IWeb : ISecurableObject
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user