项目结构调整

This commit is contained in:
艾竹
2023-04-16 20:11:40 +08:00
parent cbfbf96033
commit 81f91f3f35
2124 changed files with 218 additions and 5516 deletions

View File

@@ -0,0 +1,130 @@
using System;
using System.Diagnostics;
using System.Windows.Controls;
using LiveCharts;
using LiveCharts.Dtos;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTests.MemoryLeaks
{
[TestClass]
public class DrawnShapes
{
[TestMethod]
public void ShapesMemoryLeaks()
{
//var theGuy = BuildATestDude();
//theGuy.MockIt(new CoreSize(200,200));
//theGuy.Update();
//var a = theGuy.GetDrawMarginElements();
//Action countIt = () => Debug.WriteLine("Canvas -- {0} --, DrawMargin -- {1} --",
// theGuy.GetCanvasElements(), theGuy.GetDrawMarginElements());
//Action<Canvas> iterateChildren = c =>
//{
// foreach (var child in c.Children)
// {
// Debug.WriteLine("{0} ({1})", child.GetType().Name, child.GetHashCode());
// }
//};
//var canvas = (Canvas) theGuy.GetCanvas();
////Initial Count...
//countIt();
//iterateChildren(canvas);
////when cleaning series...
//theGuy.Series.Clear();
//countIt();
//iterateChildren(canvas);
////When cleaning axes...
//countIt();
//theGuy.AxisX.Clear();
//countIt();
//theGuy.AxisY.Clear();
//countIt();
//iterateChildren(canvas);
//Assert.IsTrue(a > 0, "No shapes were drawn to test the garbage collector!");
//Assert.IsTrue(theGuy.GetDrawMarginElements() == 0,
// "There are shapes in the current DrawMargin, and no series to draw!");
//Assert.IsTrue(theGuy.GetCanvasElements() == 1,
// "There are unnecessary elements in the current chart!");
}
private static LiveCharts.Wpf.CartesianChart BuildATestDude()
{
return new LiveCharts.Wpf.CartesianChart
{
Series = new SeriesCollection
{
new LiveCharts.Wpf.LineSeries
{
Values = new ChartValues<double> {2, 4, 5, 2}
},
new LiveCharts.Wpf.VerticalLineSeries
{
Values = new ChartValues<double> {2, 4, 5, 2}
},
new LiveCharts.Wpf.ColumnSeries
{
Values = new ChartValues<double> {2, 4, 5, 2}
},
new LiveCharts.Wpf.RowSeries
{
Values = new ChartValues<double> {2, 4, 5, 2}
},
new LiveCharts.Wpf.StackedAreaSeries
{
Values = new ChartValues<double> {2, 4, 5, 2}
},
new LiveCharts.Wpf.VerticalStackedAreaSeries
{
Values = new ChartValues<double> {2, 4, 5, 2}
},
new LiveCharts.Wpf.StackedRowSeries
{
Values = new ChartValues<double> {2, 4, 5, 2}
},
new LiveCharts.Wpf.StackedRowSeries
{
Values = new ChartValues<double> {2, 4, 5, 2}
},
new LiveCharts.Wpf.StackedColumnSeries
{
Values = new ChartValues<double> {2, 4, 5, 2}
},
new LiveCharts.Wpf.StackedRowSeries
{
Values = new ChartValues<double> {2, 4, 5, 2}
},
new LiveCharts.Wpf.OhlcSeries()
{
Values = new ChartValues<double> {2, 4, 5, 2}
},
new LiveCharts.Wpf.ScatterSeries
{
Values = new ChartValues<double> {2, 4, 5, 2}
}
},
AxisX = new LiveCharts.Wpf.AxesCollection
{
new LiveCharts.Wpf.Axis
{
Sections = new LiveCharts.Wpf.SectionsCollection
{
new LiveCharts.Wpf.AxisSection { Value = 10, Label = "Hello!"},
new LiveCharts.Wpf.AxisSection { Value = 10},
new LiveCharts.Wpf.AxisSection { Value = 10}
}
}
}
};
}
}
}

View File

@@ -0,0 +1,33 @@
using System;
using System.Diagnostics;
using LiveCharts.Dtos;
using LiveCharts.Wpf;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTests.Other
{
[TestClass]
public class SharedSeries
{
[TestMethod]
public void SharingSeries()
{
//var aGuy = new CartesianChart();
//var bGuy = new CartesianChart();
//aGuy.MockIt(new CoreSize(200, 200));
//bGuy.MockIt(new CoreSize(200, 200));
//var aSeries = new LineSeries();
//aGuy.Series.Add(aSeries);
//aGuy.Update();
//Debug.WriteLine(aGuy.Series.Count);
//bGuy.Series.Add(aSeries);
//bGuy.Update();
//Debug.WriteLine(aGuy.Series.Count);
//Debug.WriteLine(bGuy.Series.Count);
}
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("UnitTests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UnitTests")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("658f1d11-ed2b-418c-b20d-30af74c3cb81")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,160 @@
using LiveCharts;
using LiveCharts.Dtos;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTests.SeriesAndValues
{
[TestClass]
public class NullAndEmpty
{
[TestMethod]
public void NullSeries()
{
//WPF and WinForms
//var theTestGuy = new LiveCharts.Wpf.CartesianChart
//{
// Series = null
//};
//theTestGuy.MockIt(new CoreSize(200, 200));
//theTestGuy.Update();
}
[TestMethod]
public void EmptySeries()
{
//WPF and WinForms
//var theTestGuy = new LiveCharts.Wpf.CartesianChart
//{
// Series = new SeriesCollection()
//};
//theTestGuy.MockIt(new CoreSize(200, 200));
//theTestGuy.Update();
}
[TestMethod]
public void NullValues()
{
//WPF and WinForms
//var theTestGuy = new LiveCharts.Wpf.CartesianChart
//{
// Series = new SeriesCollection
// {
// new LiveCharts.Wpf.LineSeries
// {
// Values = null
// },
// new LiveCharts.Wpf.VerticalLineSeries
// {
// Values = null
// },
// new LiveCharts.Wpf.ColumnSeries
// {
// Values = null
// },
// new LiveCharts.Wpf.RowSeries
// {
// Values = null
// },
// new LiveCharts.Wpf.StackedAreaSeries
// {
// Values = null
// },
// new LiveCharts.Wpf.VerticalStackedAreaSeries
// {
// Values = null
// },
// new LiveCharts.Wpf.StackedRowSeries
// {
// Values = null
// },
// new LiveCharts.Wpf.StackedRowSeries
// {
// Values = null
// },
// new LiveCharts.Wpf.StackedColumnSeries
// {
// Values = null
// },
// new LiveCharts.Wpf.StackedRowSeries
// {
// Values = null
// },
// new LiveCharts.Wpf.OhlcSeries
// {
// Values = null
// },
// new LiveCharts.Wpf.ScatterSeries
// {
// Values = null
// }
// }
//};
//theTestGuy.MockIt(new CoreSize(200, 200));
//theTestGuy.Update();
}
[TestMethod]
public void EmptyValues()
{
//WPF and WinForms
//var theTestGuy = new LiveCharts.Wpf.CartesianChart
//{
// Series = new SeriesCollection
// {
// new LiveCharts.Wpf.LineSeries
// {
// Values = new ChartValues<double>()
// },
// new LiveCharts.Wpf.VerticalLineSeries
// {
// Values = new ChartValues<double>()
// },
// new LiveCharts.Wpf.ColumnSeries
// {
// Values = new ChartValues<double>()
// },
// new LiveCharts.Wpf.RowSeries
// {
// Values = new ChartValues<double>()
// },
// new LiveCharts.Wpf.StackedAreaSeries
// {
// Values = new ChartValues<double>()
// },
// new LiveCharts.Wpf.VerticalStackedAreaSeries
// {
// Values = new ChartValues<double>()
// },
// new LiveCharts.Wpf.StackedRowSeries
// {
// Values = new ChartValues<double>()
// },
// new LiveCharts.Wpf.StackedRowSeries
// {
// Values = new ChartValues<double>()
// },
// new LiveCharts.Wpf.StackedColumnSeries
// {
// Values = new ChartValues<double>()
// },
// new LiveCharts.Wpf.StackedRowSeries
// {
// Values = new ChartValues<double>()
// },
// new LiveCharts.Wpf.OhlcSeries
// {
// Values = new ChartValues<double>()
// },
// new LiveCharts.Wpf.ScatterSeries
// {
// Values = new ChartValues<double>()
// }
// }
//};
//theTestGuy.MockIt(new CoreSize(200, 200));
//theTestGuy.Update();
}
}
}

View File

@@ -0,0 +1,28 @@
using System;
using LiveCharts;
using LiveCharts.Dtos;
using LiveCharts.Wpf;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTests.SeriesAndValues
{
[TestClass]
public class AutoColorSetter
{
[TestMethod]
public void AutoSeriesColors()
{
//var testguy = new CartesianChart();
//testguy.MockIt(new CoreSize(200, 200));
//var seriesCollection = new SeriesCollection();
//for (var i = 0; i < 100; i++)
//{
// seriesCollection.Add(new LineSeries {Values = new ChartValues<double> {1, 2, 3}});
//}
//testguy.Series = seriesCollection;
}
}
}

View File

@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{658F1D11-ED2B-418C-B20D-30AF74C3CB81}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UnitTests</RootNamespace>
<AssemblyName>UnitTests</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'r86|AnyCPU'">
<OutputPath>bin\r86\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'r64|AnyCPU'">
<OutputPath>bin\r64\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'arm|AnyCPU'">
<OutputPath>bin\arm\</OutputPath>
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Xaml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework">
<Private>False</Private>
</Reference>
</ItemGroup>
</Otherwise>
</Choose>
<ItemGroup>
<Compile Include="MemoryLeaks\DrawnShapes.cs" />
<Compile Include="Other\SharedSeries.cs" />
<Compile Include="SeriesAndValues\NullAndEmpty.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SeriesAndValues\SeriesAutoColors.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Core\Core.csproj">
<Project>{d447642c-a85f-4ab0-96d9-c66cff91aada}</Project>
<Name>Core</Name>
</ProjectReference>
<ProjectReference Include="..\WpfView\WpfView.csproj">
<Project>{4d253423-ae05-47f6-a59d-9162ec0bb1f2}</Project>
<Name>WpfView</Name>
</ProjectReference>
</ItemGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
</ItemGroup>
</When>
</Choose>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/@EntryValue">CSharp50</s:String></wpf:ResourceDictionary>