Esempio n. 1
0
        public void RunTest02()
        {
            IsUnique test   = new IsUnique("This one will fail.");
            var      result = test.Run();

            Assert.IsFalse(result);
        }
Esempio n. 2
0
        public void RunTest05()
        {
            IsUnique test   = new IsUnique("Dud");
            var      result = test.Run();

            Assert.IsFalse(result);
        }
Esempio n. 3
0
        public void RunTest04()
        {
            IsUnique test   = new IsUnique(null);
            var      result = test.Run();

            Assert.IsTrue(result);
        }
 public void IsUniqueSolution()
 {
     foreach (var item in _expected)
     {
         Assert.Equal(item.Item2, IsUnique.IsUniqueSolution(item.Item1));
     }
 }
Esempio n. 5
0
        public void IsUniqueInPlaceTest(string input, bool expectedResult)
        {
            var inputFormatted = input.ToCharArray().ToList();
            var result         = IsUnique.RunInPlace(inputFormatted);

            Assert.Equal(expectedResult, result);
        }
Esempio n. 6
0
        public void EvaluateShouldReturnTrueOrFalseWhenGivenAnyString(string any, bool expected)
        {
            IsUnique isUnique = new IsUnique();
            bool     actual   = isUnique.Evaluate(any);

            Assert.Equal(expected, actual);
        }
Esempio n. 7
0
        public void RunTest01()
        {
            IsUnique test   = new IsUnique("It works!");
            var      result = test.Run();

            Assert.IsTrue(result);
        }
Esempio n. 8
0
        static void Main(string[] args)
        {
            var test = "helo";
            var a    = new IsUnique();

            System.Console.WriteLine(a.IsUniqueElement(test));
        }
Esempio n. 9
0
        public void FirstTry_The_String_Has_All_Unique_Characters()
        {
            string myString = "abcdefgh";

            bool result = new IsUnique().FirstTry(myString);

            Assert.True(result);
        }
Esempio n. 10
0
        public void MyTry_Vafzmora_The_String_Has_A_Duplicate_Character()
        {
            string myString = "abcdebfgh";

            bool result = new IsUnique().MyTry_Vafzmora(myString);

            Assert.False(result);
        }
Esempio n. 11
0
        public void SecondTry_The_String_Has_A_Duplicate_Character()
        {
            string myString = "abcdebfgh";

            bool result = new IsUnique().SecondTry(myString);

            Assert.False(result);
        }
Esempio n. 12
0
        public void MyTry_Vafzmora_The_String_Has_All_Unique_Characters()
        {
            string myString = "abcdefgh";

            bool result = new IsUnique().MyTry_Vafzmora(myString);

            Assert.True(result);
        }
Esempio n. 13
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Name?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ IsUnique.GetHashCode();
         return(hashCode);
     }
 }
Esempio n. 14
0
 public bool Equals(IndexOptions other)
 {
     return(!ReferenceEquals(null, other) &&
            IsUnique.Equals(other.IsUnique) &&
            WhenStringThenIgnoreCase.Equals(other.WhenStringThenIgnoreCase) &&
            WhenDateThenIgnoreTimeOfDay.Equals(other.WhenDateThenIgnoreTimeOfDay) &&
            (IncludeValues ?? Enumerable.Empty <object>()).SequenceEqual(other.IncludeValues ?? Enumerable.Empty <object>()) &&
            (ExcludeValues ?? Enumerable.Empty <object>()).SequenceEqual(other.ExcludeValues ?? Enumerable.Empty <object>()));
 }
Esempio n. 15
0
 /// <summary>
 /// Serves as a hash function for a particular type.
 /// </summary>
 /// <returns>
 /// A hash code for the current <see cref="T:System.Object"/>.
 /// </returns>
 /// <filterpriority>2</filterpriority>
 public override int GetHashCode()
 {
     unchecked
     {
         int result = IsUnique.GetHashCode();
         result = (result * 397) ^ (HashIndexedProps != null ? Collections.GetHashCode(HashIndexedProps) : 0);
         result = (result * 397) ^ (RangeIndexedProps != null ? Collections.GetHashCode(RangeIndexedProps) : 0);
         return(result);
     }
 }
Esempio n. 16
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (_displayName != null ? _displayName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (DataType != null ? DataType.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Description != null ? Description.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ IsUnique.GetHashCode();
         return(hashCode);
     }
 }
Esempio n. 17
0
        public void IsUniqueTest(string input, bool expectedResult)
        {
            var result = IsUnique.Run(input);

            Assert.Equal(expectedResult, result);
        }
Esempio n. 18
0
 public void initializeIsUnique()
 {
     _str = new IsUnique();
 }
Esempio n. 19
0
        public string GetPropertiesAsXml()
        {
            StringBuilder sbResult = new StringBuilder();

            sbResult.Append("<" + (String.IsNullOrEmpty(ColumnName) ? "_" : ColumnName) + GetRegexProperties());
            if (!String.IsNullOrEmpty((PrecedingRegEx ?? "").TrimEnd('"')))
            {
                sbResult.Append(" Prefix = '" + PrecedingRegEx + "'");
            }
            if (!String.IsNullOrEmpty((TrailingRegEx ?? "").TrimEnd('"')))
            {
                sbResult.Append(" Suffix = '" + TrailingRegEx + "'");
            }
            if (ColumnType != RegexColumnType.STRING)
            {
                sbResult.Append(" Type = '" + ColumnType.ToString() + "'");
            }
            if (!String.IsNullOrEmpty(ValueMatchingCondition))
            {
                sbResult.Append(" Condition = '" + ValueMatchingCondition + "'");
            }
            if (AutoIncrement)
            {
                sbResult.Append(" AutoIncrement = '" + AutoIncrement.ToString() + "'");
            }
            if (AutoIncrement)
            {
                sbResult.Append(" StartValue = '" + StartValue.ToString() + "'");
            }
            if (AutoIncrement)
            {
                sbResult.Append(" Increment = '" + Increment.ToString() + "'");
            }
            if (!String.IsNullOrEmpty(Expression))
            {
                sbResult.Append(" Expression = '" + Expression + "'");
            }
            if (IsForeignKey)
            {
                sbResult.Append(" ForeignKey = '" + IsForeignKey.ToString() + "'");
            }
            if (IsUnique)
            {
                sbResult.Append(" PrimaryKey = '" + IsUnique.ToString() + "'");
            }

            if (!String.IsNullOrEmpty(DisplayName))
            {
                sbResult.Append(" DisplayName = '" + DisplayName + "'");
            }
            if (!String.IsNullOrEmpty(Description))
            {
                sbResult.Append(" Description = '" + Description + "'");
            }
            if (!String.IsNullOrEmpty(Default))
            {
                sbResult.Append(" Default = '" + Default + "'");
            }
            sbResult.Append(" />");
            return(sbResult.ToString());
        }
Esempio n. 20
0
        public void Test2()
        {
            var actual = IsUnique.SolutionWithDictionary("test");

            Assert.AreEqual(false, actual);
        }
Esempio n. 21
0
 public void GetsString_ReturnsUniqueness(string inputString, bool result)
 {
     Assert.Equal(IsUnique.IsUniqueLinear(inputString), result);
 }
Esempio n. 22
0
    static void Main(string[] args)
    {
        var text = "asas";

        Console.WriteLine($"Is Uniqie : {text} - {IsUnique.solve(text.ToCharArray())}");
    }
Esempio n. 23
0
        public void Test22()
        {
            var actual = IsUnique.SolutionWithoutAdditionalDataStructure("test");

            Assert.AreEqual(false, actual);
        }
Esempio n. 24
0
 public void IsUniqueUsingArray_Test()
 {
     IsUnique.IsUniqueUsingArray("qwerasdzxco,nkl;p$!@(&*^").Should().BeTrue();
     IsUnique.IsUniqueUsingArray("qwerasdzxcFFo,nklo;p$!@(&*^").Should().BeFalse();
 }
Esempio n. 25
0
 public void Setup()
 {
     isUnique = new IsUnique();
 }
Esempio n. 26
0
        public void Test1()
        {
            var actual = IsUnique.SolutionWithDictionary("tes");

            Assert.AreEqual(true, actual);
        }
Esempio n. 27
0
        public void Test32()
        {
            var actual = IsUnique.SolutionWithoutAdditionalDataStructure("tes1234567");

            Assert.AreEqual(true, actual);
        }
Esempio n. 28
0
 public void IsUniqueUsingBitVector()
 {
     IsUnique.IsUniqueUsingBitVector("qwerasdzxcoZAIUWPOMCNB").Should().BeTrue();
     IsUnique.IsUniqueUsingBitVector("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ").Should().BeTrue();
     IsUnique.IsUniqueUsingArray("qwerasdzxcoAZAIUWPMPOMCNB").Should().BeFalse();
 }