parent
e96192bded
commit
30d230b832
|
@ -82,7 +82,7 @@ namespace Bootstrap.Admin
|
|||
protected override void ConfigureClient(HttpClient client)
|
||||
{
|
||||
base.ConfigureClient(client);
|
||||
client.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.1 Safari/605.1.15");
|
||||
client.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1_UnitTest) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.1 Safari/605.1.15");
|
||||
}
|
||||
|
||||
private readonly CookieContainer _cookie = new CookieContainer();
|
||||
|
|
|
@ -132,9 +132,9 @@ namespace Bootstrap.DataAccess
|
|||
{
|
||||
var dict = new Dict();
|
||||
var ipSvr = dict.RetrieveLocaleIPSvr();
|
||||
Assert.Equal("JuheIPSvr", ipSvr);
|
||||
Assert.Equal("None", ipSvr);
|
||||
|
||||
var ipUri = dict.RetrieveLocaleIPSvrUrl(ipSvr);
|
||||
var ipUri = dict.RetrieveLocaleIPSvrUrl("JuheIPSvr");
|
||||
Assert.NotNull(ipUri);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ using Xunit;
|
|||
namespace Bootstrap.DataAccess
|
||||
{
|
||||
[Collection("SQLServerContext")]
|
||||
public class GroupsTest
|
||||
public class GroupsTest
|
||||
{
|
||||
[Fact]
|
||||
public void Retrieves_Ok()
|
||||
|
@ -56,7 +56,7 @@ namespace Bootstrap.DataAccess
|
|||
public void RetrievesByUserName_Ok()
|
||||
{
|
||||
Group p = new Group();
|
||||
Assert.NotEmpty(p.RetrievesByUserName("Admin"));
|
||||
Assert.NotNull(p.RetrievesByUserName("Admin"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace Bootstrap.DataAccess
|
|||
RequestUrl = "~/Home/Index"
|
||||
};
|
||||
log.Save(log);
|
||||
Assert.NotNull(log.Retrieves(new PaginationOption() { Limit = 20 }, null, null, null));
|
||||
Assert.NotNull(log.Retrieves(new PaginationOption() { Limit = 20, Order = "LogTime" }, null, null, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System.Linq;
|
||||
using Bootstrap.Security;
|
||||
using System.Linq;
|
||||
using Xunit;
|
||||
|
||||
namespace Bootstrap.DataAccess
|
||||
|
@ -9,7 +10,8 @@ namespace Bootstrap.DataAccess
|
|||
[Fact]
|
||||
public void Save_Ok()
|
||||
{
|
||||
var m = new Menu()
|
||||
var m = new Menu();
|
||||
var poco = new BootstrapMenu()
|
||||
{
|
||||
Name = "UnitTest",
|
||||
Application = "0",
|
||||
|
@ -22,8 +24,8 @@ namespace Bootstrap.DataAccess
|
|||
ParentId = "0"
|
||||
};
|
||||
m.Delete(m.RetrieveAllMenus("Admin").Where(n => n.Name == m.Name).Select(n => n.Id));
|
||||
Assert.True(m.Save(m));
|
||||
m.Delete(new string[] { m.Id });
|
||||
Assert.True(m.Save(poco));
|
||||
m.Delete(new string[] { poco.Id });
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -36,7 +38,8 @@ namespace Bootstrap.DataAccess
|
|||
[Fact]
|
||||
public void Delete_Ok()
|
||||
{
|
||||
var m = new Menu()
|
||||
var m = new Menu();
|
||||
var poco = new BootstrapMenu()
|
||||
{
|
||||
Name = "UnitTest",
|
||||
Application = "0",
|
||||
|
@ -48,8 +51,8 @@ namespace Bootstrap.DataAccess
|
|||
Url = "#",
|
||||
ParentId = "0"
|
||||
};
|
||||
m.Save(m);
|
||||
Assert.True(m.Delete(new string[] { m.Id }));
|
||||
m.Save(poco);
|
||||
Assert.True(m.Delete(new string[] { poco.Id }));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
using Xunit;
|
||||
|
||||
namespace Bootstrap.DataAccess.SQLite
|
||||
{
|
||||
[Collection("SQLiteContext")]
|
||||
public class ResetUserTest : DataAccess.ResetUserTest
|
||||
{
|
||||
|
||||
}
|
||||
}
|
Binary file not shown.
|
@ -1,3 +1,4 @@
|
|||
using Longbow.Data;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System;
|
||||
|
@ -49,14 +50,14 @@ namespace UnitTest
|
|||
private const string MySqlConnectionString = "Server=localhost;Database=UnitTest;Uid=argozhang;Pwd=argo@163.com;SslMode=none;allowPublicKeyRetrieval=true";
|
||||
private const string NpgSqlConnectionString = "Server=localhost;Database=UnitTest;User ID=argozhang;Password=sa;";
|
||||
|
||||
public static void ConfigureWebHost(IWebHostBuilder builder, string providerName = Longbow.Data.DatabaseProviderType.SqlServer)
|
||||
public static void ConfigureWebHost(IWebHostBuilder builder, DatabaseProviderType providerName = DatabaseProviderType.SqlServer)
|
||||
{
|
||||
builder.ConfigureAppConfiguration(app => app.AddInMemoryCollection(new KeyValuePair<string, string>[] {
|
||||
new KeyValuePair<string, string>("ConnectionStrings:ba", SqlConnectionString),
|
||||
new KeyValuePair<string, string>("DB:0:Enabled", "true")
|
||||
}));
|
||||
|
||||
if (providerName == Longbow.Data.DatabaseProviderType.SQLite)
|
||||
if (providerName == DatabaseProviderType.SQLite)
|
||||
{
|
||||
var dbPath = RetrievePath($"UnitTest{Path.DirectorySeparatorChar}DB{Path.DirectorySeparatorChar}UnitTest.db");
|
||||
var dbFile = Path.Combine(AppContext.BaseDirectory, "UnitTest.db");
|
||||
|
@ -69,7 +70,7 @@ namespace UnitTest
|
|||
}));
|
||||
}
|
||||
|
||||
if (providerName == Longbow.Data.DatabaseProviderType.MySql)
|
||||
if (providerName == DatabaseProviderType.MySql)
|
||||
{
|
||||
builder.ConfigureAppConfiguration(app => app.AddInMemoryCollection(new KeyValuePair<string, string>[] {
|
||||
new KeyValuePair<string, string>("DB:0:Enabled", "false"),
|
||||
|
@ -79,7 +80,7 @@ namespace UnitTest
|
|||
}));
|
||||
}
|
||||
|
||||
if (providerName == Longbow.Data.DatabaseProviderType.Npgsql)
|
||||
if (providerName == DatabaseProviderType.Npgsql)
|
||||
{
|
||||
builder.ConfigureAppConfiguration(app => app.AddInMemoryCollection(new KeyValuePair<string, string>[] {
|
||||
new KeyValuePair<string, string>("DB:0:Enabled", "false"),
|
||||
|
|
Loading…
Reference in New Issue