public void FunctionRepository_Remove_ValidFunction_Expected_FunctionRemovedFromRepo() { IFrameworkRepository <IFunction> functionRepo = MathOpsFactory.FunctionRepository(); string functionName = "TestFunction"; List <string> arguments = new List <string>() { "args" }; List <string> argumentDescriptions = new List <string>() { "the first argument" }; string description = "Test Description"; // The function repository must be loaded in order to populate the function list functionRepo.Load(); IFunction myFunction = MathOpsFactory.CreateFunction(functionName, arguments, argumentDescriptions, description); // save the new function functionRepo.Save(myFunction); functionRepo.Remove(myFunction); Assert.AreEqual(0, functionRepo.Find(c => c.FunctionName.Equals(functionName)).Count); }
public void FunctionRepository_Remove_NullFunction_Expected_ArgumentNullException() { IFrameworkRepository <IFunction> functionRepo = MathOpsFactory.FunctionRepository(); // The function repository must be loaded in order to populate the function list functionRepo.Load(); functionRepo.Remove((IFunction)null); }
public void FunctionRepository_RemoveCollection_NullCollection_Expected_ArgumentException() { IFrameworkRepository <IFunction> functionRepo = MathOpsFactory.FunctionRepository(); // The function repository must be loaded in order to populate the function list functionRepo.Load(); int beforeEmptySave = functionRepo.Find(c => c.FunctionName != string.Empty).Count; functionRepo.Remove((ICollection <IFunction>)null); Assert.IsNotNull(beforeEmptySave); }
public void FunctionRepository_RemopveCollection_EmptyCollection_Expected_NoFunctionsRemovedFromRepo() { IFrameworkRepository <IFunction> functionRepo = MathOpsFactory.FunctionRepository(); // The function repository must be loaded in order to populate the function list functionRepo.Load(); int beforeEmptySave = functionRepo.Find(c => c.FunctionName != string.Empty).Count; ICollection <IFunction> functionList = new List <IFunction>(); functionRepo.Remove(functionList); int afterEmptySave = functionRepo.Find(c => c.FunctionName != string.Empty).Count; Assert.AreEqual(beforeEmptySave, afterEmptySave); }
public void FunctionRepository_RemoveCollection_ValidFunction_Expected_RepoUpdatedWithNewFunction() { IFrameworkRepository <IFunction> functionRepo = MathOpsFactory.FunctionRepository(); // The function repository must be loaded in order to populate the function list functionRepo.Load(); ICollection <IFunction> functionsToRemove = functionRepo.Find(c => c.FunctionName.Contains("s")); int functionCountBeforeRemove = functionRepo.Find(c => c.FunctionName != string.Empty).Count; functionRepo.Remove(functionsToRemove); int functionCountAfterRemove = functionRepo.Find(c => c.FunctionName != string.Empty).Count; Assert.IsTrue(functionCountAfterRemove < functionCountBeforeRemove); }
private void RemoveWebResource() { if (SelectedWebResource != null) { try { var parent = SelectedWebResource.Parent; _webResources.Remove(SelectedWebResource); SelectedWebResource = parent; base.OnPropertyChanged("RootWebResource"); } catch (WebResourceRemoveFailedException) { } } }