public void WorkItemTypeValidateAttribute_Invalid_Value_Throws() { // Arrange var ps = BaseTests.PrepPowerShell(); ps.Invoke <string>().Returns(this._defaultProject, this._workItemTypes); WorkItemTypeCache.Cache.Shell = ps; WorkItemTypeCache.Invalidate(); // Act // Assert Assert.ThrowsException <ValidationMetadataException>(() => this.Validate("Test", null)); }
public void WorkItemTypeValidateAttribute_Empty_Cache_Does_Not_Throw() { // Arrange var ps = BaseTests.PrepPowerShell(); ps.Invoke <string>().Returns(this._defaultProject, this._emptyStrings); WorkItemTypeCache.Cache.Shell = ps; WorkItemTypeCache.Invalidate(); // Act this.Validate("Agile", null); // Assert }
public void WorkItemTypeCache_Update_With_Empty_List() { // Arrange var expected = 0; var ps = BaseTests.PrepPowerShell(); WorkItemTypeCache.Cache.Shell = ps; // Act WorkItemTypeCache.Update(new List <string>()); // Assert Assert.AreEqual(expected, WorkItemTypeCache.Cache.Values.Count); }
public void WorkItemTypeCache_Update_Returns_Null() { // Arrange var expected = 0; var ps = BaseTests.PrepPowerShell(); ps.Invoke <string>().Returns(this._defaultProject, _emptyStrings); WorkItemTypeCache.Cache.Shell = ps; // Act WorkItemTypeCache.Update(null); // Assert Assert.AreEqual(expected, WorkItemTypeCache.Cache.Values.Count); }
public void WorkItemTypeCache_GetCurrent() { // Arrange var expected = 5; var ps = BaseTests.PrepPowerShell(); ps.Invoke <string>().Returns(this._workItemTypes); WorkItemTypeCache.Cache.Shell = ps; // Act var actual = WorkItemTypeCache.GetCurrent(); // Assert Assert.AreEqual(expected, actual.Count()); }
public void WorkItemTypeCache_Update_With_Null_List() { // Arrange var expected = 5; var ps = BaseTests.PrepPowerShell(); ps.Invoke <string>().Returns(this._workItemTypes); WorkItemTypeCache.Cache.Shell = ps; // Act WorkItemTypeCache.Update(null); // Assert Assert.AreEqual(expected, WorkItemTypeCache.Cache.Values.Count); }
public void WorkItemTypeCache_HasCacheExpired() { // Arrange var expected = true; // Act WorkItemTypeCache.Invalidate(); // Assert Assert.AreEqual(expected, WorkItemTypeCache.HasCacheExpired, "Cache should be expired"); // Act WorkItemTypeCache.Update(new List <string>()); // Assert Assert.AreNotEqual(expected, WorkItemTypeCache.HasCacheExpired, "Cache should not be expired"); }