Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 74bb2a59

Přidáno uživatelem Roman Kalivoda před téměř 4 roky(ů)

Re #8953 refactoring

Zobrazit rozdíly:

Server/ServerApp.sln
7 7
EndProject
8 8
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestProject", "TestProject\TestProject.csproj", "{8A09DB8E-64B1-4D55-991E-7F7B21996B45}"
9 9
EndProject
10
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServerAppTests", "ServerAppTests\ServerAppTests.csproj", "{E068474B-98FB-431D-84EB-000AA36D0FC5}"
11
EndProject
10 12
Global
11 13
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 14
		Debug|Any CPU = Debug|Any CPU
......
31 33
		{8A09DB8E-64B1-4D55-991E-7F7B21996B45}.Release|Any CPU.Build.0 = Release|Any CPU
32 34
		{8A09DB8E-64B1-4D55-991E-7F7B21996B45}.Release|x64.ActiveCfg = Release|Any CPU
33 35
		{8A09DB8E-64B1-4D55-991E-7F7B21996B45}.Release|x64.Build.0 = Release|Any CPU
36
		{E068474B-98FB-431D-84EB-000AA36D0FC5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
37
		{E068474B-98FB-431D-84EB-000AA36D0FC5}.Debug|Any CPU.Build.0 = Debug|Any CPU
38
		{E068474B-98FB-431D-84EB-000AA36D0FC5}.Debug|x64.ActiveCfg = Debug|Any CPU
39
		{E068474B-98FB-431D-84EB-000AA36D0FC5}.Debug|x64.Build.0 = Debug|Any CPU
40
		{E068474B-98FB-431D-84EB-000AA36D0FC5}.Release|Any CPU.ActiveCfg = Release|Any CPU
41
		{E068474B-98FB-431D-84EB-000AA36D0FC5}.Release|Any CPU.Build.0 = Release|Any CPU
42
		{E068474B-98FB-431D-84EB-000AA36D0FC5}.Release|x64.ActiveCfg = Release|Any CPU
43
		{E068474B-98FB-431D-84EB-000AA36D0FC5}.Release|x64.Build.0 = Release|Any CPU
34 44
	EndGlobalSection
35 45
	GlobalSection(SolutionProperties) = preSolution
36 46
		HideSolutionNode = FALSE
Server/ServerApp/Predictor/FeatureExtractor.cs
44 44
        /// <param name="interval"></param>
45 45
        /// <param name="wholeDay"></param>
46 46
        /// <returns></returns>
47
        public List<ModelInput> PrepareTrainingInput(int area, DateTime startDate, DateTime endDate, int interval = 3, bool wholeDay = true)
47
        public List<ModelInput> PrepareTrainingInput(int area)
48 48
        {
49
            DataParser.Parse(startDate, endDate, interval, wholeDay);
50 49
            List<string> buildings = new List<string>();
51 50

  
52 51
            // find all buildings in area
Server/ServerApp/Predictor/PredictionController.cs
171 171
            if (locationKey is null)
172 172
            // train all predictors
173 173
            {
174
                DataParser.Parse(DateTime.MinValue, DateTime.MaxValue, this.Configuration.TimeResolution, wholeDay: false);
174 175
                for (int i = 0; i < this.Predictors.Count; i++)
175 176
                {
176 177
                    // train on all available data
177
                    List<ModelInput> data = FeatureExtractor.PrepareTrainingInput(i, DateTime.MinValue, DateTime.MaxValue);
178
                    List<ModelInput> data = FeatureExtractor.PrepareTrainingInput(i);
178 179
                    Console.WriteLine("Training predictor with {0} samples.", data.Count);
179 180
                    this.Predictors[i].Fit(data);
180 181
                }
Server/ServerAppTests/Predictor/PredictionControllerTests.cs
1
//
2
// Author: Roman Kalivoda
3
//
4
using Microsoft.VisualStudio.TestTools.UnitTesting;
5
using ServerApp.Predictor;
6
using System;
7
using System.Collections.Generic;
8
using System.Linq;
9
using System.Text;
10
using System.Threading.Tasks;
11

  
12
namespace ServerApp.Predictor.Tests
13
{
14
    [TestClass()]
15
    public class PredictionControllerTests
16
    {
17
        [TestInitialize]
18
        public void SetUp()
19
        {
20

  
21
        }
22

  
23
        [TestMethod()]
24
        public void TrainTest()
25
        {
26
            throw new NotImplementedException();
27
        }
28
    }
29
}
Server/ServerAppTests/Properties/AssemblyInfo.cs
1
using System.Reflection;
2
using System.Runtime.CompilerServices;
3
using System.Runtime.InteropServices;
4

  
5
// General Information about an assembly is controlled through the following 
6
// set of attributes. Change these attribute values to modify the information
7
// associated with an assembly.
8
[assembly: AssemblyTitle("ServerAppTests")]
9
[assembly: AssemblyDescription("")]
10
[assembly: AssemblyConfiguration("")]
11
[assembly: AssemblyCompany("")]
12
[assembly: AssemblyProduct("ServerAppTests")]
13
[assembly: AssemblyCopyright("Copyright ©  2021")]
14
[assembly: AssemblyTrademark("")]
15
[assembly: AssemblyCulture("")]
16

  
17
// Setting ComVisible to false makes the types in this assembly not visible 
18
// to COM components.  If you need to access a type in this assembly from 
19
// COM, set the ComVisible attribute to true on that type.
20
[assembly: ComVisible(false)]
21

  
22
// The following GUID is for the ID of the typelib if this project is exposed to COM
23
[assembly: Guid("e068474b-98fb-431d-84eb-000aa36d0fc5")]
24

  
25
// Version information for an assembly consists of the following four values:
26
//
27
//      Major Version
28
//      Minor Version 
29
//      Build Number
30
//      Revision
31
//
32
// You can specify all the values or you can default the Build and Revision Numbers 
33
// by using the '*' as shown below:
34
// [assembly: AssemblyVersion("1.0.*")]
35
[assembly: AssemblyVersion("1.0.0.0")]
36
[assembly: AssemblyFileVersion("1.0.0.0")]
Server/ServerAppTests/ServerAppTests.csproj
1
<?xml version="1.0" encoding="utf-8"?>
2
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
  <Import Project="..\packages\MSTest.TestAdapter.2.1.1\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.2.1.1\build\net45\MSTest.TestAdapter.props')" />
4
  <PropertyGroup>
5
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7
    <ProjectGuid>{E068474B-98FB-431D-84EB-000AA36D0FC5}</ProjectGuid>
8
    <OutputType>Library</OutputType>
9
    <AppDesignerFolder>Properties</AppDesignerFolder>
10
    <RootNamespace>ServerAppTests</RootNamespace>
11
    <AssemblyName>ServerAppTests</AssemblyName>
12
    <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
13
    <FileAlignment>512</FileAlignment>
14
    <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
15
    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
16
    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
17
    <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
18
    <IsCodedUITest>False</IsCodedUITest>
19
    <TestProjectType>UnitTest</TestProjectType>
20
    <TargetFrameworkProfile />
21
    <NuGetPackageImportStamp>
22
    </NuGetPackageImportStamp>
23
  </PropertyGroup>
24
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
25
    <DebugSymbols>true</DebugSymbols>
26
    <DebugType>full</DebugType>
27
    <Optimize>false</Optimize>
28
    <OutputPath>bin\Debug\</OutputPath>
29
    <DefineConstants>DEBUG;TRACE</DefineConstants>
30
    <ErrorReport>prompt</ErrorReport>
31
    <WarningLevel>4</WarningLevel>
32
  </PropertyGroup>
33
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
34
    <DebugType>pdbonly</DebugType>
35
    <Optimize>true</Optimize>
36
    <OutputPath>bin\Release\</OutputPath>
37
    <DefineConstants>TRACE</DefineConstants>
38
    <ErrorReport>prompt</ErrorReport>
39
    <WarningLevel>4</WarningLevel>
40
  </PropertyGroup>
41
  <ItemGroup>
42
    <Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
43
      <HintPath>..\packages\Castle.Core.4.4.0\lib\net45\Castle.Core.dll</HintPath>
44
    </Reference>
45
    <Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
46
      <HintPath>..\packages\MSTest.TestFramework.2.1.1\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
47
    </Reference>
48
    <Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
49
      <HintPath>..\packages\MSTest.TestFramework.2.1.1\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
50
    </Reference>
51
    <Reference Include="Moq, Version=4.16.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
52
      <HintPath>..\packages\Moq.4.16.1\lib\net45\Moq.dll</HintPath>
53
    </Reference>
54
    <Reference Include="System" />
55
    <Reference Include="System.Configuration" />
56
    <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
57
      <HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.3\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
58
    </Reference>
59
    <Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
60
      <HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
61
    </Reference>
62
  </ItemGroup>
63
  <Choose>
64
    <When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
65
      <ItemGroup>
66
        <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
67
      </ItemGroup>
68
    </When>
69
    <Otherwise />
70
  </Choose>
71
  <ItemGroup>
72
    <Compile Include="Predictor\PredictionControllerTests.cs" />
73
    <Compile Include="Properties\AssemblyInfo.cs" />
74
  </ItemGroup>
75
  <ItemGroup>
76
    <None Include="app.config" />
77
    <None Include="packages.config" />
78
  </ItemGroup>
79
  <ItemGroup>
80
    <ProjectReference Include="..\ServerApp\ServerApp.csproj">
81
      <Project>{18FCFB20-B860-4147-8E7C-8A0DD84C55D4}</Project>
82
      <Name>ServerApp</Name>
83
    </ProjectReference>
84
  </ItemGroup>
85
  <Choose>
86
    <When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
87
      <ItemGroup>
88
        <Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
89
          <Private>False</Private>
90
        </Reference>
91
        <Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
92
          <Private>False</Private>
93
        </Reference>
94
        <Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
95
          <Private>False</Private>
96
        </Reference>
97
        <Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
98
          <Private>False</Private>
99
        </Reference>
100
      </ItemGroup>
101
    </When>
102
  </Choose>
103
  <Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
104
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
105
  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
106
    <PropertyGroup>
107
      <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
108
    </PropertyGroup>
109
    <Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.1.1\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.1.1\build\net45\MSTest.TestAdapter.props'))" />
110
    <Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.1.1\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.1.1\build\net45\MSTest.TestAdapter.targets'))" />
111
  </Target>
112
  <Import Project="..\packages\MSTest.TestAdapter.2.1.1\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.2.1.1\build\net45\MSTest.TestAdapter.targets')" />
113
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
114
       Other similar extension points exist, see Microsoft.Common.targets.
115
  <Target Name="BeforeBuild">
116
  </Target>
117
  <Target Name="AfterBuild">
118
  </Target>
119
  -->
120
</Project>
Server/ServerAppTests/app.config
1
<?xml version="1.0" encoding="utf-8"?>
2
<configuration>
3
  <runtime>
4
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
5
      <dependentAssembly>
6
        <assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
7
        <bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="4.0.4.1" />
8
      </dependentAssembly>
9
    </assemblyBinding>
10
  </runtime>
11
</configuration>
Server/ServerAppTests/packages.config
1
<?xml version="1.0" encoding="utf-8"?>
2
<packages>
3
  <package id="Castle.Core" version="4.4.0" targetFramework="net472" />
4
  <package id="Moq" version="4.16.1" targetFramework="net472" />
5
  <package id="MSTest.TestAdapter" version="2.1.1" targetFramework="net472" />
6
  <package id="MSTest.TestFramework" version="2.1.1" targetFramework="net472" />
7
  <package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" targetFramework="net472" />
8
  <package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
9
</packages>

Také k dispozici: Unified diff