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
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,39 @@
namespace AdventureTime
using System;

namespace AdventureTime
{
internal class Program
{
private static void Main()
{
// Протестируем работу основных методов без Adventure time
System.Console.WriteLine("Base methods");
System.Console.WriteLine(Time.WhatTimeIsIt());
System.Console.WriteLine(Time.WhatTimeIsItInUtc());
System.Console.WriteLine(Time.SpecifyKind(Time.WhatTimeIsItInUtc(), DateTimeKind.Local));
System.Console.WriteLine(Time.ToRoundTripFormatString(Time.WhatTimeIsIt(), true));
System.Console.WriteLine(Time.ParseFromRoundTripFormat(Time.ToRoundTripFormatString(Time.WhatTimeIsIt())));
System.Console.WriteLine(Time.ToUtc(Time.SpecifyKind(Time.WhatTimeIsItInUtc(), DateTimeKind.Local)));
System.Console.WriteLine(Time.AddTenSeconds(Time.WhatTimeIsIt()));
System.Console.WriteLine(Time.AddTenSecondsV2(Time.WhatTimeIsIt()));
System.Console.WriteLine(Time.GetHoursBetween(
new DateTime(2010, 3, 28, 2, 15, 0),
new DateTime(2010, 3, 28, 3, 45, 0))
);
System.Console.WriteLine(Time.GetTotalMinutesInThreeMonths());
System.Console.WriteLine(Time.AreEqualBirthdays(
new DateTime(2010, 3, 28), new DateTime(2000, 4, 1)));
System.Console.WriteLine("===============================================================================");

// Протестируем работу методов в Adventure time
System.Console.WriteLine("Adventure time methods");
System.Console.WriteLine(Time.GetAdventureTimeDurationInMinutes_ver0_Dumb());
System.Console.WriteLine(Time.GetGenderSwappedAdventureTimeDurationInMinutes_ver0_Dumb());
System.Console.WriteLine(Time.GetAdventureTimeDurationInMinutes_ver1_FeelsSmarter());
System.Console.WriteLine(Time.GetAdventureTimeDurationInMinutes_ver2_FeelsLikeRocketScience());
System.Console.WriteLine(Time.GetGenderSwappedAdventureTimeDurationInMinutes_ver2_FeelsLikeRocketScience());
System.Console.WriteLine(Time.GetAdventureTimeDurationInMinutes_ver3_NodaTime());
System.Console.WriteLine("===============================================================================");
}
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BoringVector.Tests", "BoringVector.Tests\BoringVector.Tests.csproj", "{AD69D7D4-8481-432E-A959-75F8E960CAFA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AD69D7D4-8481-432E-A959-75F8E960CAFA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AD69D7D4-8481-432E-A959-75F8E960CAFA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AD69D7D4-8481-432E-A959-75F8E960CAFA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AD69D7D4-8481-432E-A959-75F8E960CAFA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>

<IsPackable>false</IsPackable>

<RootNamespace>BoringVector.Tests</RootNamespace>

<AssemblyName>BoringVector.Tests</AssemblyName>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NUnit" Version="3.12.0"/>
<PackageReference Include="NUnit3TestAdapter" Version="3.16.1"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0"/>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\BoringVector\BoringVector\BoringVector.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using NUnit.Framework;

namespace BoringVector.Tests
{
public class Tests
{
[SetUp]
public void Setup()
{
}

[Test]
public void SquareLength()
{
var v = new Vector(5, 5);
Assert.AreEqual(v.SquareLength(), 50);
}
[Test]
public void Add()
{
var v = new Vector(5, 5);
var u = new Vector(1, -1);
Assert.AreEqual(v.Add(u), new Vector(6, 4));
}
[Test]
public void Scale()
{
var v = new Vector(5, 5);
Assert.AreEqual(v.Scale(10), new Vector(50, 50));
}
[Test]
public void DotProduct()
{
var v = new Vector(5, 5);
var u = new Vector(1, -1);
Assert.AreEqual(v.DotProduct(u), 0);
}
[Test]
public void CrossProduct()
{
var v = new Vector(5, 5);
var u = new Vector(1, -1);
Assert.AreEqual(v.CrossProduct(u), -10);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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

</Project>
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
using System;
using System.Runtime.CompilerServices;

[assembly: InternalsVisibleTo("BoringVector.Tests")]

namespace BoringVector
{
internal class Program
{
private static void Main()
{
Console.WriteLine("Hello World!");
var v = new ExtendedVector(1, -1);
Console.WriteLine(v.Normilize().ToString());

var u1 = new Vector(5, 5);

Console.WriteLine(u1.SquareLength());
Console.WriteLine(u1 + u1 * 3);
Console.WriteLine(u1.DotProduct(v));
Console.WriteLine(u1.CrossProduct(v));
}
}
}
Loading