test
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"displayName": "Exercise 2: Solution",
|
||||
"description": "In this exercise, you will learn about the core unit testing principle of AAA (Arrange, Act, Assert), which will help you structure your unit test.",
|
||||
"interactiveImport": true
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 88f1b91b4bf6e8a40acf64a4f42609c4
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"name": "MyExercise_2s"
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9a35b57ccac143edb7026140c63ed897
|
||||
timeCreated: 1670586792
|
@@ -0,0 +1,19 @@
|
||||
using System.Linq;
|
||||
|
||||
namespace MyExercise_2s
|
||||
{
|
||||
public class StringFormatter
|
||||
{
|
||||
private string m_joinDelimiter = ",";
|
||||
|
||||
public void Configure(string joinDelimiter)
|
||||
{
|
||||
m_joinDelimiter = joinDelimiter;
|
||||
}
|
||||
|
||||
public string Join(object[] args)
|
||||
{
|
||||
return string.Join(m_joinDelimiter, args.Select(arg => arg.ToString()).ToArray());
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c0ce52afab6ed3d48954015ab48f7e73
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1c4a0386e80140647b74d01b91d8a227
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,23 @@
|
||||
using MyExercise_2s;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Tests_2s
|
||||
{
|
||||
internal class StringFormatterTests
|
||||
{
|
||||
[Test]
|
||||
public void JoinsObjectsWithSemiColon()
|
||||
{
|
||||
// Arrange
|
||||
var formatterUnderTest = new StringFormatter();
|
||||
formatterUnderTest.Configure(";");
|
||||
var objects = new object[] {"a", "bc", 5, "d"};
|
||||
|
||||
// Act
|
||||
var result = formatterUnderTest.Join(objects);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual("a;bc;5;d", result);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 06f8681ab121b0444a384c15e489ae45
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "Tests_2s",
|
||||
"references": [
|
||||
"UnityEngine.TestRunner",
|
||||
"UnityEditor.TestRunner",
|
||||
"MyExercise_2s"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": true,
|
||||
"precompiledReferences": [
|
||||
"nunit.framework.dll"
|
||||
],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [
|
||||
"UNITY_INCLUDE_TESTS"
|
||||
],
|
||||
"versionDefines": []
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aaf95c9a00567db4b9ad7b01f660c8c6
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user