public static void TeardownClass() { ProfileRepository repo = new ProfileRepository(); var result = repo.GetProfileByUserId("TestUserId"); if (result != null) { repo.DeleteProfile(result.ProfileId); } result = repo.GetProfileByUserId("TestUserId2"); if (result != null) { repo.DeleteProfile(result.ProfileId); } result = repo.GetProfileByUserId("TestUserIdDelete"); if (result != null) { repo.DeleteProfile(result.ProfileId); } result = repo.GetProfileByUserId("TestUserIdSearch"); if (result != null) { repo.DeleteProfile(result.ProfileId); } }
public void RepositoryDeleteProfilesByNameTest() { // Arrange var fakeProfileService = new FakeProfileService(); var toBeAddedProfiles = new[] { new WSProfile() { Name = "Prof A" }, new WSProfile() { Name = "Prof B" } }; fakeProfileService.AddProfiles(toBeAddedProfiles); var repo = new ProfileRepository(fakeProfileService); // Act var actual = repo.DeleteProfile("Prof A"); // Assert Assert.AreEqual(1, actual); Assert.AreEqual(toBeAddedProfiles.Length - 1, fakeProfileService.AllProfiles.Length); }
public void DeleteProfile_DeletesCreatedProfile() { // Arrange var profile = new InferenceProfile { ProfileName = "ProjectSelection", Rules = new List <string> { "IF A=1 THEN B=2", "IF B=2 THEN C=3" }, Variables = new List <string> { "A:Initial:[1|2|3]", "B:Derivative:[1|2|3]", "C:Derivative:[1|2|3]" } }; // Act var result = _profileRepository.SaveProfile(profile); var entitiesDeletedCount = _profileRepository.DeleteProfile(profile.ProfileName); var notExistingProfile = _profileRepository.GetProfileByName(profile.ProfileName); // Assert Assert.IsTrue(result); Assert.IsTrue(File.Exists(_databaseFilename)); Assert.AreEqual(1, entitiesDeletedCount); Assert.IsFalse(notExistingProfile.IsPresent); }
public void DeleteProfile() { var profile = _profileRepository.GetUserProfileByUserId(UserId); if (profile != null) { var isDeleted = _profileRepository.DeleteProfile(profile.UserId); if (isDeleted) { //Will actually delete records //var isSaved = _profileRepository.Save(); //Trace.WriteLine(isSaved ? "Profile Deleted!!!" : "Save Method Error!!!"); Trace.WriteLine("Profile Deleted!!!"); } else { Trace.WriteLine("Profile Not Deleted!!! Delete Method Error"); } } else { Trace.WriteLine("Profile not found!!!"); } }
public void Delete() { var profile = repo.GetProfileByUserId("testUserIdDelete"); Assert.IsNotNull(profile); repo.DeleteProfile(profile.ProfileId); profile = repo.GetProfileByUserId("testUserIdDelete"); Assert.IsNull(profile); }
public async void DeleteProfileTest() { var options = new DbContextOptionsBuilder <BefordingTestContext>() .UseInMemoryDatabase(databaseName: "BefordingTestDb") .Options; var context = new BefordingTestContext(options); var repository = new ProfileRepository(context, _userInfoServiceMock.Object, _logRepositoryMock.Object); fillMockDatabase(5, context); await repository.DeleteProfile(2); Assert.True(context.Profiles.FirstOrDefault(x => x.Id == 2) == null); }
private void ExecDeleteCommand(object obj) { ProfileRepository.DeleteProfile(SelectedProfile.Id); RefreshProfileListFromDisk(); IsDeleteDialogVisible = false; }
// DELETE: api/ProfilesService/5 public void DeleteProfile(int id) { repo.DeleteProfile(id); }