Skip to content
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
22 changes: 21 additions & 1 deletion CourseApp.Tests/DemoTest.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,33 @@
namespace CourseApp.Tests
{
using System;
using CourseApp;
using Xunit;

public class DemoTest
{
[Fact]
public void Test1()
{
Assert.True(true);
Gun g = new Gun();
string expect = "macerov";
Assert.Equal(expect, g.Model);
}

[Fact]
public void Test2()
{
Gun g = new Gun();
decimal expect = 12.12m;
Assert.Equal(expect, g.Kalibr);
}

[Fact]
public void Test3()
{
Gun g = new Gun();
string expect = "lll";
Assert.Equal(expect, g.Years);
}
}
}
2 changes: 1 addition & 1 deletion CourseApp/CourseApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
</PropertyGroup>

<ItemGroup>
Expand Down
41 changes: 41 additions & 0 deletions CourseApp/Gun.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System;

namespace CourseApp;

public class Gun
{
public Gun(string model , decimal kalibr , string years )
{
Model = model;
Kalibr = kalibr;
Years = years;
}

public Gun()
{
throw new NotImplementedException();
}

public string Model
{
get;
set;
}

public decimal Kalibr
{
get;
set;
}

public string Years
{
get;
set;
}

public void Display()
{
Console.WriteLine($"We have gun:{Model} kalibr:{Kalibr} years:{Years}");
}
}
18 changes: 7 additions & 11 deletions CourseApp/Program.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
namespace CourseApp
{
using System;
using System;
using CourseApp;

public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Hello World");
}
}
}
Gun pistoletik = new Gun("mocerov", 12.12m, "1934");
pistoletik.Display();

Gun avtomat = new Gun("Kalash", 7.62m, "1945");
avtomat.Display();