You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NuGetGallery/tests/CatalogTests/WarehouseCatalogTests.cs

54 lines
1.9 KiB
C#

using NuGet.Services.Metadata.Catalog;
using NuGet.Services.Metadata.Catalog.Persistence;
using NuGet.Services.Metadata.Catalog.WarehouseIntegration;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace CatalogTests
{
class WarehouseCatalogTests
{
public static void Test0()
{
Storage storage = new FileStorage("http://localhost:8000/demo", @"c:\data\site\demo");
SqlConnectionStringBuilder connStrBldr = new SqlConnectionStringBuilder();
connStrBldr.IntegratedSecurity = true;
connStrBldr.InitialCatalog = "TestSourceWarehouse";
connStrBldr.DataSource = @"(LocalDB)\v11.0";
string connectionString = connStrBldr.ToString();
WarehouseHelper.CreateStatisticsCatalogAsync(storage, connectionString).Wait();
}
public static void Test1()
{
Func<HttpMessageHandler> handlerFunc = () =>
{
return new FileSystemEmulatorHandler
{
BaseAddress = new Uri("http://localhost:8000"),
RootFolder = @"c:\data\site",
InnerHandler = new HttpClientHandler()
};
};
DateTime minDownloadTimeStamp = DateTime.Parse("2014-07-20");
//DateTime minDownloadTimeStamp = DateTime.MinValue;
StatsCountCollector collector = new StatsGreaterThanCountCollector(new Uri("http://localhost:8000/stats/index.json"), minDownloadTimeStamp, handlerFunc);
//StatsCountCollector collector = new StatsLessThanCountCollector(new Uri("http://localhost:8000/stats/index.json"), minDownloadTimeStamp, handlerFunc);
collector.Run().Wait();
Console.WriteLine("count = {0}", collector.Count);
}
}
}