Previous CloneSet | Next CloneSet | Back to Main Report |
Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
---|---|---|---|---|
91 | 2 | 4 | 0.956 | class_member_declarations[5] |
Clone Abstraction | Parameter Bindings |
Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
---|---|---|---|
1 | 106 | 18 | src/NHibernate.Test/UtilityTest/JoinedEnumerableFixture.cs |
2 | 91 | 12 | src/NHibernate.Test/UtilityTest/JoinedEnumerableGenericFixture.cs |
| ||||
/// <summary> /// Test that the JoinedEnumerable works with a single wrapped /// IEnumerable as expected when fully enumerating the collection. /// </summary> [Test] public void WrapsSingle() { int[] expected = new int[] { 1, 2, 3 } ; EnumerableTester first; JoinedEnumerable joined = InitSingle( out first); int index = 0; foreach (int actual in joined) { Assert.AreEqual(expected[index], actual, "Failure at " + index.ToString()); index++; } Assert.AreEqual(expected.Length, index, "Every expected value was found"); Assert.IsTrue(first.WasDisposed, "should have been disposed of."); } /// <summary> /// Test that the wrapped IEnumerator has Dispose called even when /// the JoinedEnumerator doesn't enumerate all the way through the /// collection. /// </summary> [Test] public void WrapsSingleBreak() { int[] expected = new int[] { 1, 2, 3 } ; EnumerableTester first; JoinedEnumerable joined = InitSingle( out first); foreach (int actual in joined) { Assert.AreEqual(expected[0], actual, "first one was not what was expected."); break; } // ensure that the first was disposed of even though we didn't enumerate // all the way through Assert.IsTrue(first.WasDisposed, "should have been disposed of."); } /// <summary> /// Test that the JoinedEnumerable works with multiple wrapped /// IEnumerable as expected when fully enumerating the collections. /// </summary> [Test] public void WrapsMultiple() { int[] expected = new int[] { 1, 2, 3, 4, 5, 6 } ; EnumerableTester first; EnumerableTester second; JoinedEnumerable joined = InitMultiple( out first, out second); int index = 0; foreach (int actual in joined) { Assert.AreEqual(expected[index], actual, "Failure at " + index.ToString()); index++; } Assert.AreEqual(expected.Length, index, "Every expected value was found"); Assert.IsTrue(first.WasDisposed, "first should have been disposed of."); Assert.IsTrue(second.WasDisposed, "second should have been disposed of. "); } /// <summary> /// Test that the JoinedEnumerable works with multiple wrapped /// IEnumerable as expected when breaking out. /// </summary> [Test] public void WrapsMultipleBreak() { // break in the first IEnumerator WrapsMultipleBreak(2); // ensure behavior is consistent if break in 2nd IEnumerator WrapsMultipleBreak(4); } private void WrapsMultipleBreak(int breakIndex) { int[] expected = new int[] { 1, 2, 3, 4, 5, 6 } ; EnumerableTester first; EnumerableTester second; JoinedEnumerable joined = InitMultiple( out first, out second); int index = 0; foreach (int actual in joined) { Assert.AreEqual(expected[index], actual, "Failure at " + index.ToString()); index++; if (index == breakIndex) { break; } } Assert.IsTrue(first.WasDisposed, "first should have been disposed of."); Assert.IsTrue(second.WasDisposed, "second should have been disposed of. "); } |
| ||||
[Test] public void WrapsSingle() { int[] expected = new int[] { 1, 2, 3 } ; EnumerableTester<int> first; JoinedEnumerable<int> joined = InitSingle( out first); int index = 0; foreach (int actual in joined) { Assert.AreEqual(expected[index], actual, "Failure at " + index); index++; } Assert.AreEqual(expected.Length, index, "Every expected value was found"); Assert.IsTrue(first.WasDisposed, "should have been disposed of."); } [Test] public void WrapsSingleBreak() { int[] expected = new int[] { 1, 2, 3 } ; EnumerableTester<int> first; JoinedEnumerable<int> joined = InitSingle( out first); foreach (int actual in joined) { Assert.AreEqual(expected[0], actual, "first one was not what was expected."); break; } Assert.IsTrue(first.WasDisposed, "should have been disposed of."); } [Test] public void WrapsMultiple() { int[] expected = new int[] { 1, 2, 3, 4, 5, 6 } ; EnumerableTester<int> first; EnumerableTester<int> second; JoinedEnumerable<int> joined = InitMultiple( out first, out second); int index = 0; foreach (int actual in joined) { Assert.AreEqual(expected[index], actual, "Failure at " + index); index++; } Assert.AreEqual(expected.Length, index, "Every expected value was found"); Assert.IsTrue(first.WasDisposed, "first should have been disposed of."); Assert.IsTrue(second.WasDisposed, "second should have been disposed of. "); } [Test] public void WrapsMultipleBreak() { // break in the first IEnumerator WrapsMultipleBreak(2); // ensure behavior is consistent if break in 2nd IEnumerator WrapsMultipleBreak(4); } private static void WrapsMultipleBreak(int breakIndex) { int[] expected = new int[] { 1, 2, 3, 4, 5, 6 } ; EnumerableTester<int> first; EnumerableTester<int> second; JoinedEnumerable<int> joined = InitMultiple( out first, out second); int index = 0; foreach (int actual in joined) { Assert.AreEqual(expected[index], actual, "Failure at " + index); index++; if (index == breakIndex) { break; } } Assert.IsTrue(first.WasDisposed, "first should have been disposed of."); Assert.IsTrue(second.WasDisposed, "second should have been disposed of. "); } |
| |||
/// <summary> /// Test that the JoinedEnumerable works with a single wrapped /// IEnumerable as expected when fully enumerating the collection. /// </summary> [Test] public void WrapsSingle() { int[] expected = new int[] { 1, 2, 3 } ; [[#variable54b4a420]]first; [[#variable54b4a480]]joined = InitSingle( out first); int index = 0; foreach (int actual in joined) { Assert.AreEqual(expected[index], actual, "Failure at " + [[#variable54b4a540]]); index++; } Assert.AreEqual(expected.Length, index, "Every expected value was found"); Assert.IsTrue(first.WasDisposed, "should have been disposed of."); } /// <summary> /// Test that the wrapped IEnumerator has Dispose called even when /// the JoinedEnumerator doesn't enumerate all the way through the /// collection. /// </summary> [Test] public void WrapsSingleBreak() { int[] expected = new int[] { 1, 2, 3 } ; [[#variable54b4a420]]first; [[#variable54b4a480]]joined = InitSingle( out first); foreach (int actual in joined) { Assert.AreEqual(expected[0], actual, "first one was not what was expected."); break; } // ensure that the first was disposed of even though we didn't enumerate // all the way through Assert.IsTrue(first.WasDisposed, "should have been disposed of."); } /// <summary> /// Test that the JoinedEnumerable works with multiple wrapped /// IEnumerable as expected when fully enumerating the collections. /// </summary> [Test] public void WrapsMultiple() { int[] expected = new int[] { 1, 2, 3, 4, 5, 6 } ; [[#variable54b4a420]]first; [[#variable54b4a420]]second; [[#variable54b4a480]]joined = InitMultiple( out first, out second); int index = 0; foreach (int actual in joined) { Assert.AreEqual(expected[index], actual, "Failure at " + [[#variable54b4a540]]); index++; } Assert.AreEqual(expected.Length, index, "Every expected value was found"); Assert.IsTrue(first.WasDisposed, "first should have been disposed of."); Assert.IsTrue(second.WasDisposed, "second should have been disposed of. "); } /// <summary> /// Test that the JoinedEnumerable works with multiple wrapped /// IEnumerable as expected when breaking out. /// </summary> [Test] public void WrapsMultipleBreak() { // break in the first IEnumerator WrapsMultipleBreak(2); // ensure behavior is consistent if break in 2nd IEnumerator WrapsMultipleBreak(4); } [[#variable54b4a2c0]]void WrapsMultipleBreak(int breakIndex) { int[] expected = new int[] { 1, 2, 3, 4, 5, 6 } ; [[#variable54b4a420]]first; [[#variable54b4a420]]second; [[#variable54b4a480]]joined = InitMultiple( out first, out second); int index = 0; foreach (int actual in joined) { Assert.AreEqual(expected[index], actual, "Failure at " + [[#variable54b4a540]]); index++; if (index == breakIndex) { break; } } Assert.IsTrue(first.WasDisposed, "first should have been disposed of."); Assert.IsTrue(second.WasDisposed, "second should have been disposed of. "); } |
CloneAbstraction |
Parameter Index | Clone Instance | Parameter Name | Value |
---|---|---|---|
1 | 1 | [[#54b4a420]] | EnumerableTester<int> |
1 | 2 | [[#54b4a420]] | EnumerableTester |
2 | 1 | [[#54b4a480]] | JoinedEnumerable<int> |
2 | 2 | [[#54b4a480]] | JoinedEnumerable |
3 | 1 | [[#54b4a540]] | index |
3 | 2 | [[#54b4a540]] | index.ToString() |
4 | 1 | [[#54b4a2c0]] | private static |
4 | 2 | [[#54b4a2c0]] | private |