public void CorrectDeletePilots() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()); var repository = new ApplicationDbContext(options.Options); var pilot = new RallyPilotsServices(repository); var runways = new RunwaysServices(repository); var creat = new CreateServices(repository); var service = new DeleteServices(repository, runways, pilot); var input = new PilotViewModels { Id = 1, FirstName = "Pesho", LastName = "Ivanov", Age = 30, }; creat.CreatePilotAsync(input); var result = service.DeletePilots(1).Result; var resultPiot = pilot.GetPilot(1); var resultIsDeleted = resultPiot.IsDeleted; Assert.Equal(true, resultIsDeleted); Assert.Equal("Пилота, е изтрит успешно.", result); }
public void CorrectDeleteRunways() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()); var repository = new ApplicationDbContext(options.Options); var pilot = new RallyPilotsServices(repository); var runways = new RunwaysServices(repository); var creat = new CreateServices(repository); var service = new DeleteServices(repository, runways, pilot); var input = new RunwayViewModels { NameRunway = "Test", Difficulty = DifficultyType.Average, Description = "TestTest", TrackLength = 123, ImagName = "test", }; creat.CreateRunwayAsync(input); var result = service.DeleteRunways(1).Result; Assert.Equal("Пистата, е изтрита успешно.", result); }
public JsonResult DeleteWarehouse(int id) { var service = new DeleteServices(); var res = service.DeleteWarehouse(id); if (res) { return(Json(new { success = true })); } else { return(Json(new { success = false })); } }
public void DeleteServices_Test() { using (ShimsContext.Create()) { CloudFoundry.CloudController.V2.Client.Fakes.ShimCloudFoundryClient.AllInstances.LoginCloudCredentials = TestUtils.CustomLogin; CloudFoundry.Manifests.Fakes.ShimManifestDiskRepository.ReadManifestString = TestUtils.CustomReadManifest; CloudFoundry.Manifests.Fakes.ShimManifest.AllInstances.Applications = TestUtils.CustomManifestApplications; CloudFoundry.CloudController.V2.Client.Base.Fakes.ShimAbstractSpacesEndpoint.AllInstances.ListAllSpacesRequestOptions = TestUtils.CustomListAllSpaces; CloudFoundry.CloudController.V2.Client.Fakes.ShimPagedResponseCollection <ListAllSpacesResponse> .AllInstances.ResourcesGet = TestUtils.CustomGetPaged; CloudFoundry.CloudController.V2.Client.Base.Fakes.ShimAbstractSpacesEndpoint.AllInstances.ListAllServiceInstancesForSpaceNullableOfGuidRequestOptions = TestUtils.CustomListAllServiceInstances; CloudFoundry.CloudController.V2.Client.Fakes.ShimPagedResponseCollection <ListAllServiceInstancesForSpaceResponse> .AllInstances.ResourcesGet = TestUtils.CustomListAllServiceInstancesResponse; CloudFoundry.CloudController.V2.Client.Fakes.ShimServiceInstancesEndpoint.AllInstances.DeleteServiceInstanceNullableOfGuid = TestUtils.CustomDeleteServiceInstance; CloudFoundry.CloudController.V2.Client.Fakes.ShimPagedResponseCollection <ListAllOrganizationsResponse> .AllInstances.ResourcesGet = TestUtils.CustomListAllOrganizationsResponse; CloudFoundry.CloudController.V2.Client.Base.Fakes.ShimAbstractOrganizationsEndpoint.AllInstances.ListAllOrganizationsRequestOptions = TestUtils.CustomListAllOrganizations; CloudFoundry.CloudController.V2.Client.Fakes.ShimPagedResponseCollection <ListAllSpacesForOrganizationResponse> .AllInstances.ResourcesGet = TestUtils.CustomListAllSpacesForOrganizationResponse; CloudFoundry.CloudController.V2.Client.Base.Fakes.ShimAbstractOrganizationsEndpoint.AllInstances.ListAllSpacesForOrganizationNullableOfGuidRequestOptions = TestUtils.CustomListAllSpacesForOrganization; TestUtils.InitTestMetadata(); DeleteServices task = new DeleteServices(); task.CFUser = Settings.Default.User; task.CFPassword = Settings.Default.Password; task.CFServerUri = Settings.Default.ServerUri; task.CFSpace = "TestSpace"; task.CFOrganization = "TestOrg"; task.CFManifest = Settings.Default.CFManifest; task.BuildEngine = new FakeBuildEngine(); Assert.IsTrue(task.Execute()); } }