<commit_before>﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Option;

namespace OptionTests
{
    [TestClass]
    public class OptionTest
    {
        public static List<string> dummyData = new List<string> { "this", "is", "a", "list", "of", "dummy", "data" };

        [TestMethod]
        public void SearchForIndexOfItem_ItemNotFound()
        {
            string notFound = "notFound";

            Option<int> option = FindPosition<string>(dummyData, notFound);

            Assert.IsTrue(option is None<int>, $"The returned Option type is not a None: {option}");
        }

        [TestMethod]
        public void SearchForIndexOfItem_ItemFound()
        {
            string found = "data";

            Option<int> option = FindPosition<string>(dummyData, found);

            Assert.IsTrue(option is Some<int>, $"The returned Option type not a Some: {option}");
        }

        [TestMethod]
        public void ValueInSomeIsEqualToExpectedValue()
        {
            string itemToFind = "data";
            const int indexExpected = 6;

            Option<int> result = FindPosition<string>(dummyData, itemToFind);

            if(result is Some<int>)
            {
                int valReturned = (result as Some<int>).GetValue();

                Assert.AreEqual<int>(indexExpected, valReturned, $"Values are not the same: {indexExpected}, {valReturned}");
            }

        }

        [TestMethod]
        public void CheckSomeEqualToSomeWithSameValue()
        {
            int value = 10;

            Some<int> val1 = new Some<int>(value);
            Some<int> val2 = new Some<int>(value);
<commit_msg>Minor change. Now using C# 7 Patternmatching on "is".<commit_after>﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Option;

namespace OptionTests
{
    [TestClass]
    public class OptionTest
    {
        public static List<string> dummyData = new List<string> { "this", "is", "a", "list", "of", "dummy", "data" };

        [TestMethod]
        public void SearchForIndexOfItem_ItemNotFound()
        {
            string notFound = "notFound";

            Option<int> option = FindPosition<string>(dummyData, notFound);

            Assert.IsTrue(option is None<int>, $"The returned Option type is not a None: {option}");
        }

        [TestMethod]
        public void SearchForIndexOfItem_ItemFound()
        {
            string found = "data";

            Option<int> option = FindPosition<string>(dummyData, found);

            Assert.IsTrue(option is Some<int>, $"The returned Option type not a Some: {option}");
        }

        [TestMethod]
        public void ValueInSomeIsEqualToExpectedValue()
        {
            string itemToFind = "data";
            const int indexExpected = 6;

            Option<int> result = FindPosition<string>(dummyData, itemToFind);

            if(result is Some<int> validResult)
            {
                int valReturned = validResult.GetValue();

                Assert.AreEqual<int>(indexExpected, valReturned, $"Values are not the same: {indexExpected}, {valReturned}");
            }

        }

        [TestMethod]
        public void CheckSomeEqualToSomeWithSameValue()
        {
            int value = 10;

            Some<int> val1 = new Some<int>(value);
            Some<int> val2 = new Some<int>(value);

{'fraction_non_alphanumeric': 0.10806916426512968, 'fraction_numerical': 0.003170028818443804, 'mean_word_length': 2.293168880455408, 'pattern_counts': {'":': 0, '<': 36, '<?xml version=': 0, '>': 36, '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': '2233379', 'n_tokens_mistral': 965, 'n_tokens_neox': 927, 'n_words': 249}