public async void ReturnValidModelForCorrectId(int?id) { var result = await sut.Delete(id); var vr = Assert.IsType <ViewResult>(result); fixture.repositoryWrapper.Verify(y => y.Service.GetServiceByIdAsync(id), Times.Once); Assert.Equal("Delete", vr.ViewName); Assert.IsAssignableFrom <ServiceDTO>(vr.Model); }
public void Should_Delete() { IConfiguration config = InitConfiguration(); ServiceController serviceController = new ServiceController(config); ServiceDto service = new ServiceDto { Id = Guid.Empty, Name = "ServiceNameTestDelete", Version = "ServiceVersion", ApiKey = "apiKeyTest" }; var farfetchMessage = serviceController.Insert(service); Assert.NotNull(farfetchMessage); Assert.AreEqual(typeof(FarfetchMessage <ServiceDto>), farfetchMessage.GetType()); Assert.NotNull(farfetchMessage.Result); Assert.AreEqual(service.Name, farfetchMessage.Result.Name); Assert.AreEqual(service.Version, farfetchMessage.Result.Version); Assert.AreEqual(service.ApiKey, farfetchMessage.Result.ApiKey); var farfetchMessage2 = serviceController.Delete(farfetchMessage.Result.Id); Assert.NotNull(farfetchMessage2); Assert.AreEqual(typeof(FarfetchMessage <bool>), farfetchMessage2.GetType()); Assert.NotNull(farfetchMessage2.Result); Assert.AreEqual(true, farfetchMessage2.Result); var farfetchMessage3 = serviceController.Get(farfetchMessage.Result.Id); Assert.NotNull(farfetchMessage3); Assert.AreEqual(typeof(FarfetchMessage <ServiceDto>), farfetchMessage.GetType()); Assert.IsNull(farfetchMessage3.Result); }
/// <summary> /// Remove a specific folder. /// </summary> /// <param name="path">folder path e.g. /Folder1</param> /// <param name="recursive">is subfolders and files must be deleted for specified path</param> /// <param name="storage">user's storage name</param> public void RemoveFolder(string path, bool recursive, string storage = "") { // DELETE storage/folder/{path}?appSID={appSID}&storage={storage}&recursive={recursive} string apiUrl = string.Format(@"storage/folder/{0}?storage={1}&recursive={2}", path, storage, recursive); ServiceController.Delete(apiUrl, AppSid, AppKey); }
/// <summary> /// Unsubscribe Heroku user /// </summary> /// <param name="herokuAppSID">Heroku user AppSID</param> public void UnsubscribeHerokuUser(string herokuAppSID) { // DELETE heroku/subscription?appSID={appSID}&herokuAppSID={herokuAppSID} string apiUrl = string.Format(@"heroku/subscription?herokuAppSID={0}", herokuAppSID); ServiceController.Delete(apiUrl, AppSid, AppKey); }
/// <summary> /// Delete Application /// </summary> /// <param name="existingApplicationName">Name of the existing application to delete</param> public void DeleteApplication(string applicationName) { // DELETE app/{name}?appSid={appSid} string apiUrl = "app/" + applicationName; ServiceController.Delete(apiUrl, AppSid, AppKey); }
/// <summary> /// Remove a specific file. /// </summary> /// <param name="path">file path e.g. /file.ext</param> /// <param name="versionID">file's version</param> /// <param name="storage">user's storage name</param> public void RemoveFile(string path, int versionID = 0, string storage = "") { // DELETE storage/file/{path}?appSID={appSID}&versionID={versionID}&storage={storage} string apiUrl = string.Format(@"storage/file/{0}?storage={1}", path, storage); if (!string.IsNullOrEmpty(storage)) { apiUrl = apiUrl + string.Format("&versionID={0}", versionID); } ServiceController.Delete(apiUrl, AppSid, AppKey); }
public int DeleteService(int serviceId) { return(CntrlSR.Delete(new ServiceModel { Id = serviceId })); }
}//Add a service public void Removeservice(Service RemoveService) { S_ctr.Delete(RemoveService);//Actually delete the Service }//Remove service