preparing to feed abstract
test should run ok [modulo config]
This commit is contained in:
@ -65,7 +65,7 @@ namespace Yavsc.Models.Billing
|
|||||||
public DateTime? ValidationDate {get; set;}
|
public DateTime? ValidationDate {get; set;}
|
||||||
|
|
||||||
|
|
||||||
[Display(Name="Montant prévisionel de la préstation")]
|
[Display(Name="Previsional")]
|
||||||
public decimal? Previsional { get; set; }
|
public decimal? Previsional { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The bill
|
/// The bill
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using Microsoft.AspNet.Http.Authentication;
|
|
||||||
|
|
||||||
namespace Yavsc.ViewModels.Account
|
namespace Yavsc.ViewModels.Account
|
||||||
{
|
{
|
||||||
@ -49,6 +48,13 @@ namespace Yavsc.ViewModels.Account
|
|||||||
/// Lists external identity provider descriptions.
|
/// Lists external identity provider descriptions.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>an enumeration of the descriptions.</returns>
|
/// <returns>an enumeration of the descriptions.</returns>
|
||||||
public IEnumerable<AuthenticationDescription> ExternalProviders { get; set; }
|
public IEnumerable<YaAuthenticationDescription> ExternalProviders { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class YaAuthenticationDescription {
|
||||||
|
public string DisplayName { get; set; }
|
||||||
|
public string AuthenticationScheme { get; set; }
|
||||||
|
|
||||||
|
public IDictionary<string,object> Items { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
namespace Yavsc.Models.Auth
|
namespace Yavsc.Models.Auth
|
||||||
{
|
{
|
||||||
public class Me : IApplicationUser {
|
public class Me : IApplicationUser {
|
||||||
public Me(ApplicationUser user)
|
public Me(string userId, string userName, string email, string avatar, ILocation address, string gCalId)
|
||||||
{
|
{
|
||||||
Id = user.Id;
|
Id = userId;
|
||||||
UserName = user.UserName;
|
UserName = userName;
|
||||||
EMail = user.Email;
|
EMail = email;
|
||||||
Avatar = user.Avatar;
|
Avatar = avatar;
|
||||||
PostalAddress = user.PostalAddress;
|
PostalAddress = address;
|
||||||
DedicatedGoogleCalendar = user.DedicatedGoogleCalendar;
|
DedicatedGoogleCalendar = gCalId;
|
||||||
}
|
}
|
||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
public string UserName { get; set; }
|
public string UserName { get; set; }
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.AspNet.Identity.EntityFramework;
|
|
||||||
|
|
||||||
namespace Yavsc.ViewModels.Administration
|
namespace Yavsc.ViewModels.Administration
|
||||||
{
|
{
|
||||||
@ -9,11 +8,11 @@ namespace Yavsc.ViewModels.Administration
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
public RoleInfo ( IdentityRole role)
|
public RoleInfo ( string roleName, string roleId, string[] users)
|
||||||
{
|
{
|
||||||
Name = role.Name;
|
Name = roleName; // role.Name;
|
||||||
Id = role.Id;
|
Id = roleId; // role.Id;
|
||||||
Users = role.Users.Select(u => u.UserId).ToArray();
|
Users = users ; // role.Users.Select(u => u.UserId).ToArray();
|
||||||
}
|
}
|
||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
@ -141,7 +141,9 @@ namespace Yavsc.WebApi.Controllers
|
|||||||
.Include(u=>u.Roles)
|
.Include(u=>u.Roles)
|
||||||
.FirstAsync(u=>u.Id == uid);
|
.FirstAsync(u=>u.Id == uid);
|
||||||
|
|
||||||
var user = new Me(userData);
|
var user = new Me(userData.Id, userData.UserName, userData.Email,
|
||||||
|
userData.Avatar ,
|
||||||
|
userData.PostalAddress, userData.DedicatedGoogleCalendar );
|
||||||
|
|
||||||
var userRoles = _dbContext.UserRoles.Where(u=>u.UserId == uid).ToArray();
|
var userRoles = _dbContext.UserRoles.Where(u=>u.UserId == uid).ToArray();
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ using Newtonsoft.Json;
|
|||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
using Microsoft.AspNet.Http.Authentication;
|
||||||
using Yavsc.Abstract.Manage;
|
using Yavsc.Abstract.Manage;
|
||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
|
|
||||||
@ -84,6 +85,7 @@ namespace Yavsc.Controllers
|
|||||||
var properties = _signInManager.ConfigureExternalAuthenticationProperties(OpenIdConnectDefaults.AuthenticationScheme, returnUrl);
|
var properties = _signInManager.ConfigureExternalAuthenticationProperties(OpenIdConnectDefaults.AuthenticationScheme, returnUrl);
|
||||||
return new ChallengeResult(OpenIdConnectDefaults.AuthenticationScheme, properties);
|
return new ChallengeResult(OpenIdConnectDefaults.AuthenticationScheme, properties);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
|
@ -3,17 +3,24 @@ using System.Linq;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.AspNet.Http;
|
using Microsoft.AspNet.Http;
|
||||||
using Microsoft.AspNet.Http.Authentication;
|
using Microsoft.AspNet.Http.Authentication;
|
||||||
|
using Yavsc.ViewModels.Account;
|
||||||
|
|
||||||
namespace Yavsc.Helpers {
|
namespace Yavsc.Helpers {
|
||||||
public static class HttpContextExtensions {
|
public static class HttpContextExtensions {
|
||||||
public static IEnumerable<AuthenticationDescription> GetExternalProviders(this HttpContext context) {
|
public static IEnumerable<YaAuthenticationDescription> GetExternalProviders(this HttpContext context) {
|
||||||
if (context == null) {
|
if (context == null) {
|
||||||
throw new ArgumentNullException(nameof(context));
|
throw new ArgumentNullException(nameof(context));
|
||||||
}
|
}
|
||||||
|
|
||||||
return from description in context.Authentication.GetAuthenticationSchemes()
|
return from description in context.Authentication.GetAuthenticationSchemes()
|
||||||
where !string.IsNullOrEmpty(description.DisplayName)
|
where !string.IsNullOrEmpty(description.DisplayName)
|
||||||
select description;
|
select
|
||||||
|
( new YaAuthenticationDescription
|
||||||
|
{
|
||||||
|
DisplayName = description.DisplayName,
|
||||||
|
AuthenticationScheme = description.AuthenticationScheme,
|
||||||
|
Items = description.Items
|
||||||
|
});;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsProviderSupported(this HttpContext context, string provider) {
|
public static bool IsProviderSupported(this HttpContext context, string provider) {
|
||||||
|
@ -336,6 +336,7 @@
|
|||||||
<data name="PreferedDate"><value>Date souhaitée</value></data>
|
<data name="PreferedDate"><value>Date souhaitée</value></data>
|
||||||
<data name="PresationLocation"><value>Lieu de la présation: {0}.\n</value></data>
|
<data name="PresationLocation"><value>Lieu de la présation: {0}.\n</value></data>
|
||||||
<data name="Preview"><value>Prévisualiser</value><comment>Prévisualiser le document</comment></data>
|
<data name="Preview"><value>Prévisualiser</value><comment>Prévisualiser le document</comment></data>
|
||||||
|
<data name="Previsional"><value>Montant prévisionel de la préstation</value></data>
|
||||||
<data name="Profile edition"><value>Édition du profil</value></data>
|
<data name="Profile edition"><value>Édition du profil</value></data>
|
||||||
<data name="Product reference"><value>Référence produit</value></data>
|
<data name="Product reference"><value>Référence produit</value></data>
|
||||||
<data name="prestation"><value>prestation</value></data>
|
<data name="prestation"><value>prestation</value></data>
|
||||||
|
92
Yavsc.Server/Services/MessageServices.cs → Yavsc/Services/GCMSender.cs
Executable file → Normal file
92
Yavsc.Server/Services/MessageServices.cs → Yavsc/Services/GCMSender.cs
Executable file → Normal file
@ -1,48 +1,36 @@
|
|||||||
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using MailKit.Net.Smtp;
|
|
||||||
using MimeKit;
|
|
||||||
using MailKit.Security;
|
|
||||||
using System;
|
using System;
|
||||||
using Yavsc.Models.Messaging;
|
|
||||||
using Microsoft.AspNet.Identity;
|
|
||||||
using Yavsc.Models;
|
|
||||||
using Yavsc.Models.Google.Messaging;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Yavsc.Models.Haircut;
|
|
||||||
using Yavsc.Interfaces.Workflow;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Newtonsoft.Json;
|
|
||||||
using Yavsc.Server.Helpers;
|
|
||||||
using Microsoft.Extensions.OptionsModel;
|
using Microsoft.Extensions.OptionsModel;
|
||||||
using Yavsc.Abstract.Manage;
|
using Newtonsoft.Json;
|
||||||
|
using Yavsc.Interfaces.Workflow;
|
||||||
|
using Yavsc.Models.Google.Messaging;
|
||||||
|
using Yavsc.Models.Haircut;
|
||||||
|
using Yavsc.Models.Messaging;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Services
|
namespace Yavsc.Services
|
||||||
{
|
{
|
||||||
// This class is used by the application to send Email and SMS
|
public class GCMSender : IGoogleCloudMessageSender
|
||||||
// when you turn on two-factor authentication in ASP.NET Identity.
|
|
||||||
// For more details see this link http://go.microsoft.com/fwlink/?LinkID=532713
|
|
||||||
public class MessageSender : IEmailSender, IGoogleCloudMessageSender
|
|
||||||
{
|
{
|
||||||
private ILogger _logger;
|
private ILogger _logger;
|
||||||
SiteSettings siteSettings;
|
SiteSettings siteSettings;
|
||||||
SmtpSettings smtpSettings;
|
|
||||||
GoogleAuthSettings googleSettings;
|
GoogleAuthSettings googleSettings;
|
||||||
|
|
||||||
public MessageSender(
|
public GCMSender(
|
||||||
|
|
||||||
ILoggerFactory loggerFactory,
|
ILoggerFactory loggerFactory,
|
||||||
IOptions<SiteSettings> sitesOptions,
|
IOptions<SiteSettings> sitesOptions,
|
||||||
IOptions<SmtpSettings> smtpOptions,
|
IOptions<SmtpSettings> smtpOptions,
|
||||||
IOptions<GoogleAuthSettings> googleOptions
|
IOptions<GoogleAuthSettings> googleOptions
|
||||||
)
|
)
|
||||||
{
|
{ _logger = loggerFactory.CreateLogger<MailSender>();
|
||||||
_logger = loggerFactory.CreateLogger<MessageSender>();
|
|
||||||
siteSettings = sitesOptions?.Value;
|
siteSettings = sitesOptions?.Value;
|
||||||
smtpSettings = smtpOptions?.Value;
|
|
||||||
googleSettings = googleOptions?.Value;
|
googleSettings = googleOptions?.Value;
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
public async Task <MessageWithPayloadResponse> NotifyEvent<Event>
|
public async Task <MessageWithPayloadResponse> NotifyEvent<Event>
|
||||||
( IEnumerable<string> regids, Event ev)
|
( IEnumerable<string> regids, Event ev)
|
||||||
where Event : IEvent
|
where Event : IEvent
|
||||||
@ -74,15 +62,7 @@ namespace Yavsc.Services
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="googleSettings"></param>
|
|
||||||
/// <param name="registrationId"></param>
|
|
||||||
/// <param name="ev"></param>
|
|
||||||
/// <returns>a MessageWithPayloadResponse,
|
|
||||||
/// <c>bool somethingsent = (response.failure == 0 && response.success > 0)</c>
|
|
||||||
/// </returns>
|
|
||||||
public async Task<MessageWithPayloadResponse> NotifyBookQueryAsync( IEnumerable<string> registrationIds, RdvQueryEvent ev)
|
public async Task<MessageWithPayloadResponse> NotifyBookQueryAsync( IEnumerable<string> registrationIds, RdvQueryEvent ev)
|
||||||
{
|
{
|
||||||
return await NotifyEvent<RdvQueryEvent>(registrationIds, ev);
|
return await NotifyEvent<RdvQueryEvent>(registrationIds, ev);
|
||||||
@ -99,53 +79,11 @@ namespace Yavsc.Services
|
|||||||
return await NotifyEvent<HairCutQueryEvent>(registrationIds, ev);
|
return await NotifyEvent<HairCutQueryEvent>(registrationIds, ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<EmailSentViewModel> SendEmailAsync(string username, string email, string subject, string message)
|
public async Task<MessageWithPayloadResponse> NotifyAsync(IEnumerable<string> regids, IEvent yaev)
|
||||||
{
|
{
|
||||||
EmailSentViewModel model = new EmailSentViewModel{ EMail = email };
|
return await NotifyEvent<IEvent>(regids, yaev);
|
||||||
try
|
|
||||||
{
|
|
||||||
MimeMessage msg = new MimeMessage();
|
|
||||||
msg.From.Add(new MailboxAddress(
|
|
||||||
siteSettings.Owner.Name,
|
|
||||||
siteSettings.Owner.EMail));
|
|
||||||
msg.To.Add(new MailboxAddress(username, email));
|
|
||||||
msg.Body = new TextPart("plain")
|
|
||||||
{
|
|
||||||
Text = message
|
|
||||||
};
|
|
||||||
msg.Subject = subject;
|
|
||||||
msg.MessageId = MimeKit.Utils.MimeUtils.GenerateMessageId(
|
|
||||||
siteSettings.Authority
|
|
||||||
);
|
|
||||||
using (SmtpClient sc = new SmtpClient())
|
|
||||||
{
|
|
||||||
sc.Connect(
|
|
||||||
smtpSettings.Host,
|
|
||||||
smtpSettings.Port,
|
|
||||||
SecureSocketOptions.None);
|
|
||||||
sc.Send(msg);
|
|
||||||
model.MessageId = msg.MessageId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
model.Sent = false;
|
|
||||||
model.ErrorMessage = ex.Message;
|
|
||||||
return Task.FromResult<EmailSentViewModel>(model);
|
|
||||||
}
|
|
||||||
return Task.FromResult(model);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<bool> ValidateAsync(string purpose, string token, UserManager<ApplicationUser> manager, ApplicationUser user)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task<MessageWithPayloadResponse> NotifyAsync(
|
|
||||||
IEnumerable<string> regids, IEvent yaev)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
/* SMS with Twilio:
|
/* SMS with Twilio:
|
||||||
public Task SendSmsAsync(TwilioSettings twilioSettigns, string number, string message)
|
public Task SendSmsAsync(TwilioSettings twilioSettigns, string number, string message)
|
||||||
{
|
{
|
79
Yavsc/Services/MailSender.cs
Normal file
79
Yavsc/Services/MailSender.cs
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using MailKit.Net.Smtp;
|
||||||
|
using MailKit.Security;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Microsoft.Extensions.OptionsModel;
|
||||||
|
using MimeKit;
|
||||||
|
using Yavsc.Abstract.Manage;
|
||||||
|
|
||||||
|
namespace Yavsc.Services
|
||||||
|
{
|
||||||
|
public class MailSender : IEmailSender
|
||||||
|
{
|
||||||
|
private ILogger _logger;
|
||||||
|
SiteSettings siteSettings;
|
||||||
|
SmtpSettings smtpSettings;
|
||||||
|
|
||||||
|
public MailSender(
|
||||||
|
ILoggerFactory loggerFactory,
|
||||||
|
IOptions<SiteSettings> sitesOptions,
|
||||||
|
IOptions<SmtpSettings> smtpOptions,
|
||||||
|
IOptions<GoogleAuthSettings> googleOptions
|
||||||
|
)
|
||||||
|
{
|
||||||
|
_logger = loggerFactory.CreateLogger<MailSender>();
|
||||||
|
siteSettings = sitesOptions?.Value;
|
||||||
|
smtpSettings = smtpOptions?.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="googleSettings"></param>
|
||||||
|
/// <param name="registrationId"></param>
|
||||||
|
/// <param name="ev"></param>
|
||||||
|
/// <returns>a MessageWithPayloadResponse,
|
||||||
|
/// <c>bool somethingsent = (response.failure == 0 && response.success > 0)</c>
|
||||||
|
/// </returns>
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<EmailSentViewModel> SendEmailAsync(string username, string email, string subject, string message)
|
||||||
|
{
|
||||||
|
EmailSentViewModel model = new EmailSentViewModel{ EMail = email };
|
||||||
|
try
|
||||||
|
{
|
||||||
|
MimeMessage msg = new MimeMessage();
|
||||||
|
msg.From.Add(new MailboxAddress(
|
||||||
|
siteSettings.Owner.Name,
|
||||||
|
siteSettings.Owner.EMail));
|
||||||
|
msg.To.Add(new MailboxAddress(username, email));
|
||||||
|
msg.Body = new TextPart("plain")
|
||||||
|
{
|
||||||
|
Text = message
|
||||||
|
};
|
||||||
|
msg.Subject = subject;
|
||||||
|
msg.MessageId = MimeKit.Utils.MimeUtils.GenerateMessageId(
|
||||||
|
siteSettings.Authority
|
||||||
|
);
|
||||||
|
using (SmtpClient sc = new SmtpClient())
|
||||||
|
{
|
||||||
|
sc.Connect(
|
||||||
|
smtpSettings.Host,
|
||||||
|
smtpSettings.Port,
|
||||||
|
SecureSocketOptions.None);
|
||||||
|
sc.Send(msg);
|
||||||
|
model.MessageId = msg.MessageId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
model.Sent = false;
|
||||||
|
model.ErrorMessage = ex.Message;
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
27
Yavsc/Services/MessageServices.cs
Executable file
27
Yavsc/Services/MessageServices.cs
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using MailKit.Net.Smtp;
|
||||||
|
using MimeKit;
|
||||||
|
using MailKit.Security;
|
||||||
|
using System;
|
||||||
|
using Yavsc.Models.Messaging;
|
||||||
|
using Yavsc.Models;
|
||||||
|
using Yavsc.Models.Google.Messaging;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Yavsc.Models.Haircut;
|
||||||
|
using Yavsc.Interfaces.Workflow;
|
||||||
|
using System.Linq;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
using Yavsc.Abstract.Manage;
|
||||||
|
using Microsoft.AspNet.Identity;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Microsoft.Extensions.OptionsModel;
|
||||||
|
|
||||||
|
namespace Yavsc.Services
|
||||||
|
{
|
||||||
|
// This class is used by the application to send Email and SMS
|
||||||
|
// when you turn on two-factor authentication in ASP.NET Identity.
|
||||||
|
// For more details see this link http://go.microsoft.com/fwlink/?LinkID=532713
|
||||||
|
|
||||||
|
}
|
@ -172,14 +172,14 @@ namespace Yavsc
|
|||||||
};
|
};
|
||||||
|
|
||||||
branch.UseMiddleware<Yavsc.Auth.GoogleMiddleware>(YavscGoogleAppOptions);
|
branch.UseMiddleware<Yavsc.Auth.GoogleMiddleware>(YavscGoogleAppOptions);
|
||||||
|
/* FIXME 403
|
||||||
|
|
||||||
branch.UseTwitterAuthentication(options=>
|
branch.UseTwitterAuthentication(options=>
|
||||||
{
|
{
|
||||||
TwitterAppOptions = options;
|
TwitterAppOptions = options;
|
||||||
options.ConsumerKey = Configuration["Authentication:Twitter:ClientId"];
|
options.ConsumerKey = Configuration["Authentication:Twitter:ClientId"];
|
||||||
options.ConsumerSecret = Configuration["Authentication:Twitter:ClientSecret"];
|
options.ConsumerSecret = Configuration["Authentication:Twitter:ClientSecret"];
|
||||||
});
|
}); */
|
||||||
|
|
||||||
|
|
||||||
branch.UseOAuthAuthorizationServer(
|
branch.UseOAuthAuthorizationServer(
|
||||||
|
@ -242,8 +242,8 @@ namespace Yavsc
|
|||||||
services.AddTransient<ISecureDataFormat<AuthenticationTicket>, TicketDataFormat>();
|
services.AddTransient<ISecureDataFormat<AuthenticationTicket>, TicketDataFormat>();
|
||||||
|
|
||||||
// Add application services.
|
// Add application services.
|
||||||
services.AddTransient<IEmailSender, MessageSender>();
|
services.AddTransient<IEmailSender, MailSender>();
|
||||||
services.AddTransient<IGoogleCloudMessageSender, MessageSender>();
|
services.AddTransient<IGoogleCloudMessageSender, GCMSender>();
|
||||||
services.AddTransient<IBillingService, BillingService>();
|
services.AddTransient<IBillingService, BillingService>();
|
||||||
services.AddTransient<IDataStore, FileDataStore>( (sp) => new FileDataStore("googledatastore",false) );
|
services.AddTransient<IDataStore, FileDataStore>( (sp) => new FileDataStore("googledatastore",false) );
|
||||||
services.AddTransient<ICalendarManager, CalendarManager>();
|
services.AddTransient<ICalendarManager, CalendarManager>();
|
||||||
|
@ -36,10 +36,10 @@
|
|||||||
@Html.DisplayFor(model => model.Description)
|
@Html.DisplayFor(model => model.Description)
|
||||||
</dd>
|
</dd>
|
||||||
<dt>
|
<dt>
|
||||||
@Html.DisplayNameFor(model => model.LocalRepo)
|
@Html.DisplayNameFor(model => model.Repository)
|
||||||
</dt>
|
</dt>
|
||||||
<dd>
|
<dd>
|
||||||
@Html.DisplayFor(model => model.LocalRepo)
|
@Html.DisplayFor(model => model.Repository)
|
||||||
</dd>
|
</dd>
|
||||||
<dt>
|
<dt>
|
||||||
@Html.DisplayNameFor(model => model.OwnerId)
|
@Html.DisplayNameFor(model => model.OwnerId)
|
||||||
|
@ -10,6 +10,12 @@
|
|||||||
<h4>Project</h4>
|
<h4>Project</h4>
|
||||||
<hr />
|
<hr />
|
||||||
<dl class="dl-horizontal">
|
<dl class="dl-horizontal">
|
||||||
|
<dt>
|
||||||
|
@Html.DisplayNameFor(model => model.Name)
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
@Html.DisplayFor(model => model.Name)
|
||||||
|
</dd>
|
||||||
<dt>
|
<dt>
|
||||||
@Html.DisplayNameFor(model => model.Consent)
|
@Html.DisplayNameFor(model => model.Consent)
|
||||||
</dt>
|
</dt>
|
||||||
@ -35,10 +41,10 @@
|
|||||||
@Html.DisplayFor(model => model.Description)
|
@Html.DisplayFor(model => model.Description)
|
||||||
</dd>
|
</dd>
|
||||||
<dt>
|
<dt>
|
||||||
@Html.DisplayNameFor(model => model.LocalRepo)
|
@Html.DisplayNameFor(model => model.Repository)
|
||||||
</dt>
|
</dt>
|
||||||
<dd>
|
<dd>
|
||||||
@Html.DisplayFor(model => model.LocalRepo)
|
@Html.DisplayFor(model => model.Repository)
|
||||||
</dd>
|
</dd>
|
||||||
<dt>
|
<dt>
|
||||||
@Html.DisplayNameFor(model => model.OwnerId)
|
@Html.DisplayNameFor(model => model.OwnerId)
|
||||||
|
@ -13,88 +13,31 @@
|
|||||||
<div asp-validation-summary="ValidationSummary.ModelOnly" class="text-danger"></div>
|
<div asp-validation-summary="ValidationSummary.ModelOnly" class="text-danger"></div>
|
||||||
<input type="hidden" asp-for="Id" />
|
<input type="hidden" asp-for="Id" />
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="ActivityCode" class="control-label col-md-2">ActivityCode</label>
|
<label asp-for="Name" class="control-label col-md-2">Nom</label>
|
||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
<select asp-for="ActivityCode" class="form-control" />
|
<input asp-for="Name" class="form-control" />
|
||||||
<span asp-validation-for="ActivityCode" class="text-danger" />
|
<span asp-validation-for="Name" class="text-danger" ></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="ClientId" class="control-label col-md-2">ClientId</label>
|
<label asp-for="Description" class="col-md-2 control-label">Description</label>
|
||||||
<div class="col-md-10">
|
|
||||||
<select asp-for="ClientId" class="form-control" />
|
|
||||||
<span asp-validation-for="ClientId" class="text-danger" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="col-md-offset-2 col-md-10">
|
|
||||||
<div class="checkbox">
|
|
||||||
<input asp-for="Consent" />
|
|
||||||
<label asp-for="Consent"></label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label asp-for="DateCreated" class="col-md-2 control-label"></label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input asp-for="DateCreated" class="form-control" />
|
|
||||||
<span asp-validation-for="DateCreated" class="text-danger" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label asp-for="DateModified" class="col-md-2 control-label"></label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input asp-for="DateModified" class="form-control" />
|
|
||||||
<span asp-validation-for="DateModified" class="text-danger" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label asp-for="Description" class="col-md-2 control-label"></label>
|
|
||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
<input asp-for="Description" class="form-control" />
|
<input asp-for="Description" class="form-control" />
|
||||||
<span asp-validation-for="Description" class="text-danger" />
|
<span asp-validation-for="Description" class="text-danger" ></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="LocalRepo" class="col-md-2 control-label"></label>
|
<label asp-for="Repository" class="col-md-2 control-label">Repository</label>
|
||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
<input asp-for="LocalRepo" class="form-control" />
|
<input asp-for="Repository" class="form-control" />
|
||||||
<span asp-validation-for="LocalRepo" class="text-danger" />
|
<span asp-validation-for="Repository" class="text-danger" ></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="Name" class="control-label col-md-2">Name</label>
|
<label asp-for="Previsional" class="col-md-2 control-label">Prévisionel</label>
|
||||||
<div class="col-md-10">
|
|
||||||
<select asp-for="Name" class="form-control" />
|
|
||||||
<span asp-validation-for="Name" class="text-danger" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label asp-for="OwnerId" class="col-md-2 control-label"></label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input asp-for="OwnerId" class="form-control" />
|
|
||||||
<span asp-validation-for="OwnerId" class="text-danger" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label asp-for="PaymentId" class="control-label col-md-2">PaymentId</label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<select asp-for="PaymentId" class="form-control" />
|
|
||||||
<span asp-validation-for="PaymentId" class="text-danger" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label asp-for="PerformerId" class="control-label col-md-2">PerformerId</label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<select asp-for="PerformerId" class="form-control" />
|
|
||||||
<span asp-validation-for="PerformerId" class="text-danger" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label asp-for="Previsional" class="col-md-2 control-label"></label>
|
|
||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
<input asp-for="Previsional" class="form-control" />
|
<input asp-for="Previsional" class="form-control" />
|
||||||
<span asp-validation-for="Previsional" class="text-danger" />
|
<span asp-validation-for="Previsional" class="text-danger" ></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@ -105,13 +48,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
|
||||||
<label asp-for="RejectedAt" class="col-md-2 control-label"></label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input asp-for="RejectedAt" class="form-control" />
|
|
||||||
<span asp-validation-for="RejectedAt" class="text-danger" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="Status" class="col-md-2 control-label"></label>
|
<label asp-for="Status" class="col-md-2 control-label"></label>
|
||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
@ -119,27 +55,6 @@
|
|||||||
<span asp-validation-for="Status" class="text-danger" />
|
<span asp-validation-for="Status" class="text-danger" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
|
||||||
<label asp-for="UserCreated" class="col-md-2 control-label"></label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input asp-for="UserCreated" class="form-control" />
|
|
||||||
<span asp-validation-for="UserCreated" class="text-danger" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label asp-for="UserModified" class="col-md-2 control-label"></label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input asp-for="UserModified" class="form-control" />
|
|
||||||
<span asp-validation-for="UserModified" class="text-danger" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label asp-for="ValidationDate" class="col-md-2 control-label"></label>
|
|
||||||
<div class="col-md-10">
|
|
||||||
<input asp-for="ValidationDate" class="form-control" />
|
|
||||||
<span asp-validation-for="ValidationDate" class="text-danger" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="Version" class="col-md-2 control-label"></label>
|
<label asp-for="Version" class="col-md-2 control-label"></label>
|
||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
|
@ -11,6 +11,9 @@
|
|||||||
</p>
|
</p>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<tr>
|
<tr>
|
||||||
|
<th>
|
||||||
|
@Html.DisplayNameFor(model => model.Name)
|
||||||
|
</th>
|
||||||
<th>
|
<th>
|
||||||
@Html.DisplayNameFor(model => model.Consent)
|
@Html.DisplayNameFor(model => model.Consent)
|
||||||
</th>
|
</th>
|
||||||
@ -55,6 +58,9 @@
|
|||||||
|
|
||||||
@foreach (var item in Model) {
|
@foreach (var item in Model) {
|
||||||
<tr>
|
<tr>
|
||||||
|
<td>
|
||||||
|
@Html.DisplayFor(modelItem => item.Name)
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(modelItem => item.Consent)
|
@Html.DisplayFor(modelItem => item.Consent)
|
||||||
</td>
|
</td>
|
||||||
|
@ -1,25 +1,8 @@
|
|||||||
using System;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Configuration;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.OptionsModel;
|
|
||||||
|
|
||||||
using System.Globalization;
|
|
||||||
using System.Reflection;
|
|
||||||
// using Microsoft.AspNet.Authorization;
|
// using Microsoft.AspNet.Authorization;
|
||||||
using Microsoft.AspNet.Builder;
|
|
||||||
// using Microsoft.AspNet.Diagnostics;
|
// using Microsoft.AspNet.Diagnostics;
|
||||||
using Microsoft.AspNet.Hosting;
|
using Microsoft.AspNet.Hosting;
|
||||||
using Microsoft.AspNet.Identity;
|
|
||||||
using Microsoft.AspNet.Identity.EntityFramework;
|
|
||||||
using Microsoft.AspNet.Localization;
|
|
||||||
using Microsoft.AspNet.Mvc;
|
|
||||||
using Microsoft.AspNet.Mvc.Filters;
|
|
||||||
using Microsoft.AspNet.Mvc.Razor;
|
|
||||||
using Microsoft.Net.Http.Headers;
|
|
||||||
using Microsoft.AspNet.Razor;
|
|
||||||
using Microsoft.Extensions.DependencyInjection.Abstractions;
|
|
||||||
using Microsoft.Extensions.PlatformAbstractions;
|
|
||||||
using cli.Services;
|
using cli.Services;
|
||||||
|
|
||||||
namespace cli
|
namespace cli
|
||||||
|
@ -1,29 +1,23 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.CodeDom;
|
|
||||||
using System.CodeDom.Compiler;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
using Microsoft.CodeAnalysis;
|
using Microsoft.CodeAnalysis;
|
||||||
using Microsoft.CodeAnalysis.CSharp;
|
using Microsoft.CodeAnalysis.CSharp;
|
||||||
using Microsoft.CodeAnalysis.Emit;
|
using Microsoft.CodeAnalysis.Emit;
|
||||||
using Microsoft.AspNet.Razor;
|
using Microsoft.AspNet.Razor;
|
||||||
using Microsoft.AspNet.Razor.Generator;
|
|
||||||
using Microsoft.Extensions.Localization;
|
using Microsoft.Extensions.Localization;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.CSharp;
|
|
||||||
using Microsoft.AspNet.Identity.EntityFramework;
|
using Microsoft.AspNet.Identity.EntityFramework;
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Identity;
|
|
||||||
using Yavsc.Templates;
|
using Yavsc.Templates;
|
||||||
using Yavsc.Abstract.Templates;
|
using Yavsc.Abstract.Templates;
|
||||||
using Yavsc.Services;
|
using Yavsc.Services;
|
||||||
|
using Yavsc.Abstract.Manage;
|
||||||
|
|
||||||
namespace cli.Services
|
namespace cli.Services
|
||||||
{
|
{
|
||||||
@ -172,13 +166,17 @@ namespace cli.Services
|
|||||||
generatedtemplate.User = user;
|
generatedtemplate.User = user;
|
||||||
generatedtemplate.ExecuteAsync();
|
generatedtemplate.ExecuteAsync();
|
||||||
logger.LogInformation(generatedtemplate.GeneratedText);
|
logger.LogInformation(generatedtemplate.GeneratedText);
|
||||||
var mailSentInfo = this.mailSender.SendEmailAsync
|
EmailSentViewModel mailSentInfo = this.mailSender.SendEmailAsync
|
||||||
(user.UserName, user.Email, $"monthly email", generatedtemplate.GeneratedText).Result;
|
(user.UserName, user.Email, $"monthly email", generatedtemplate.GeneratedText).Result;
|
||||||
if (!mailSentInfo.Sent)
|
if (mailSentInfo==null)
|
||||||
|
logger.LogError("No info on sending");
|
||||||
|
else if (!mailSentInfo.Sent)
|
||||||
logger.LogError($"{mailSentInfo.ErrorMessage}");
|
logger.LogError($"{mailSentInfo.ErrorMessage}");
|
||||||
else
|
else
|
||||||
logger.LogInformation($"mailId:{mailSentInfo.MessageId} \nto:{user.UserName}");
|
logger.LogInformation($"mailId:{mailSentInfo.MessageId} \nto:{user.UserName}");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ namespace cli
|
|||||||
var smtpSettingsconf = Configuration.GetSection("Smtp");
|
var smtpSettingsconf = Configuration.GetSection("Smtp");
|
||||||
services.Configure<SmtpSettings>(smtpSettingsconf);
|
services.Configure<SmtpSettings>(smtpSettingsconf);
|
||||||
services.AddInstance(typeof(ILoggerFactory), new LoggerFactory());
|
services.AddInstance(typeof(ILoggerFactory), new LoggerFactory());
|
||||||
services.AddTransient(typeof(IEmailSender), typeof(MessageSender));
|
services.AddTransient(typeof(IEmailSender), typeof(MailSender));
|
||||||
services.AddTransient(typeof(RazorEngineHost), typeof(YaRazorEngineHost));
|
services.AddTransient(typeof(RazorEngineHost), typeof(YaRazorEngineHost));
|
||||||
services.AddEntityFramework().AddNpgsql().AddDbContext<ApplicationDbContext>();
|
services.AddEntityFramework().AddNpgsql().AddDbContext<ApplicationDbContext>();
|
||||||
services.AddTransient((s) => new RazorTemplateEngine(s.GetService<RazorEngineHost>()));
|
services.AddTransient((s) => new RazorTemplateEngine(s.GetService<RazorEngineHost>()));
|
||||||
|
@ -44,15 +44,15 @@
|
|||||||
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0-beta4",
|
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0-beta4",
|
||||||
"Newtonsoft.Json": "9.0.1",
|
"Newtonsoft.Json": "9.0.1",
|
||||||
"Yavsc": {
|
"Yavsc": {
|
||||||
"version": "1.0.5-rc21-beta7",
|
"version": "1.0.5-rc21-beta8",
|
||||||
"target": "package"
|
"target": "package"
|
||||||
},
|
},
|
||||||
"Yavsc.Abstract": {
|
"Yavsc.Abstract": {
|
||||||
"version": "1.0.5-rc21-beta7",
|
"version": "1.0.5-rc21-beta8",
|
||||||
"target": "package"
|
"target": "package"
|
||||||
},
|
},
|
||||||
"Yavsc.Server": {
|
"Yavsc.Server": {
|
||||||
"version": "1.0.5-rc21-beta7",
|
"version": "1.0.5-rc21-beta8",
|
||||||
"target": "package"
|
"target": "package"
|
||||||
},
|
},
|
||||||
"Yavsc.Lib.Portable": "1.0.2"
|
"Yavsc.Lib.Portable": "1.0.2"
|
||||||
|
@ -1 +1 @@
|
|||||||
21-beta7
|
21-beta8
|
||||||
|
24
test/YavscServerFactory.cs
Normal file
24
test/YavscServerFactory.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNet.Hosting.Server;
|
||||||
|
using Microsoft.AspNet.Http.Features;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Yavsc.Models;
|
||||||
|
|
||||||
|
namespace Yavsc.Server
|
||||||
|
{
|
||||||
|
public class cliServerFactory : IServerFactory
|
||||||
|
{
|
||||||
|
public IFeatureCollection Initialize(IConfiguration configuration)
|
||||||
|
{
|
||||||
|
FeatureCollection featureCollection = new FeatureCollection();
|
||||||
|
return featureCollection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IDisposable Start(IFeatureCollection serverFeatures, Func<IFeatureCollection, Task> application)
|
||||||
|
{
|
||||||
|
var task = application(serverFeatures);
|
||||||
|
return task;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
24
test/appsettings.json
Normal file
24
test/appsettings.json
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"Site": {
|
||||||
|
"Authority": "dev.pschneider.fr",
|
||||||
|
"Title": "Yavsc dev",
|
||||||
|
"Slogan": "Yavsc : WIP.",
|
||||||
|
"Banner": "/images/yavsc.png",
|
||||||
|
"HomeViewName": "Home",
|
||||||
|
"FavIcon": "/favicon.ico",
|
||||||
|
"Icon": "/images/yavsc.png"
|
||||||
|
},
|
||||||
|
"Logging": {
|
||||||
|
"IncludeScopes": true,
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Debug",
|
||||||
|
"System": "Warning",
|
||||||
|
"Microsoft": "Warning"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Data": {
|
||||||
|
"DefaultConnection": {
|
||||||
|
"ConnectionString": "Server=localhost;Port=5432;Database=YavscDev;Username=yavscdev;Password=admin;"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -28,24 +28,23 @@
|
|||||||
"defaultNamespace": "Yavsc"
|
"defaultNamespace": "Yavsc"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Yavsc": {
|
|
||||||
"target": "project"
|
|
||||||
},
|
|
||||||
"Newtonsoft.Json": "9.0.1",
|
"Newtonsoft.Json": "9.0.1",
|
||||||
"xunit": "2.1.0",
|
"xunit": "2.1.0",
|
||||||
"xunit.analyzers": "0.9.0",
|
"xunit.analyzers": "0.9.0",
|
||||||
"xunit.assert": "2.1.0",
|
"xunit.assert": "2.1.0",
|
||||||
"xunit.runner.console": "2.1.0",
|
"xunit.runner.console": "2.4.0-rc.2.build4045",
|
||||||
"Microsoft.Dnx.TestHost": "1.0.0-rc1-final",
|
"Microsoft.Dnx.TestHost": "1.0.0-rc1-final",
|
||||||
"Microsoft.Dnx.Runtime": "1.0.0-rc1-final",
|
"Microsoft.Dnx.Runtime": "1.0.0-rc1-final",
|
||||||
"xunit.runner.dnx": "2.1.0-rc1-build204",
|
"xunit.runner.dnx": "2.1.0-rc1-build204",
|
||||||
"Yavsc.Abstract": "1.0.5-rc21-beta5",
|
"Yavsc": {
|
||||||
"Yavsc.Server": "1.0.5-rc21-beta5"
|
"target": "project"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"dnx451": {}
|
"dnx451": {}
|
||||||
},
|
},
|
||||||
"commands": {
|
"commands": {
|
||||||
"test": "xunit.runner.dnx"
|
"test": "xunit.runner.dnx"
|
||||||
}
|
},
|
||||||
|
"userSecretsId": "aspnet5-YavscWeb-a0dadd21-2ced-43d3-96f9-7e504345102f"
|
||||||
}
|
}
|
43
test/src/EMailling.cs
Normal file
43
test/src/EMailling.cs
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.AspNet.Hosting;
|
||||||
|
using Microsoft.AspNet.Hosting.Internal;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Microsoft.Extensions.OptionsModel;
|
||||||
|
using Xunit;
|
||||||
|
using Xunit.Abstractions;
|
||||||
|
using Yavsc.Abstract.Manage;
|
||||||
|
using Yavsc.Lib;
|
||||||
|
using Yavsc.Services;
|
||||||
|
|
||||||
|
namespace Yavsc.test
|
||||||
|
{
|
||||||
|
|
||||||
|
[Collection("EMaillingTeststCollection")]
|
||||||
|
public class EMaillingTests : IClassFixture<ServerSideFixture>
|
||||||
|
|
||||||
|
{
|
||||||
|
ServerSideFixture _serverFixture;
|
||||||
|
ITestOutputHelper output;
|
||||||
|
public EMaillingTests(ServerSideFixture serverFixture, ITestOutputHelper output)
|
||||||
|
{
|
||||||
|
this.output = output;
|
||||||
|
_serverFixture = serverFixture;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void SendEMailSynchrone()
|
||||||
|
{
|
||||||
|
output.WriteLine("SendEMailSynchrone ...");
|
||||||
|
EmailSentViewModel mailSentInfo = _serverFixture._mailSender.SendEmailAsync
|
||||||
|
(_serverFixture._siteSetup.Owner.Name, _serverFixture._siteSetup.Owner.EMail, $"monthly email", "test boby monthly email").Result;
|
||||||
|
if (mailSentInfo==null)
|
||||||
|
_serverFixture._logger.LogError("No info on sending");
|
||||||
|
else if (!mailSentInfo.Sent)
|
||||||
|
_serverFixture._logger.LogError($"{mailSentInfo.ErrorMessage}");
|
||||||
|
else
|
||||||
|
_serverFixture._logger.LogInformation($"mailId:{mailSentInfo.MessageId} \nto:{_serverFixture._siteSetup.Owner.Name}");
|
||||||
|
Assert.NotNull(mailSentInfo);
|
||||||
|
output.WriteLine($">>done with {mailSentInfo.EMail} {mailSentInfo.Sent} {mailSentInfo.MessageId} {mailSentInfo.ErrorMessage}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
54
test/src/NotWorking.cs
Normal file
54
test/src/NotWorking.cs
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
// // NotWorking.cs
|
||||||
|
// /*
|
||||||
|
// paul 21/06/2018 10:16 20182018 6 21
|
||||||
|
// */
|
||||||
|
using System;
|
||||||
|
using Microsoft.AspNet.Builder;
|
||||||
|
using Microsoft.Extensions.Localization;
|
||||||
|
using Microsoft.Extensions.OptionsModel;
|
||||||
|
using Microsoft.Extensions.PlatformAbstractions;
|
||||||
|
using Xunit;
|
||||||
|
using Microsoft.Dnx.Compilation.CSharp;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.AspNet.Builder.Internal;
|
||||||
|
using Yavsc;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace Test
|
||||||
|
{
|
||||||
|
[Collection("Yavsc dropped intents")]
|
||||||
|
public class NotWorking : BaseTestContext
|
||||||
|
{
|
||||||
|
|
||||||
|
public void StringLocalizer()
|
||||||
|
{
|
||||||
|
var services = new ServiceCollection();
|
||||||
|
// IHostingEnvironment env = null;
|
||||||
|
// IOptions<SiteSettings> siteSettings;
|
||||||
|
|
||||||
|
services.AddTransient<IRuntimeEnvironment>(
|
||||||
|
svs => PlatformServices.Default.Runtime
|
||||||
|
);
|
||||||
|
beforeCompileContext = YavscMandatory.CreateYavscCompilationContext();
|
||||||
|
var prjDir = beforeCompileContext.ProjectContext.ProjectDirectory;
|
||||||
|
YavscMandatory.ConfigureServices(services, prjDir, out configuration, out provider);
|
||||||
|
|
||||||
|
IApplicationBuilder app = new ApplicationBuilder(provider);
|
||||||
|
var rtd = app.Build();
|
||||||
|
IOptions<LocalizationOptions> localOptions = Activator.CreateInstance<IOptions<LocalizationOptions>>(); ;
|
||||||
|
// TODO build applicationEnvironment
|
||||||
|
ResourceManagerStringLocalizerFactory strFact = new ResourceManagerStringLocalizerFactory
|
||||||
|
(applicationEnvironment, localOptions);
|
||||||
|
IStringLocalizer stringLocalizer = strFact.Create(typeof(NotWorking));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void NoDnxEnv()
|
||||||
|
{
|
||||||
|
|
||||||
|
IOptions<LocalizationOptions> localOptions = Activator.CreateInstance<IOptions<LocalizationOptions>>();
|
||||||
|
ResourceManagerStringLocalizerFactory strFact = new ResourceManagerStringLocalizerFactory(applicationEnvironment, localOptions);
|
||||||
|
IStringLocalizer stringLocalizer = strFact.Create(typeof(NotWorking));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
29
test/src/Program.cs
Normal file
29
test/src/Program.cs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
using Microsoft.AspNet.Hosting;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Yavsc.Lib;
|
||||||
|
using Yavsc.Services;
|
||||||
|
|
||||||
|
namespace Yavsc.test
|
||||||
|
{
|
||||||
|
public class Program
|
||||||
|
{
|
||||||
|
public Program()
|
||||||
|
{
|
||||||
|
var host = new WebHostBuilder();
|
||||||
|
|
||||||
|
var hostengnine = host
|
||||||
|
.UseEnvironment("Development")
|
||||||
|
.UseServer("test")
|
||||||
|
.UseStartup<Startup>()
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
var app = hostengnine.Start();
|
||||||
|
var sender = app.Services.GetService(typeof(IEmailSender)) as IEmailSender;
|
||||||
|
var mailer = app.Services.GetService(typeof(EMailer)) as EMailer;
|
||||||
|
var loggerFactory = app.Services.GetService(typeof(ILoggerFactory)) as ILoggerFactory;
|
||||||
|
ILogger logger = loggerFactory.CreateLogger<Program>() ;
|
||||||
|
mailer.SendMonthlyEmail(1,"UserOrientedTemplate");
|
||||||
|
logger.LogInformation("Finished");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
48
test/src/ServerSideFixture.cs
Normal file
48
test/src/ServerSideFixture.cs
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.AspNet.Hosting;
|
||||||
|
using Microsoft.AspNet.Hosting.Internal;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Microsoft.Extensions.OptionsModel;
|
||||||
|
using Yavsc.Lib;
|
||||||
|
using Yavsc.Services;
|
||||||
|
|
||||||
|
namespace Yavsc.test
|
||||||
|
{
|
||||||
|
public class ServerSideFixture : IDisposable {
|
||||||
|
public SiteSettings _siteSetup;
|
||||||
|
public ILogger _logger;
|
||||||
|
public IApplication _app;
|
||||||
|
public EMailer _mailer;
|
||||||
|
public ILoggerFactory _loggerFactory;
|
||||||
|
public IEmailSender _mailSender;
|
||||||
|
|
||||||
|
public ServerSideFixture()
|
||||||
|
{
|
||||||
|
InitServices();
|
||||||
|
_logger = _loggerFactory.CreateLogger<ServerSideFixture> ();
|
||||||
|
_logger.LogInformation("ServerSideFixture");
|
||||||
|
}
|
||||||
|
void InitServices()
|
||||||
|
{
|
||||||
|
var host = new WebHostBuilder();
|
||||||
|
|
||||||
|
var hostengnine = host
|
||||||
|
.UseEnvironment("Development")
|
||||||
|
.UseServer("test")
|
||||||
|
.UseStartup<Startup>()
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
_app = hostengnine.Start();
|
||||||
|
_mailer = _app.Services.GetService(typeof(EMailer)) as EMailer;
|
||||||
|
_loggerFactory = _app.Services.GetService(typeof(ILoggerFactory)) as ILoggerFactory;
|
||||||
|
var siteSetup = _app.Services.GetService(typeof(IOptions<SiteSettings>)) as IOptions<SiteSettings>;
|
||||||
|
_siteSetup = siteSetup.Value;
|
||||||
|
_mailSender = _app.Services.GetService(typeof(IEmailSender)) as IEmailSender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Disposing");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
100
test/src/Startup.cs
Normal file
100
test/src/Startup.cs
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Microsoft.Extensions.OptionsModel;
|
||||||
|
using Microsoft.AspNet.Builder;
|
||||||
|
using Microsoft.AspNet.Hosting;
|
||||||
|
using Microsoft.AspNet.Razor;
|
||||||
|
using Microsoft.Extensions.PlatformAbstractions;
|
||||||
|
using Yavsc;
|
||||||
|
using Yavsc.Models;
|
||||||
|
using Yavsc.Services;
|
||||||
|
using Microsoft.Data.Entity;
|
||||||
|
using Microsoft.AspNet.Authentication;
|
||||||
|
using Microsoft.Extensions.WebEncoders;
|
||||||
|
using Yavsc.Lib;
|
||||||
|
|
||||||
|
namespace Yavsc.test
|
||||||
|
{
|
||||||
|
public class Startup
|
||||||
|
{
|
||||||
|
public string ConnectionString
|
||||||
|
{
|
||||||
|
get ; set;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SiteSettings SiteSetup { get; private set; }
|
||||||
|
public static SmtpSettings SmtpSettup { get; private set; }
|
||||||
|
public static IConfiguration Configuration { get; set; }
|
||||||
|
|
||||||
|
public static string HostingFullName { get; private set; }
|
||||||
|
|
||||||
|
ILogger logger;
|
||||||
|
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv)
|
||||||
|
{
|
||||||
|
var devtag = env.IsDevelopment()?"D":"";
|
||||||
|
var prodtag = env.IsProduction()?"P":"";
|
||||||
|
var stagetag = env.IsStaging()?"S":"";
|
||||||
|
|
||||||
|
HostingFullName = $"{appEnv.RuntimeFramework.FullName} [{env.EnvironmentName}:{prodtag}{devtag}{stagetag}]";
|
||||||
|
// Set up configuration sources.
|
||||||
|
|
||||||
|
var builder = new ConfigurationBuilder()
|
||||||
|
.AddEnvironmentVariables()
|
||||||
|
.AddJsonFile("appsettings.json")
|
||||||
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);
|
||||||
|
Configuration = builder.Build();
|
||||||
|
ConnectionString = Configuration["Data:DefaultConnection:ConnectionString"];
|
||||||
|
AppDomain.CurrentDomain.SetData("YAVSC_CONNECTION", ConnectionString);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ConfigureServices (IServiceCollection services)
|
||||||
|
{
|
||||||
|
services.AddOptions();
|
||||||
|
var siteSettingsconf = Configuration.GetSection("Site");
|
||||||
|
services.Configure<SiteSettings>(siteSettingsconf);
|
||||||
|
var smtpSettingsconf = Configuration.GetSection("Smtp");
|
||||||
|
services.Configure<SmtpSettings>(smtpSettingsconf);
|
||||||
|
services.AddInstance(typeof(ILoggerFactory), new LoggerFactory());
|
||||||
|
services.AddTransient(typeof(IEmailSender), typeof(MailSender));
|
||||||
|
services.AddEntityFramework().AddNpgsql().AddDbContext<ApplicationDbContext>();
|
||||||
|
services.AddTransient((s) => new RazorTemplateEngine(s.GetService<RazorEngineHost>()));
|
||||||
|
services.AddLogging();
|
||||||
|
services.AddTransient<EMailer>();
|
||||||
|
services.AddLocalization(options =>
|
||||||
|
{
|
||||||
|
options.ResourcesPath = "Resources";
|
||||||
|
});
|
||||||
|
|
||||||
|
services.AddEntityFramework()
|
||||||
|
.AddNpgsql()
|
||||||
|
.AddDbContext<ApplicationDbContext>(
|
||||||
|
db => db.UseNpgsql(ConnectionString)
|
||||||
|
);
|
||||||
|
services.Configure<SharedAuthenticationOptions>(options =>
|
||||||
|
{
|
||||||
|
options.SignInScheme = "Bearer";
|
||||||
|
});
|
||||||
|
|
||||||
|
services.AddTransient<Microsoft.Extensions.WebEncoders.UrlEncoder, UrlEncoder>();
|
||||||
|
|
||||||
|
services.AddAuthentication();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Configure (IApplicationBuilder app, IHostingEnvironment env,
|
||||||
|
IOptions<SiteSettings> siteSettings, ILoggerFactory loggerFactory)
|
||||||
|
{
|
||||||
|
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
|
||||||
|
loggerFactory.AddDebug();
|
||||||
|
logger = loggerFactory.CreateLogger<Startup>();
|
||||||
|
logger.LogInformation(env.EnvironmentName);
|
||||||
|
var authConf = Configuration.GetSection("Authentication").GetSection("Yavsc");
|
||||||
|
var clientId = authConf.GetSection("ClientId").Value;
|
||||||
|
var clientSecret = authConf.GetSection("ClientSecret").Value;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
233
test/src/YavscMandatory.cs
Executable file
233
test/src/YavscMandatory.cs
Executable file
@ -0,0 +1,233 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.AspNet.Builder;
|
||||||
|
using Microsoft.AspNet.Builder.Internal;
|
||||||
|
using Microsoft.AspNet.Razor;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Localization;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Microsoft.Extensions.PlatformAbstractions;
|
||||||
|
using Xunit;
|
||||||
|
using Yavsc;
|
||||||
|
using Yavsc.Models;
|
||||||
|
using Yavsc.Services;
|
||||||
|
using System.Runtime.Versioning;
|
||||||
|
using Microsoft.AspNet.Mvc.Razor;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using Microsoft.Dnx.Compilation.CSharp;
|
||||||
|
using Microsoft.Extensions.OptionsModel;
|
||||||
|
using Yavsc.Helpers;
|
||||||
|
using Microsoft.Data.Entity;
|
||||||
|
using Xunit.Abstractions;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace Test
|
||||||
|
{
|
||||||
|
public class BaseTestContext {
|
||||||
|
protected IApplicationEnvironment applicationEnvironment = null;
|
||||||
|
protected IServiceProvider serviceProvider = null;
|
||||||
|
protected IConfigurationRoot configurationRoot;
|
||||||
|
protected BeforeCompileContext beforeCompileContext;
|
||||||
|
protected string testprojectAssetPath = "/home/paul/workspace/yavsc/Yavsc";
|
||||||
|
|
||||||
|
protected IServiceProvider provider;
|
||||||
|
protected IConfigurationRoot configuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Collection("Yavsc mandatory success story")]
|
||||||
|
public class YavscMandatory: BaseTestContext
|
||||||
|
{
|
||||||
|
private readonly ITestOutputHelper output;
|
||||||
|
public YavscMandatory(ITestOutputHelper output)
|
||||||
|
{
|
||||||
|
this.output = output;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
void TestStartNodeJsansitohtml()
|
||||||
|
{
|
||||||
|
var procStart = new ProcessStartInfo("env", "/usr/bin/nodejs node_modules/ansi-to-html/bin/ansi-to-html");
|
||||||
|
procStart.UseShellExecute = false;
|
||||||
|
procStart.RedirectStandardInput = true;
|
||||||
|
procStart.RedirectStandardOutput = true;
|
||||||
|
procStart.RedirectStandardError = true;
|
||||||
|
var proc = Process.Start(procStart);
|
||||||
|
|
||||||
|
proc.StandardInput.WriteLine("\x001b[30mblack\x1b[37mwhite");
|
||||||
|
proc.StandardInput.Close();
|
||||||
|
while (!proc.StandardOutput.EndOfStream)
|
||||||
|
{
|
||||||
|
output.WriteLine(proc.StandardOutput.ReadLine());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// actually uses node's ansi-to-html
|
||||||
|
[Fact]
|
||||||
|
void AnsiToHtml()
|
||||||
|
{
|
||||||
|
var procStart = new ProcessStartInfo("ls", "-l --color=always");
|
||||||
|
procStart.UseShellExecute = false;
|
||||||
|
procStart.RedirectStandardInput = false;
|
||||||
|
procStart.RedirectStandardOutput = true;
|
||||||
|
var proc = Process.Start(procStart);
|
||||||
|
var encoded = AnsiToHtmlEncoder.GetStream(proc.StandardOutput);
|
||||||
|
using (var reader = new StreamReader(encoded))
|
||||||
|
{
|
||||||
|
var txt = reader.ReadToEnd();
|
||||||
|
output.WriteLine(txt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void ApplicationDbContextExists()
|
||||||
|
{
|
||||||
|
var dbc = new ApplicationDbContext();
|
||||||
|
Assert.NotNull(dbc.GCMDevices);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void MvcRazorHostAndParser()
|
||||||
|
{
|
||||||
|
string cache = System.IO.Directory.GetCurrentDirectory();
|
||||||
|
MvcRazorHost host = new MvcRazorHost(cache);
|
||||||
|
var parser = host.CreateMarkupParser();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
void HaveDependecyInjection()
|
||||||
|
{
|
||||||
|
var services = new ServiceCollection();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
void HaveHost()
|
||||||
|
{
|
||||||
|
beforeCompileContext = CreateYavscCompilationContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void AConfigurationRoot()
|
||||||
|
{
|
||||||
|
var builder = new ConfigurationBuilder();
|
||||||
|
builder.AddJsonFile(Path.Combine(testprojectAssetPath, "appsettings.json"), false);
|
||||||
|
builder.AddJsonFile(Path.Combine(testprojectAssetPath, "appsettings.Development.json"), true);
|
||||||
|
configurationRoot = builder.Build();
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static BeforeCompileContext CreateYavscCompilationContext()
|
||||||
|
{
|
||||||
|
var projectContext = new ProjectContext();
|
||||||
|
projectContext.Name = "Yavsc";
|
||||||
|
projectContext.ProjectDirectory = "/home/paul/workspace/yavsc/Yavsc";
|
||||||
|
projectContext.ProjectFilePath = "/home/paul/workspace/yavsc/Yavsc/project.json";
|
||||||
|
projectContext.TargetFramework = new FrameworkName("DNX", new Version(4, 5, 1));
|
||||||
|
projectContext.Configuration = "Development";
|
||||||
|
|
||||||
|
return new BeforeCompileContext(
|
||||||
|
null, projectContext, () => null, () => null, () => null);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static IConfigurationRoot CreateConfiguration(string prjDir)
|
||||||
|
{
|
||||||
|
var builder = new ConfigurationBuilder();
|
||||||
|
|
||||||
|
builder.AddJsonFile(Path.Combine(prjDir, "appsettings.json"), true);
|
||||||
|
builder.AddJsonFile(Path.Combine(prjDir, "appsettings.Development.json"), true);
|
||||||
|
return builder.Build();
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static void ConfigureServices
|
||||||
|
(ServiceCollection serviceCollection,
|
||||||
|
string prjDir,
|
||||||
|
out IConfigurationRoot configuration,
|
||||||
|
out IServiceProvider provider)
|
||||||
|
{
|
||||||
|
configuration = CreateConfiguration(prjDir);
|
||||||
|
|
||||||
|
serviceCollection.AddOptions();
|
||||||
|
var siteSettingsconf = configuration.GetSection("Site");
|
||||||
|
serviceCollection.Configure<SiteSettings>(siteSettingsconf);
|
||||||
|
var smtpSettingsconf = configuration.GetSection("Smtp");
|
||||||
|
serviceCollection.Configure<SmtpSettings>(smtpSettingsconf);
|
||||||
|
var locOptions = configuration.GetSection("Localization");
|
||||||
|
serviceCollection.Configure<LocalizationOptions>(locOptions);
|
||||||
|
|
||||||
|
serviceCollection.AddSingleton(typeof(ILoggerFactory), typeof(LoggerFactory));
|
||||||
|
serviceCollection.AddTransient(typeof(IEmailSender), typeof(MailSender));
|
||||||
|
serviceCollection.AddTransient(typeof(RazorEngineHost));
|
||||||
|
serviceCollection.AddTransient((s) => new RazorTemplateEngine(s.GetService<RazorEngineHost>()));
|
||||||
|
serviceCollection.AddLogging();
|
||||||
|
serviceCollection.AddMvcCore();
|
||||||
|
serviceCollection.AddLocalization(options =>
|
||||||
|
{
|
||||||
|
options.ResourcesPath = "Resources";
|
||||||
|
});
|
||||||
|
var connectionString = configuration["Data:DefaultConnection:ConnectionString"];
|
||||||
|
AppDomain.CurrentDomain.SetData("YAVSC_DB_CONNECTION", connectionString);
|
||||||
|
serviceCollection.AddEntityFramework()
|
||||||
|
.AddNpgsql()
|
||||||
|
.AddDbContext<ApplicationDbContext>(
|
||||||
|
db => db.UseNpgsql(connectionString)
|
||||||
|
);
|
||||||
|
provider = serviceCollection.BuildServiceProvider();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void ARequestAppDelegate()
|
||||||
|
{
|
||||||
|
var services = new ServiceCollection();
|
||||||
|
|
||||||
|
services.AddTransient<IRuntimeEnvironment>(
|
||||||
|
svs => PlatformServices.Default.Runtime
|
||||||
|
);
|
||||||
|
|
||||||
|
HaveHost();
|
||||||
|
var prjDir = this.beforeCompileContext.ProjectContext.ProjectDirectory;
|
||||||
|
ConfigureServices(services, prjDir, out configurationRoot, out serviceProvider);
|
||||||
|
|
||||||
|
IApplicationBuilder app = new ApplicationBuilder(serviceProvider);
|
||||||
|
var rtd = app.Build();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void MessageSenderFromLib()
|
||||||
|
{
|
||||||
|
ARequestAppDelegate();
|
||||||
|
ILoggerFactory factory = ActivatorUtilities.GetServiceOrCreateInstance<ILoggerFactory>(serviceProvider);
|
||||||
|
var dbc = new ApplicationDbContext();
|
||||||
|
|
||||||
|
IOptions<SiteSettings> siteOptions =
|
||||||
|
ActivatorUtilities.GetServiceOrCreateInstance<IOptions<SiteSettings>>(serviceProvider);
|
||||||
|
;
|
||||||
|
IOptions<SmtpSettings> smtpOptions = ActivatorUtilities.GetServiceOrCreateInstance<IOptions<SmtpSettings>>(serviceProvider);
|
||||||
|
;
|
||||||
|
IOptions<GoogleAuthSettings> googleOptions = ActivatorUtilities.GetServiceOrCreateInstance<IOptions<GoogleAuthSettings>>(serviceProvider);
|
||||||
|
;
|
||||||
|
IEmailSender eSender = new MailSender
|
||||||
|
(factory, siteOptions, smtpOptions, googleOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void InitApplicationBuilder()
|
||||||
|
{
|
||||||
|
|
||||||
|
var services = new ServiceCollection();
|
||||||
|
|
||||||
|
services.AddTransient<IRuntimeEnvironment>(
|
||||||
|
svs => PlatformServices.Default.Runtime
|
||||||
|
);
|
||||||
|
beforeCompileContext = YavscMandatory.CreateYavscCompilationContext();
|
||||||
|
var prjDir = beforeCompileContext.ProjectContext.ProjectDirectory;
|
||||||
|
YavscMandatory.ConfigureServices(services, prjDir, out configuration, out provider);
|
||||||
|
|
||||||
|
IApplicationBuilder app = new ApplicationBuilder(provider);
|
||||||
|
app.UseMvc();
|
||||||
|
var rtd = app.Build();
|
||||||
|
IOptions<LocalizationOptions> localOptions = ActivatorUtilities.GetServiceOrCreateInstance<IOptions<LocalizationOptions>>(provider); ;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -24,7 +24,6 @@ namespace Test
|
|||||||
public class YavscWorkInProgress : BaseTestContext
|
public class YavscWorkInProgress : BaseTestContext
|
||||||
{
|
{
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void GitClone()
|
public void GitClone()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user