Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exam #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions App/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/bin/Debug/netcoreapp2.0/App.dll",
"args": [],
"cwd": "${workspaceFolder}",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "internalConsole",
"stopAtEntry": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}
42 changes: 42 additions & 0 deletions App/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/App.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/App.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"${workspaceFolder}/App.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
}
]
}
8 changes: 8 additions & 0 deletions App/App.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>

</Project>
33 changes: 33 additions & 0 deletions App/Duck.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;

namespace App
{
interface IFly
{
string Fly();
}
interface IQuack
{
string Quack();
}

public abstract class Duck : IFly, IQuack
{
public static string swim()
{
return "Утка плавает";
}

public abstract string Display();

public string Fly()
{
return "Утка летает";
}

public string Quack()
{
return "Утка крякает";
}
}
}
16 changes: 16 additions & 0 deletions App/Duck2.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;

namespace App
{
public class Duck2 : Duck
{
public Duck2()
{
}

public override string Display()
{
return "Я утка";
}
}
}
17 changes: 17 additions & 0 deletions App/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;

namespace App
{
public class Program
{
public static void Main()
{
Duck2 donald = new Duck2();
Console.WriteLine(donald.Display());
Console.WriteLine(Duck2.swim());
Console.WriteLine(donald.Fly());
Console.WriteLine(donald.Quack());

}
}
}
23 changes: 23 additions & 0 deletions App/obj/Debug/netcoreapp2.0/App.AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//------------------------------------------------------------------------------
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ненужные файлы в репозитарии

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

да, я про gitignore забыл чет (

// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.Reflection;

[assembly: System.Reflection.AssemblyCompanyAttribute("App")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("App")]
[assembly: System.Reflection.AssemblyTitleAttribute("App")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

// Создано классом WriteCodeFragment MSBuild.

1 change: 1 addition & 0 deletions App/obj/Debug/netcoreapp2.0/App.AssemblyInfoInputs.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
935fc6b03c2183b74aad9f70355d701aca07a4a5
18 changes: 18 additions & 0 deletions AppTest/AppTest.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\App\App.csproj" />
</ItemGroup>

</Project>
41 changes: 41 additions & 0 deletions AppTest/UnitTest1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System;
using Xunit;
using App;

namespace AppTest
{
public class UnitTest1
{
[Fact]
public void Test1()
{
Duck2 donald = new Duck2();
string s = Duck2.swim();
Assert.Equal("Утка плавает по озеру", s);
}

[Fact]
public void Test2()
{
Duck2 donald = new Duck2();
string d = donald.Display();
Assert.Equal("Я утка", d);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А если я хочу другое поведение полета?

}

[Fact]
public void Test3()
{
Duck2 donald = new Duck2();
string f = donald.Fly();
Assert.Equal("Утка летает", f);
}

[Fact]
public void Test4()
{
Duck2 donald = new Duck2();
string q = donald.Quack();
Assert.Equal("Утка крякает", q);
}
}
}