private static void AddUserCreatedAccomplishment(User user) { var newExperienceType = AccomplishmentService.ExperienceTypes[(int)ExperienceTypeIds.UserCreated]; user.AddAccomplishment(newExperienceType, Guid.Empty, newExperienceType.Experience, user.CreatedBy, user.CreatedOn); AccomplishmentService.ResetExperienceIfNecessaryAndCheckForLevelChange(user, user.CreatedBy, user.CreatedOn); }
public void AccomplishmentService_Return_AccomplishmentList() { var options = FakeDataDBContext(); using (var context = new DataContext(options)) { var service = new AccomplishmentService(context); var results = service.GetAccomplishments(); var count = results.Count(); //Assert Assert.Equal(3, count); } }
public void AccomplishmentService_Return_Accomplishment_Delete_ReturnFalse() { var options = new DbContextOptionsBuilder <DataContext>() .UseInMemoryDatabase(databaseName: "recipedb") .Options; using (var context = new DataContext(options)) { var service = new AccomplishmentService(context); var result = service.Delete(8); //Assert Assert.False(result); } }
public void AccomplishmentService_Return_Accomplishment_NothingReturned() { var options = new DbContextOptionsBuilder <DataContext>() .UseInMemoryDatabase(databaseName: "recipedb") .Options; using (var context = new DataContext(options)) { var service = new AccomplishmentService(context); var result = service.GetAccomplisment(8); //Assert Assert.Null(result); } }
public void AccomplishmentService_Return_Accomplishment() { var options = new DbContextOptionsBuilder <DataContext>() .UseInMemoryDatabase(databaseName: "recipedb") .Options; using (var context = new DataContext(options)) { var service = new AccomplishmentService(context); var result = service.GetAccomplisment(2); //Assert Assert.Equal("FirstName2", result.FirstName); } }
public void AccomplishmentService_Return_Accomplishment_Record_UnEdited_ReturnNull() { var model = new PersonDetailAccomplishmentViewModel { PersonId = 5, FirstName = "EditfirstName", LastName = "EditLastName" }; var options = new DbContextOptionsBuilder <DataContext>() .UseInMemoryDatabase(databaseName: "recipedb") .Options; using (var context = new DataContext(options)) { var service = new AccomplishmentService(context); var result = service.Edit(model); Assert.Null(result); } }
private IActionResult GetStatusInternal(bool acknowledgeAccomplishments) { var userFromAuth = UserService.GetUserFromClaims(this.User, UserRepo, RequestLogger); RequestLogger.UserId = userFromAuth.Id.ToString(); var statusModel = new UserStatusModel() { IsEnabled = userFromAuth.IsEnabled, AccountCount = AccountRepo.FindCountByOwner(userFromAuth.Id), BudgetCount = BudgetRepo.FindCountByOwner(userFromAuth.Id), }; if (statusModel.AccountCount == 0 || statusModel.BudgetCount == 0) { statusModel.IsNew = true; } if (AccomplishmentService.GetAccomplishmentsAndSettings(statusModel, userFromAuth, acknowledgeAccomplishments)) { UserRepo.UpsertFromEditableModelStates(userFromAuth, userFromAuth.UserName); } return(Ok(statusModel)); }
public void AccomplishmentService_Return_Accomplishment_Record_Created_ReturnTrue() { var model = new PersonAccomplishmentViewModel { PersonId = 8, FirstName = "NewfirstName", LastName = "NewLastName", DateOfBirth = new DateTime(1989, 11, 03), City = "NewCity", State = "NewState" }; var options = new DbContextOptionsBuilder <DataContext>() .UseInMemoryDatabase(databaseName: "recipedb") .Options; using (var context = new DataContext(options)) { var service = new AccomplishmentService(context); var result = service.Create(model); Assert.True(result); } }