예제 #1
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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!!!");
            }
        }
예제 #5
0
        public void Delete()
        {
            var profile = repo.GetProfileByUserId("testUserIdDelete");

            Assert.IsNotNull(profile);

            repo.DeleteProfile(profile.ProfileId);

            profile = repo.GetProfileByUserId("testUserIdDelete");

            Assert.IsNull(profile);
        }
예제 #6
0
        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);
        }
예제 #7
0
 private void ExecDeleteCommand(object obj)
 {
     ProfileRepository.DeleteProfile(SelectedProfile.Id);
     RefreshProfileListFromDisk();
     IsDeleteDialogVisible = false;
 }
예제 #8
0
 // DELETE: api/ProfilesService/5
 public void DeleteProfile(int id)
 {
     repo.DeleteProfile(id);
 }