public void RemoveApplicationsByTimeCreatedSpanTestNothingToRemove() { Maintenance maintenance = new Maintenance(); Assert.AreEqual(0, _managerStorage.GetApplications().Length); maintenance.RemoveApplications(_managerStorage, new TimeSpan(1000)); Assert.AreEqual(0, _managerStorage.GetApplications().Length); }
public void RemoveApplicationsByApplicationStateTestNothingToRemove() { Maintenance maintenance = new Maintenance(); Assert.AreEqual(0, _managerStorage.GetApplications().Length); maintenance.RemoveApplications(_managerStorage); Assert.AreEqual(0, _managerStorage.GetApplications().Length); }
public void RemoveApplicationsByTimeCreatedTestNothingToRemove() { Maintenance maintenance = new Maintenance(); Assert.AreEqual(0, m_managerStorage.GetApplications().Length); maintenance.RemoveApplications(m_managerStorage, DateTime.Now); Assert.AreEqual(0, m_managerStorage.GetApplications().Length); }
public void RemoveApplicationsByApplicationStateTestRemoveNonExistingState() { Maintenance maintenance = new Maintenance(); _managerStorage.AddApplication(new ApplicationStorageView(ApplicationState.AwaitingManifest, DateTime.Now, false, "username1")); Assert.AreEqual(1, _managerStorage.GetApplications().Length); maintenance.RemoveApplications(_managerStorage, ApplicationState.Stopped); Assert.AreEqual(1, _managerStorage.GetApplications().Length); }
public void RemoveApplicationsByTimeCreatedTestRemoveNonExistingDates() { Maintenance maintenance = new Maintenance(); DateTime timeCreated = DateTime.Now; _managerStorage.AddApplication(new ApplicationStorageView(ApplicationState.AwaitingManifest, timeCreated, false, "username1")); Assert.AreEqual(1, _managerStorage.GetApplications().Length); maintenance.RemoveApplications(_managerStorage, timeCreated.AddDays(-1)); Assert.AreEqual(1, _managerStorage.GetApplications().Length); }
public void RemoveApplicationsByTimeCreatedSpanTestRemoveNonExistingDates() { Maintenance maintenance = new Maintenance(); DateTime timeCreated = DateTime.Now; _managerStorage.AddApplication(new ApplicationStorageView(ApplicationState.AwaitingManifest, timeCreated, false, "username1")); Assert.AreEqual(1, _managerStorage.GetApplications().Length); // one hour should be enough to avoid removing this one. maintenance.RemoveApplications(_managerStorage, new TimeSpan(1, 0, 0)); Assert.AreEqual(1, _managerStorage.GetApplications().Length); }
public void RemoveApplicationsByApplicationStateTestRemoveMultipleExistingStates() { Maintenance maintenance = new Maintenance(); m_managerStorage.AddApplication(new ApplicationStorageView(ApplicationState.AwaitingManifest, DateTime.Now, false, "username1")); m_managerStorage.AddApplication(new ApplicationStorageView(ApplicationState.Stopped, DateTime.Now, false, "username1")); m_managerStorage.AddApplication(new ApplicationStorageView(ApplicationState.Ready, DateTime.Now, false, "username1")); m_managerStorage.AddApplication(new ApplicationStorageView(ApplicationState.AwaitingManifest, DateTime.Now, false, "username1")); m_managerStorage.AddApplication(new ApplicationStorageView(ApplicationState.Stopped, DateTime.Now, false, "username1")); Assert.AreEqual(5, m_managerStorage.GetApplications().Length); maintenance.RemoveApplications(m_managerStorage, ApplicationState.Stopped, ApplicationState.Ready); Assert.AreEqual(2, m_managerStorage.GetApplications().Length); }
public void RemoveApplicationsByTimeCreatedTestRemoveMultipleOldApplications() { Maintenance maintenance = new Maintenance(); DateTime timeCreated = DateTime.Now; _managerStorage.AddApplication(new ApplicationStorageView(ApplicationState.AwaitingManifest, timeCreated.AddDays(-5), false, "username1")); _managerStorage.AddApplication(new ApplicationStorageView(ApplicationState.Stopped, timeCreated.AddDays(-4), false, "username1")); _managerStorage.AddApplication(new ApplicationStorageView(ApplicationState.Ready, timeCreated.AddDays(1), false, "username1")); _managerStorage.AddApplication(new ApplicationStorageView(ApplicationState.AwaitingManifest, timeCreated.AddDays(-3), false, "username1")); _managerStorage.AddApplication(new ApplicationStorageView(ApplicationState.Stopped, timeCreated.AddDays(2), false, "username1")); Assert.AreEqual(5, _managerStorage.GetApplications().Length); maintenance.RemoveApplications(_managerStorage, timeCreated); Assert.AreEqual(2, _managerStorage.GetApplications().Length); }
public void RemoveApplicationsByTimeCreatedSpanTestRemoveMultipleOldApplications() { Maintenance maintenance = new Maintenance(); DateTime timeCreated = DateTime.Now; _managerStorage.AddApplication(new ApplicationStorageView(ApplicationState.AwaitingManifest, timeCreated.AddDays(-5), false, "username1")); _managerStorage.AddApplication(new ApplicationStorageView(ApplicationState.Stopped, timeCreated.AddDays(-4), false, "username1")); _managerStorage.AddApplication(new ApplicationStorageView(ApplicationState.Ready, timeCreated.AddDays(1), false, "username1")); _managerStorage.AddApplication(new ApplicationStorageView(ApplicationState.AwaitingManifest, timeCreated.AddDays(-3), false, "username1")); _managerStorage.AddApplication(new ApplicationStorageView(ApplicationState.Stopped, timeCreated.AddDays(2), false, "username1")); Assert.AreEqual(5, _managerStorage.GetApplications().Length); // put a 20 hour cut-off, this should remove 3 of the applications maintenance.RemoveApplications(_managerStorage, new TimeSpan(20, 0, 0)); Assert.AreEqual(2, _managerStorage.GetApplications().Length); }