Browse Source

добавление проекта модульного теста

danilka.ezhov.03@mail.ru 2 years ago
parent
commit
b262dc86b9

+ 20 - 0
UnitTestProject1/Properties/AssemblyInfo.cs

@@ -0,0 +1,20 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("UnitTestProject1")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("UnitTestProject1")]
+[assembly: AssemblyCopyright("Copyright ©  2022")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+[assembly: ComVisible(false)]
+
+[assembly: Guid("bf60b79d-6b17-4f4d-8d02-167f3e9eb524")]
+
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 14 - 0
UnitTestProject1/UnitTest1.cs

@@ -0,0 +1,14 @@
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System;
+
+namespace UnitTestProject1
+{
+    [TestClass]
+    public class UnitTest1
+    {
+        [TestMethod]
+        public void TestMethod1()
+        {
+        }
+    }
+}

+ 68 - 0
UnitTestProject1/UnitTestProject1.csproj

@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <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')" />
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{BF60B79D-6B17-4F4D-8D02-167F3E9EB524}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>UnitTestProject1</RootNamespace>
+    <AssemblyName>UnitTestProject1</AssemblyName>
+    <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.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>
+    <NuGetPackageImportStamp>
+    </NuGetPackageImportStamp>
+  </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>
+  <ItemGroup>
+    <Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\MSTest.TestFramework.2.1.1\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\MSTest.TestFramework.2.1.1\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="UnitTest1.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="packages.config" />
+  </ItemGroup>
+  <Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+    <PropertyGroup>
+      <ErrorText>Данный проект ссылается на пакеты NuGet, отсутствующие на этом компьютере. Используйте восстановление пакетов NuGet, чтобы скачать их.  Дополнительную информацию см. по адресу: http://go.microsoft.com/fwlink/?LinkID=322105. Отсутствует следующий файл: {0}.</ErrorText>
+    </PropertyGroup>
+    <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'))" />
+    <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'))" />
+  </Target>
+  <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')" />
+</Project>

+ 5 - 0
UnitTestProject1/packages.config

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="MSTest.TestAdapter" version="2.1.1" targetFramework="net472" />
+  <package id="MSTest.TestFramework" version="2.1.1" targetFramework="net472" />
+</packages>

+ 6 - 0
Услуги школы иностранных языков.sln

@@ -5,6 +5,8 @@ VisualStudioVersion = 16.0.30907.101
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Услуги школы иностранных языков", "Услуги школы иностранных языков\Услуги школы иностранных языков.csproj", "{169DFEB4-D08A-4FCC-96A4-0AE0E6B0FAE7}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestProject1", "UnitTestProject1\UnitTestProject1.csproj", "{BF60B79D-6B17-4F4D-8D02-167F3E9EB524}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -15,6 +17,10 @@ Global
 		{169DFEB4-D08A-4FCC-96A4-0AE0E6B0FAE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{169DFEB4-D08A-4FCC-96A4-0AE0E6B0FAE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{169DFEB4-D08A-4FCC-96A4-0AE0E6B0FAE7}.Release|Any CPU.Build.0 = Release|Any CPU
+		{BF60B79D-6B17-4F4D-8D02-167F3E9EB524}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{BF60B79D-6B17-4F4D-8D02-167F3E9EB524}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{BF60B79D-6B17-4F4D-8D02-167F3E9EB524}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{BF60B79D-6B17-4F4D-8D02-167F3E9EB524}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 1 - 0
Услуги школы иностранных языков/App.xaml

@@ -9,6 +9,7 @@
         </Style>
         <Style TargetType="Button">
             <Setter Property="FontFamily" Value="Comic Sans MS"></Setter>
+            <Setter Property="Background" Value="Blue"></Setter>
         </Style>
         <Style TargetType="ComboBox">
             <Setter Property="FontFamily" Value="Comic Sans MS"></Setter>

+ 42 - 0
Услуги школы иностранных языков/ListServices.xaml

@@ -0,0 +1,42 @@
+<Page x:Class="Услуги_школы_иностранных_языков.ListServices"
+      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+      xmlns:local="clr-namespace:Услуги_школы_иностранных_языков"
+      mc:Ignorable="d" 
+      d:DesignHeight="450" d:DesignWidth="800"
+      Title="ListServices">
+    <Page.Resources>
+        <DataTemplate x:Key="TemplateMainList">
+            <Border BorderBrush="Black" BorderThickness="1" Width="800" Height="200">
+                <StackPanel Orientation="Horizontal">
+                    <Image Source="{Binding MainImagePath}"></Image>
+                    <StackPanel Orientation="Vertical">
+                        <TextBlock Text="{Binding Title}"></TextBlock>
+                        <StackPanel Orientation="Horizontal">
+                            <TextBlock Text="{Binding Cost}"></TextBlock>
+                            <TextBlock Text=" рублей за "></TextBlock>
+                            <TextBlock Text="{Binding DurationInMinutes}"></TextBlock>
+                            <TextBlock Text=" минут"></TextBlock>
+                        </StackPanel>
+                        <StackPanel Orientation="Horizontal">
+                            <TextBlock Text="{Binding MyStringDiscount}"></TextBlock>
+                        </StackPanel>
+                    </StackPanel>
+                </StackPanel>
+
+            </Border>
+
+        </DataTemplate>
+    </Page.Resources>
+
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition/>
+            <RowDefinition Height="4*"/>
+        </Grid.RowDefinitions>
+        <ListBox x:Name="ListBoxServices" ItemTemplate="{StaticResource TemplateMainList}" Grid.Row="1"></ListBox>
+        
+    </Grid>
+</Page>

+ 29 - 0
Услуги школы иностранных языков/ListServices.xaml.cs

@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace Услуги_школы_иностранных_языков
+{
+    /// <summary>
+    /// Логика взаимодействия для ListServices.xaml
+    /// </summary>
+    public partial class ListServices : Page
+    {
+        public ListServices()
+        {
+            InitializeComponent();
+            ListBoxServices.ItemsSource = BaseModel.BaseConnect.Service.ToList();
+        }
+    }
+}

+ 2 - 1
Услуги школы иностранных языков/MainWindow.xaml

@@ -12,6 +12,7 @@
             <RowDefinition Height="287*"/>
         </Grid.RowDefinitions>
         <Image Source="res\school_logo.png" HorizontalAlignment="Left" VerticalAlignment="Center"></Image>
-        <TextBlock Text="Услуги работы школы" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock>
+        <TextBlock Text="Услуги работы школы" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="30"></TextBlock>
+        <Frame x:Name="MainFrame" NavigationUIVisibility="Hidden" Grid.Row="1"></Frame>
     </Grid>
 </Window>

+ 2 - 0
Услуги школы иностранных языков/MainWindow.xaml.cs

@@ -23,6 +23,8 @@ namespace Услуги_школы_иностранных_языков
         public MainWindow()
         {
             InitializeComponent();
+            MainFrame.Navigate(new ListServices());
+            LoadPages.SwitchPages = MainFrame;
 
         }
     }

+ 19 - 0
Услуги школы иностранных языков/PartServices.cs

@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Услуги_школы_иностранных_языков
+{
+    public partial class Service
+    {
+
+        public string MyStringDiscount
+        {
+            get { return "* скидка " + Discount + " %"; }
+        }
+
+    }
+
+}

+ 8 - 0
Услуги школы иностранных языков/Услуги школы иностранных языков.csproj

@@ -74,15 +74,23 @@
     <Compile Include="Gender.cs">
       <DependentUpon>Model1.tt</DependentUpon>
     </Compile>
+    <Compile Include="ListServices.xaml.cs">
+      <DependentUpon>ListServices.xaml</DependentUpon>
+    </Compile>
     <Compile Include="LoadPages.cs" />
     <Compile Include="Model1.cs">
       <AutoGen>True</AutoGen>
       <DesignTime>True</DesignTime>
       <DependentUpon>Model1.tt</DependentUpon>
     </Compile>
+    <Compile Include="PartServices.cs" />
     <Compile Include="Service.cs">
       <DependentUpon>Model1.tt</DependentUpon>
     </Compile>
+    <Page Include="ListServices.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="MainWindow.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>

BIN
Услуги школы иностранных языков/Услуги школы/Заглушка.JPG