<commit_before>using System.Linq;
using BinaryTree;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace BinaryTreeTest
{
    [TestClass]
    public class BinaryUnitTest
    {
        [TestMethod]
        public void TestInOrderTraversal()
        {
            // arrange
            var orderedTree = new BinaryTree<int> { 3, 5, 7, 8, 10, 12, 15 };
            var binaryTree = new BinaryTree<int> { 8, 5, 12, 3, 7, 10, 15 };
            var inOrder = new InOrderTraversal<int>();
            // act
            binaryTree.SetTraversalStrategy(inOrder);
            // assert
            Assert.IsTrue(orderedTree.SequenceEqual(binaryTree));
        }

        [TestMethod]
        public void TestBinaryTreeClear()
        {
            // arrange
            var binaryTree = new BinaryTree<int> { 8, 5, 12, 3, 7, 10, 15 };
            // act
            binaryTree.Clear();
            // assert
            Assert.AreEqual(binaryTree.Count, 0);
        }

        [TestMethod]
        public void TestBinaryTreeCopy()
        {
            // arrange
            var binaryTree = new BinaryTree<int> { 8, 5, 12, 3, 7, 10, 15 };
            // act
            var arr = new int[binaryTree.Count];
            binaryTree.CopyTo(arr, 0);
            // assert
            Assert.AreEqual(binaryTree.Count, arr.Length);
        }

        [TestMethod]
        public void TestBinaryTreeRemove()
        {
            // arrange
            var binaryTree = new BinaryTree<int> { 8, 5, 12, 3, 7, 10, 15 };
            var initCnt = binaryTree.Count;
            // act
            const int remove = 10;
            var isRemoved = binaryTree.Remove(remove);
            // assert
            Assert.IsTrue(isRemoved);
            Assert.IsTrue(binaryTree.Count < initCnt);
        }
    }
}<commit_msg>Added test for remaining traversal strategies and one more test for removing el. (#8)<commit_after>using System.Linq;
using BinaryTree;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace BinaryTreeTest
{
    [TestClass]
    public class BinaryUnitTest
    {
        [TestMethod]
        public void TestInOrderTraversal()
        {
            // arrange
            var expected = new int[] { 3, 5, 7, 8, 10, 12, 15 };
            var binaryTree = new BinaryTree<int> { 8, 5, 12, 3, 7, 10, 15 };
            var inOrder = new InOrderTraversal<int>();
            // act
            binaryTree.SetTraversalStrategy(inOrder);
            // assert
            Assert.IsTrue(expected.SequenceEqual(binaryTree));
        }

        [TestMethod]
        public void TestPreOrderTraversal()
        {
            // arrange
            var expected = new int[] { 8, 5, 3, 7, 12, 10, 15 };
            var binaryTree = new BinaryTree<int> { 8, 5, 12, 3, 7, 10, 15 };
            var preOrder = new PreOrderTraversal<int>();
            // act
            binaryTree.SetTraversalStrategy(preOrder);
            // assert
            Assert.IsTrue(expected.SequenceEqual(binaryTree));
        }

        [TestMethod]
        public void TestPostOrderTraversal()
        {
            // arrange
            var expected = new int[] { 3, 7, 5, 10, 15, 12, 8 };
            var binaryTree = new BinaryTree<int> { 8, 5, 12, 3, 7, 10, 15 };
            var postOrder = new PostOrderTraversal<int>();
            // act
            binaryTree.SetTraversalStrategy(postOrder);
            // assert
            Assert.IsTrue(expected.SequenceEqual(binaryTree));
        }

        [TestMethod]
        public void TestBinaryTreeClear()
        {
            // arrange
            var binaryTree = new BinaryTree<int> { 8, 5, 12, 3, 7, 10, 15 };
            // act
            binaryTree.Clear();
            // assert
            Assert.AreEqual(binaryTree.Count, 0);
        }

        [TestMethod]
        public void TestBinaryTreeCopy()
        {
            // arrange
            var binaryTree = new BinaryTree<int> { 8, 5, 12, 3, 7, 10, 15 };
            // act
            var arr = new int[binaryTree.Count];
            binaryTree.CopyTo(arr, 0);
            // assert
            Assert.AreEqual(binaryTree.Count, arr.Length);
        }

        [TestMethod]
        public void TestBinaryTreeRemove_ShouldReturnTrueAndRemoveElementFromTree_WhenTreeContainsElementToRemove()
        {
            // arrange
            var binaryTree = new BinaryTree<int> { 8, 5, 12, 3, 7, 10, 15 };
            var initialCount = binaryTree.Count;
            // act
            const int remove = 10;
            var isRemoved = binaryTree.Remove(remove);
            // assert
            Assert.IsTrue(isRemoved);
            Assert.IsTrue(binaryTree.Count < initialCount);
        }
        [TestMethod]
        public void TestBinaryTreeRemove_ShouldReturnFalseAndMakeNoChangesToTree_WhenTreeDoesNotContainElementToRemove()
        {
            // arrange
            var binaryTree = new BinaryTree<int> { 8, 5, 12, 3, 7, 10, 15 };
            var initialCount = binaryTree.Count;
            // act
            const int remove = 404;
            var isRemoved = binaryTree.Remove(remove);
            // assert
            Assert.IsFalse(isRemoved);
            Assert.AreEqual(initialCount, binaryTree.Count);
        }
    }
}
{'fraction_non_alphanumeric': 0.10099085365853659, 'fraction_numerical': 0.03086890243902439, 'mean_word_length': 1.5985148514851486, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5502943', 'n_tokens_mistral': 1608, 'n_tokens_neox': 1405, 'n_words': 364}