root / trunk / Pithos.Core.Test / LocalFileComparerTest.cs @ dccd340f
History | View | Annotate | Download (1.9 kB)
1 | dccd340f | Panagiotis Kanavos | using System; |
---|---|---|---|
2 | dccd340f | Panagiotis Kanavos | using System.Collections.Generic; |
3 | dccd340f | Panagiotis Kanavos | using System.Linq; |
4 | dccd340f | Panagiotis Kanavos | using System.Text; |
5 | dccd340f | Panagiotis Kanavos | using NUnit.Framework; |
6 | dccd340f | Panagiotis Kanavos | using Pithos.Interfaces; |
7 | dccd340f | Panagiotis Kanavos | using Pithos.Network; |
8 | dccd340f | Panagiotis Kanavos | |
9 | dccd340f | Panagiotis Kanavos | namespace Pithos.Core.Test |
10 | dccd340f | Panagiotis Kanavos | { |
11 | dccd340f | Panagiotis Kanavos | [TestFixture] |
12 | dccd340f | Panagiotis Kanavos | class LocalFileComparerTest |
13 | dccd340f | Panagiotis Kanavos | { |
14 | dccd340f | Panagiotis Kanavos | [Test] |
15 | dccd340f | Panagiotis Kanavos | public void objects_with_same_name_and_hash_should_match() |
16 | dccd340f | Panagiotis Kanavos | { |
17 | dccd340f | Panagiotis Kanavos | var comparer = new LocalFileComparer(); |
18 | dccd340f | Panagiotis Kanavos | var account = new AccountInfo(); |
19 | dccd340f | Panagiotis Kanavos | var x = new Agents.CloudDownloadAction(account, new ObjectInfo {Account="a",Container="c",Name = "x", Hash = "a"}); |
20 | dccd340f | Panagiotis Kanavos | var y = new Agents.CloudDownloadAction(account, new ObjectInfo { Account = "a", Container = "c", Name = "x", Hash = "a" }); |
21 | dccd340f | Panagiotis Kanavos | Assert.That(comparer.Equals(x, y), Is.True); |
22 | dccd340f | Panagiotis Kanavos | } |
23 | dccd340f | Panagiotis Kanavos | |
24 | dccd340f | Panagiotis Kanavos | [Test] |
25 | dccd340f | Panagiotis Kanavos | public void objects_with_different_name_same_hash_should_not_match() |
26 | dccd340f | Panagiotis Kanavos | { |
27 | dccd340f | Panagiotis Kanavos | var comparer = new LocalFileComparer(); |
28 | dccd340f | Panagiotis Kanavos | var account = new AccountInfo(); |
29 | dccd340f | Panagiotis Kanavos | var x = new Agents.CloudDownloadAction(account, new ObjectInfo {Account="a",Container="c",Name = "x", Hash = "a"}); |
30 | dccd340f | Panagiotis Kanavos | var y = new Agents.CloudDownloadAction(account, new ObjectInfo { Account = "a", Container = "c", Name = "y", Hash = "a" }); |
31 | dccd340f | Panagiotis Kanavos | Assert.That(comparer.Equals(x, y), Is.True); |
32 | dccd340f | Panagiotis Kanavos | } |
33 | dccd340f | Panagiotis Kanavos | [Test] |
34 | dccd340f | Panagiotis Kanavos | public void directories_with_different_name_should_not_match() |
35 | dccd340f | Panagiotis Kanavos | { |
36 | dccd340f | Panagiotis Kanavos | var comparer = new LocalFileComparer(); |
37 | dccd340f | Panagiotis Kanavos | var account = new AccountInfo(); |
38 | dccd340f | Panagiotis Kanavos | var x = new Agents.CloudDownloadAction(account, new ObjectInfo {Account="a",Container="c",Name = "x", Hash = "a",Content_Type = "application/directory"}); |
39 | dccd340f | Panagiotis Kanavos | var y = new Agents.CloudDownloadAction(account, new ObjectInfo { Account = "a", Container = "c", Name = "y", Hash = "a", Content_Type = "application/directory" }); |
40 | dccd340f | Panagiotis Kanavos | Assert.That(comparer.Equals(x, y), Is.False); |
41 | dccd340f | Panagiotis Kanavos | } |
42 | dccd340f | Panagiotis Kanavos | |
43 | dccd340f | Panagiotis Kanavos | } |
44 | dccd340f | Panagiotis Kanavos | } |