using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
namespace RandomValue.Library.Tests
{
[TestFixture]
public class RandomValueCreatorTests
{
[Test]
public void Creator_WhenDefault_Return0or1()
{
int output = RandomValueCreator.GetZeroOrOne(2);
Assert.AreEqual(0, output, 1);
Assert.AreEqual(1, output, 1);
}
[Test]
public void Creator_When2_Return0or1()
{
int input = 2;
int output = RandomValueCreator.GetRandom(input);
Assert.AreEqual(0, output, 1);
}
[Test]
public void Creator_WhenDefault_Return(
[Values(0, 1, 2, 3, 4, 5, 6 , 7, 8)] int input)
{
int output = RandomValueCreator.GetRandom(input);
if(input == 0)
Assert.Pass();
if (output >= 0 && output <= input - 1)
Assert.Pass();
else
Assert.Fail();
}
}
}
---------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
namespace RandomValue.Library.Tests
{
[TestFixture]
public class RandomValueCreatorTests
{
[Test]
public void Creator_WhenDefault_Return0or1()
{
int output = RandomValueCreator.GetZeroOrOne(2);
Assert.AreEqual(0, output, 1);
Assert.AreEqual(1, output, 1);
}
[Test]
public void Creator_When2_Return0or1()
{
int input = 2;
int output = RandomValueCreator.GetRandom(input);
Assert.AreEqual(0, output, 1);
}
[Test]
public void Creator_WhenDefault_Return(
[Values(0, 1, 2, 3, 4, 5, 6 , 7, 8)] int input)
{
int output = RandomValueCreator.GetRandom(input);
if(input == 0)
Assert.Pass();
if (output >= 0 && output <= input - 1)
Assert.Pass();
else
Assert.Fail();
}
}
}
'TIL Temp' 카테고리의 다른 글
유튜브 클론 코딩 # 14 - ESLint, Searching Videos (0) | 2019.02.02 |
---|---|
유튜브 클론 코딩 # 13 (0) | 2019.02.02 |
유튜브 클론 코딩 # 12 - Upload Video and Play (0) | 2019.01.31 |
유튜브 클론 코딩 #11 - Connect to MongoDB and Create Schema (0) | 2019.01.29 |
유튜브 클론 코딩 #10 - What is MVC in Node.JS? 수정 필요 (0) | 2019.01.27 |