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

Экзамен #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 6 additions & 0 deletions GIT/App.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
</Project>
36 changes: 36 additions & 0 deletions GIT/Duck.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System;


namespace Git
{
interface IFly
{
string Fly();
}

interface IQuack
{
string Quack();
}

public abstract class Duck : IFly, IQuack
{
public static string swim()
{
return "Swiu";
}

public abstract string Display();

public string Fly()
{
return "Утка косплеит Falcon X";
}

public string Quack()
{
return "Qurack";
}
}

}
41 changes: 41 additions & 0 deletions GIT/DuckiTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System;
using Xunit;
using Git;


namespace DuckiTest

{
public class DuckiTest
{
public void Test1()
{
Duckinator utkonos = new Duckinator();
string a = Duckinator.swim();
Assert.Equal("Duckinator всплыл", a);
}


public void Test2()
{
Duckinator utkonos = new Duckinator();
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.

Тогда в интерфейсе Fly надо поменять на string Fly { get; set; }

Copy link
Author

Choose a reason for hiding this comment

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

Секунду

string b = utkonos.Display();
Assert.Equal("I Duckinator", b);
}

public void Test3()
{
Duckinator utkonos = new Duckinator();
string c = utkonos.Fly();
Assert.Equal("Duckinator пробил луну", c);
}

public void Test4()

{
Duckinator utkonos = new Duckinator();
string d = utkonos.Quack();
Assert.Equal("Dukinaaaaaaaaaaaaaaaaaaaaaaaaator", d);
}
}
}
22 changes: 22 additions & 0 deletions GIT/DuckiTest.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
<PackageReference Include="coverlet.collector" Version="1.0.1" />
</ItemGroup>


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

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


namespace Git
{

public class Duckinator : Duck
{

public Duckinator()
{
}

public override string Display()
{
return "Duckinator вернулся";
}
}
}
6 changes: 6 additions & 0 deletions GIT/Git.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
</Project>
16 changes: 16 additions & 0 deletions GIT/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;

namespace Git
{
public class Program
{
public static void Main()
{
Duckinator utkonos = new Duckinator();
Console.WriteLine(utkonos.Display());
Console.WriteLine(Duckinator.swim());
Console.WriteLine(utkonos.Fly());
Console.WriteLine(utkonos.Quack());
}
}
}
23 changes: 23 additions & 0 deletions GIT/obj/Debug/netcoreapp3.1/App.AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// повторной генерации кода.
// </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")]

// Generated by the MSBuild WriteCodeFragment class.

1 change: 1 addition & 0 deletions GIT/obj/Debug/netcoreapp3.1/App.AssemblyInfoInputs.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
935fc6b03c2183b74aad9f70355d701aca07a4a5
Binary file not shown.
23 changes: 23 additions & 0 deletions GIT/obj/Debug/netcoreapp3.1/Git.AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Этот код создан программой.
// Исполняемая версия:4.0.30319.42000
//
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
// повторной генерации кода.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.Reflection;

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

// Generated by the MSBuild WriteCodeFragment class.

1 change: 1 addition & 0 deletions GIT/obj/Debug/netcoreapp3.1/Git.AssemblyInfoInputs.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1d5013adc3041bcd00ee6d6f10d4ea538b5c1f6a