Skip to content

Commit f9c9ca1

Browse files
committed
Reorganization tests location and add new tests.
1 parent 8347243 commit f9c9ca1

19 files changed

Lines changed: 343 additions & 69 deletions

src/tests/DataTypeTests/ArrayTests.cs

Lines changed: 0 additions & 46 deletions
This file was deleted.
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
// ***********************************************************************
2+
// Assembly : RzR.Shared.Extensions.DataTypeTests
3+
// Author : RzR
4+
// Created On : 2022-12-08 09:25
5+
//
6+
// Last Modified By : RzR
7+
// Last Modified On : 2022-12-08 09:26
8+
// ***********************************************************************
9+
// <copyright file="ArrayTests.cs" company="">
10+
// Copyright (c) RzR. All rights reserved.
11+
// </copyright>
12+
//
13+
// <summary>
14+
// </summary>
15+
// ***********************************************************************
16+
17+
using DomainCommonExtensions.ArraysExtensions;
18+
using Microsoft.VisualStudio.TestTools.UnitTesting;
19+
20+
namespace DataTypeTests.DataTests
21+
{
22+
[TestClass]
23+
public class ArrayTests
24+
{
25+
[TestMethod]
26+
public void IndexOfEmptyOrNullInputTest()
27+
{
28+
var input = new string[1];
29+
var index = input.IndexOf("test");
30+
31+
Assert.IsNotNull(index);
32+
Assert.AreEqual(-1, index);
33+
}
34+
35+
[TestMethod]
36+
public void IndexOfTest()
37+
{
38+
var input = new string[] { "home", "phone", "pc", "", null, "", "" };
39+
40+
Assert.AreEqual(-1, input.IndexOf("test"));
41+
Assert.AreEqual(2, input.IndexOf("pc"));
42+
Assert.AreEqual(3, input.IndexOf(""));
43+
Assert.AreEqual(4, input.IndexOf(null));
44+
}
45+
46+
[TestMethod]
47+
public void AppendItem_Test()
48+
{
49+
var array = new string[] { "a", "b", "c" };
50+
51+
var result = array.AppendItem("d");
52+
53+
Assert.IsNotNull(result);
54+
Assert.AreEqual("a", result[0]);
55+
Assert.AreEqual("d", result[3]);
56+
}
57+
58+
[TestMethod]
59+
public void AppendItem_Param_Test()
60+
{
61+
var array = new string[] { "a", "b", "c" };
62+
63+
var result = array.AppendItem("d", "e");
64+
65+
Assert.IsNotNull(result);
66+
Assert.AreEqual("a", result[0]);
67+
Assert.AreEqual("d", result[3]);
68+
Assert.AreEqual("e", result[4]);
69+
}
70+
71+
[TestMethod]
72+
public void AppendIfNotExists_Test()
73+
{
74+
var array = new string[] { "a", "b", "c" };
75+
76+
var result = array.AppendIfNotExists(new[] { "d", "e", "a" });
77+
78+
Assert.IsNotNull(result);
79+
Assert.AreEqual(5, result.Length);
80+
Assert.AreEqual("a", result[0]);
81+
Assert.AreEqual("d", result[3]);
82+
Assert.AreEqual("e", result[4]);
83+
}
84+
85+
[TestMethod]
86+
public void RemoveItem_Test()
87+
{
88+
var array = new string[] { "a", "b", "c", "d" };
89+
90+
var result = array.RemoveItem("c");
91+
Assert.IsNotNull(result);
92+
Assert.AreEqual(3, result.Length);
93+
Assert.AreEqual(-1, result.IndexOf("c"));
94+
}
95+
96+
[TestMethod]
97+
public void RemoveAtIdx_Test()
98+
{
99+
var array = new string[] { "a", "b", "c", "d" };
100+
101+
var result = array.RemoveAtIdx(2);
102+
Assert.IsNotNull(result);
103+
Assert.AreEqual(3, result.Length);
104+
Assert.AreEqual(-1, result.IndexOf("c"));
105+
}
106+
}
107+
}

src/tests/DataTypeTests/BoolTests.cs renamed to src/tests/DataTypeTests/DataTests/BoolTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
#endregion
2323

24-
namespace DataTypeTests
24+
namespace DataTypeTests.DataTests
2525
{
2626
[TestClass]
2727
public class BoolTests
@@ -38,7 +38,7 @@ public void NegateTest()
3838
[TestMethod]
3939
public void NegateNullTest()
4040
{
41-
var neg = ((bool?) null).Negate();
41+
var neg = ((bool?)null).Negate();
4242

4343
Assert.IsTrue(neg.Equals(true));
4444
}

src/tests/DataTypeTests/ByteTests.cs renamed to src/tests/DataTypeTests/DataTests/ByteTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
#endregion
2424

25-
namespace DataTypeTests
25+
namespace DataTypeTests.DataTests
2626
{
2727
[TestClass]
2828
public class ByteTests

src/tests/DataTypeTests/CryptoExtensionsTests.cs renamed to src/tests/DataTypeTests/DataTests/CryptoExtensionsTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
using System.Security.Cryptography;
2020
using DomainCommonExtensions.CommonExtensions;
2121

22-
namespace DataTypeTests
22+
namespace DataTypeTests.DataTests
2323
{
2424
[TestClass]
2525
public class CryptoExtensionsTests

src/tests/DataTypeTests/CryptoRSAExtensionsTests.cs renamed to src/tests/DataTypeTests/DataTests/CryptoRSAExtensionsTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
#endregion
2727

28-
namespace DataTypeTests
28+
namespace DataTypeTests.DataTests
2929
{
3030
[TestClass]
3131
public class CryptoRSAExtensionsTests

src/tests/DataTypeTests/DateTimeTests.cs renamed to src/tests/DataTypeTests/DataTests/DateTimeTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
#endregion
2525

26-
namespace DataTypeTests
26+
namespace DataTypeTests.DataTests
2727
{
2828
[TestClass]
2929
public class DateTimeTests

src/tests/DataTypeTests/DoubleTests.cs renamed to src/tests/DataTypeTests/DataTests/DoubleTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121

2222
#endregion
2323

24-
namespace DataTypeTests
24+
namespace DataTypeTests.DataTests
2525
{
2626
[TestClass]
2727
public class DoubleTests
2828
{
2929
[TestMethod]
3030
public void MinutesToMs_1_Min_Test()
3131
{
32-
var mils = ((double) 1).MinutesToMs();
32+
var mils = ((double)1).MinutesToMs();
3333

3434
Assert.IsNotNull(mils);
3535
Assert.IsTrue(60000 == mils);
@@ -47,7 +47,7 @@ public void MinutesToMs_0_5_Min_Test()
4747
[TestMethod]
4848
public void MinutesToSeconds_1_Min_Test()
4949
{
50-
var sec = ((double) 1).MinutesToSeconds();
50+
var sec = ((double)1).MinutesToSeconds();
5151

5252
Assert.IsNotNull(sec);
5353
Assert.AreEqual(60, sec);

src/tests/DataTypeTests/DynamicListTests.cs renamed to src/tests/DataTypeTests/DataTests/DynamicListTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
using Microsoft.VisualStudio.TestTools.UnitTesting;
2323
// ReSharper disable ArrangeObjectCreationWhenTypeEvident
2424

25-
namespace DataTypeTests
25+
namespace DataTypeTests.DataTests
2626
{
2727
[TestClass]
2828
public class DynamicListTests

src/tests/DataTypeTests/EnumTests.cs renamed to src/tests/DataTypeTests/DataTests/EnumTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@
2424

2525
#endregion
2626

27-
namespace DataTypeTests
27+
namespace DataTypeTests.DataTests
2828
{
2929
internal enum ResultEnum
3030
{
3131
[EnumMember(Value = "IDK")]
3232
Unknown,
3333

34-
[System.ComponentModel.Description("Description-Valid")]
34+
[System.ComponentModel.Description("Description-Valid")]
3535
[Display(Name = "Display-Valid")]
3636
Valid,
3737

0 commit comments

Comments
 (0)