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