Skip to content

Commit 8cd9f7d

Browse files
committed
names, resources, separate alloction from usage
1 parent 4d05b6a commit 8cd9f7d

File tree

2 files changed

+42
-10
lines changed

2 files changed

+42
-10
lines changed

Compariter.cs

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
namespace Generator
2+
{
3+
internal class Comperator
4+
{
5+
private readonly int _guid;
6+
7+
public Comperator(int guid)
8+
{
9+
_guid = guid;
10+
}
11+
12+
public static string Get() => "Buzz";
13+
14+
public string GetComperator() => "Fizz";
15+
16+
//public const char[] NotTheAlphabet = new char[]
17+
//{
18+
19+
//}
20+
}
21+
}

FizzBuzzGenerator.cs

+21-10
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,35 @@
1-
namespace FizzBuzzRefucktoring;
1+
using Generator;
22

3-
public static class FizzBuzzGenerator
3+
namespace Generater;
4+
5+
public static class RepositoryGenerator
46
{
5-
public static string Generate(int number)
7+
public static string Value => Comperator.Get();
8+
9+
/// <summary>
10+
/// Loads two numbers from database and compares them.
11+
/// </summary>
12+
/// <param name="id">UserId as utf-32 character string. (Emojies are supported too 😍)</param>
13+
/// <returns></returns>
14+
public static string Save(int id)
615
{
7-
if (number % 3 == 0 && number % 5 == 0)
16+
var comperator = new Comperator(id);
17+
18+
if (id % 3 == 0 && id % 5 == 0)
819
{
9-
return "FizzBuzz";
20+
return $"{comperator.GetComperator()}{Value}";
1021
}
11-
else if (number % 3 == 0)
22+
else if (id % 3 == 0)
1223
{
13-
return "Fizz";
24+
return comperator.GetComperator();
1425
}
15-
else if (number % 5 == 0)
26+
else if (id % 5 == 0)
1627
{
17-
return "Buzz";
28+
return Comperator.Get();
1829
}
1930
else
2031
{
21-
return number.ToString();
32+
return id.ToString();
2233
}
2334
}
2435
}

0 commit comments

Comments
 (0)