1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle
.SvnHooks
.Tests
.RepositoryFileTestCases
19 using NUnit
.Framework
;
22 /// Summary description for ChangesTestCase.
24 [TestFixture
] public class ChangesTestCase
27 private IRepository repository
;
29 #region Setup / Teardown
31 [TestFixtureSetUp
] public void FixtureSetUp()
33 repository
= new MockRepository();
36 [SetUp
] public void SetUp()
38 // TODO: Add setup code
41 [TearDown
] public void TearDown()
43 // TODO: Add teardown code
46 [TestFixtureTearDown
] public void FixtureTearDown()
48 // TODO: Add fixture teardown code
53 [Test
] public void ContentsUpdated()
55 RepositoryFile file
= new RepositoryFile(repository
, "file",
56 RepositoryStatus
.Updated
, RepositoryStatus
.Unchanged
);
58 Assert
.AreEqual(RepositoryStatus
.Updated
, file
.ContentsStatus
);
59 Assert
.AreEqual(RepositoryStatus
.Unchanged
, file
.PropertiesStatus
);
62 [Test
] public void ContentsAdded()
64 RepositoryFile file
= new RepositoryFile(repository
, "file",
65 RepositoryStatus
.Added
, RepositoryStatus
.Unchanged
);
67 Assert
.AreEqual(RepositoryStatus
.Added
, file
.ContentsStatus
);
68 Assert
.AreEqual(RepositoryStatus
.Unchanged
, file
.PropertiesStatus
);
71 [Test
] public void ContentsDeleted()
73 RepositoryFile file
= new RepositoryFile(repository
, "file",
74 RepositoryStatus
.Deleted
, RepositoryStatus
.Unchanged
);
76 Assert
.AreEqual(RepositoryStatus
.Deleted
, file
.ContentsStatus
);
77 Assert
.AreEqual(RepositoryStatus
.Unchanged
, file
.PropertiesStatus
);
80 [Test
] public void ContentsUnchanged()
82 RepositoryFile file
= new RepositoryFile(repository
, "file",
83 RepositoryStatus
.Unchanged
, RepositoryStatus
.Unchanged
);
85 Assert
.AreEqual(RepositoryStatus
.Unchanged
, file
.ContentsStatus
);
86 Assert
.AreEqual(RepositoryStatus
.Unchanged
, file
.PropertiesStatus
);
90 [Test
] public void ContentsUpdatedPropertiesUpdated()
92 RepositoryFile file
= new RepositoryFile(repository
, "file",
93 RepositoryStatus
.Updated
, RepositoryStatus
.Updated
);
95 Assert
.AreEqual(RepositoryStatus
.Updated
, file
.ContentsStatus
);
96 Assert
.AreEqual(RepositoryStatus
.Updated
, file
.PropertiesStatus
);
99 [Test
] public void ContentsAddedPropertiesUpdated()
101 RepositoryFile file
= new RepositoryFile(repository
, "file",
102 RepositoryStatus
.Added
, RepositoryStatus
.Updated
);
104 Assert
.AreEqual(RepositoryStatus
.Added
, file
.ContentsStatus
);
105 Assert
.AreEqual(RepositoryStatus
.Updated
, file
.PropertiesStatus
);
108 [Test
] public void ContentsDeletedPropertiesUpdated()
110 RepositoryFile file
= new RepositoryFile(repository
, "file",
111 RepositoryStatus
.Deleted
, RepositoryStatus
.Updated
);
113 Assert
.AreEqual(RepositoryStatus
.Deleted
, file
.ContentsStatus
);
114 Assert
.AreEqual(RepositoryStatus
.Updated
, file
.PropertiesStatus
);
117 [Test
] public void ContentsUnchangedPropertiesUpdated()
119 RepositoryFile file
= new RepositoryFile(repository
, "file",
120 RepositoryStatus
.Unchanged
, RepositoryStatus
.Updated
);
122 Assert
.AreEqual(RepositoryStatus
.Unchanged
, file
.ContentsStatus
);
123 Assert
.AreEqual(RepositoryStatus
.Updated
, file
.PropertiesStatus
);
127 [ExpectedException(typeof(ArgumentException
))]
128 [Test
] public void PropertiesAdded()
130 RepositoryFile file
= new RepositoryFile(repository
, "file",
131 RepositoryStatus
.Unchanged
, RepositoryStatus
.Added
);
134 [ExpectedException(typeof(ArgumentException
))]
135 [Test
] public void PropertiesDeleted()
137 RepositoryFile file
= new RepositoryFile(repository
, "file",
138 RepositoryStatus
.Unchanged
, RepositoryStatus
.Added
);