public Union ( CustomSet, right ) : CustomSet, | ||
right | CustomSet, | |
return | CustomSet, |
public void Union_of_non_empty_sets_contains_all_unique_elements() { var set2 = new CustomSet(new[] { 2, 3 }); var sut = new CustomSet(new[] { 1, 3 }); Assert.Equal(new CustomSet(new[] { 3, 2, 1 }), sut.Union(set2)); }
public void Union_of_empty_sets_is_an_empty_set() { var set2 = new CustomSet(); var sut = new CustomSet(); Assert.Equal(new CustomSet(), sut.Union(set2)); }
public void Union_of_a_non_empty_set_and_empty_set_is_the_non_empty_set() { var set2 = new CustomSet(); var sut = new CustomSet(new[] { 1, 3 }); Assert.Equal(new CustomSet(new[] { 1, 3 }), sut.Union(set2)); }
public bool TestUnion(CustomSet <Person> set1, CustomSet <Person> set2, CustomSet <Person> expextedResult) { CustomSet <Person> result = CustomSet <Person> .Union(set1, set2); result.Trim(); return(expextedResult.Equals(result)); }
public void Union_of_non_empty_sets_contains_all_unique_elements() { var left = new CustomSet <int>(new[] { 1, 3 }); var right = new CustomSet <int>(new[] { 2, 3 }); var expected = new CustomSet <int>(new[] { 3, 2, 1 }); Assert.True(left.Union(right).Equals(expected)); }
public void Union_of_a_non_empty_set_and_empty_set_is_the_non_empty_set() { var left = new CustomSet <int>(new[] { 1, 3 }); var right = new CustomSet <int>(); var expected = new CustomSet <int>(new[] { 1, 3 }); Assert.True(left.Union(right).Equals(expected)); }
public void Union_of_two_empty_sets_is_an_empty_set() { var left = new CustomSet <int>(); var right = new CustomSet <int>(); var expected = new CustomSet <int>(); Assert.True(left.Union(right).Equals(expected)); }
public void Union_of_a_non_empty_set_and_empty_set_is_the_non_empty_set() { var left = new CustomSet <int>(new[] { 1, 3 }); var right = new CustomSet <int>(); var expected = new CustomSet <int>(new[] { 1, 3 }); Assert.That(left.Union(right), Is.EquivalentTo(expected)); }
public void Union_of_two_empty_sets_is_an_empty_set() { var left = new CustomSet <int>(); var right = new CustomSet <int>(); var expected = new CustomSet <int>(); Assert.That(left.Union(right), Is.EquivalentTo(expected)); }
static void Main(string[] args) { try { var binarySearch = new BinarySearch(); int[] searchExpression = { 1, 2, 3, 4, 6 }; var resultBinarySearch = binarySearch.Find(searchExpression, 4); var funcFibonacci = new FuncFibonacci(); Console.WriteLine("Fibonacci result: "); var result = funcFibonacci.GetSequence(-5); foreach (var s in funcFibonacci.GetSequence(15)) { Console.WriteLine(s); } var stack = new CustomStack <int>(); stack.Push(4); stack.Push(5); var myStackCount = stack.Count; var myStackPeek = stack.Peek(); stack.Pop(); stack.Push(34); var queue = new CustomQueue <int>(); queue.Enqueue(2); queue.Enqueue(3); queue.Enqueue(5); queue.Enqueue(12); var myQueueCount = queue.Count; var peek = queue.Peek(); var deQueue = queue.Dequeue(); var set1 = new CustomSet <int>(); set1.Add(1); set1.Add(2); set1.Add(56); var set2 = new CustomSet <int>(); set2.Add(2); set2.Add(4); set2.Add(6); var difference = set1.Difference(set2); var intersection = set1.Intersection(set2); var union = set1.Union(set2); Console.WriteLine("\nStack:"); foreach (var s in stack) { Console.WriteLine(s); } Console.WriteLine("\nQueue: "); foreach (var s in queue) { Console.WriteLine(s); } Console.WriteLine("\nSet: "); foreach (var s in set1) { Console.WriteLine(s); } Console.ReadLine(); } catch (NullReferenceException e) { Console.WriteLine(e.Message); } catch (ArgumentNullException e) { Console.WriteLine(e.Message); } catch (ArgumentException e) { Console.WriteLine(e.Message); } catch (InvalidOperationException e) { Console.WriteLine(); } }