public void GetAllClaims_ShouldReturnClaimDirectory() { Claim claim = new Claim(); ClaimRepository repository = new ClaimRepository(); bool result = repository.AddNextClaim(claim); Assert.IsTrue(result); }
public void AddClaimToList_ShouldReturnTrue() { Claim claim = new Claim(); ClaimRepository repository = new ClaimRepository(); bool addResult = repository.AddClaimToList(claim); Assert.IsTrue(addResult); }
protected internal virtual Claim CreateNewClaim(Employee employee, Employee approver, string description, ProjectCode projectCode, DateTime dateCreated) { Claim claim = ClaimRepository.CreateNewClaim(employee, description); claim.ModifyApprover(approver); claim.ModifyProjectCode(projectCode); claim.DateCreated = dateCreated; return(claim); }
public void AddClaimToDirectory_ShouldGetCorrectBoolean() { ClaimClass testClaim = new ClaimClass(); ClaimRepository repository = new ClaimRepository(); bool addClaim = repository.AddClaimToDirectory(testClaim); Assert.IsTrue(addClaim); }
public void Seed() { _repo = new ClaimRepository(); claim1 = new Claim(1, ClaimType.Car, "car accident on HWY Y", 1400.00m, new DateTime(2020, 12, 20), new DateTime(2020, 12, 27)); _repo.AddClaim(claim1); claim2 = new Claim(2, ClaimType.Home, "fire in kitchen", 800.00m, new DateTime(2020, 10, 29), new DateTime(2020, 12, 22)); _repo.AddClaim(claim2); }
public void AddClaimToClaimsQueue_ShouldGetCorrectBoolean() { Claim claim = new Claim(); ClaimRepository repository = new ClaimRepository(); bool addResult = repository.AddClaimToClaimsQueue(claim); Assert.IsTrue(addResult); Console.WriteLine(addResult); }
public async Task Init() { await TestCleaner.CleanDatabase(); var numTestRows = 20; IDataGateway dataGateway = new SQLServerGateway(); IConnectionStringData connectionString = new ConnectionStringData(); IScopeRepository scopeRepository = new ScopeRepository(dataGateway, connectionString); IResourceRepository resourceRepository = new ResourceRepository(dataGateway, connectionString); IClaimRepository claimRepository = new ClaimRepository(dataGateway, connectionString); IAccessPolicyRepository accessPolicyRepository = new AccessPolicyRepository(dataGateway, connectionString); IAccessPolicyPairingRepository accessPolicyPairingRepository = new AccessPolicyPairingRepository(dataGateway, connectionString); for (int i = 1; i <= numTestRows; ++i) { ResourceModel resourceModel = new ResourceModel(); resourceModel.Id = i; resourceModel.Name = "TestResource" + i; ScopeModel scopeModel = new ScopeModel(); scopeModel.Id = i; scopeModel.Type = "TestScope" + i; scopeModel.Description = "TestDescription" + i; ClaimModel claimModel = new ClaimModel(); claimModel.Id = i; claimModel.Type = "TestClaim" + i; claimModel.Value = "TestDescription" + i; claimModel.IsDefault = true; var resourceId = await resourceRepository.CreateResource(resourceModel); var claimId = await claimRepository.CreateClaim(claimModel); var scopeId = await scopeRepository.CreateScope(scopeModel); AccessPolicyModel accessPolicyModel = new AccessPolicyModel(); accessPolicyModel.Id = i; accessPolicyModel.Name = "TestAccessPolicy" + i; accessPolicyModel.ResourceId = resourceId; accessPolicyModel.Priority = i % 4; var accessPolicyId = await accessPolicyRepository.CreateAccessPolicy(accessPolicyModel); AccessPolicyPairingModel accessPolicyPairingModel = new AccessPolicyPairingModel(); accessPolicyPairingModel.Id = i; accessPolicyPairingModel.ScopeId = scopeId; accessPolicyPairingModel.ClaimId = claimId; accessPolicyPairingModel.AccessPolicyId = accessPolicyId; await accessPolicyPairingRepository.CreateAccessPolicyPairing(accessPolicyPairingModel); } }
public void AddClaimTest() { ClaimRepository cRepo = new ClaimRepository(); Queue <Claim> claims = cRepo.GetClaims(); Claim test = new Claim(1, TypeOfClaim.Car, "car ded", 4500, new DateTime(), new DateTime()); cRepo.AddClaim(test); Assert.IsTrue(claims.Contains(test)); }
private short GenerateSequence(Customer customer, string currentYear) { ClaimRepository clRepos = (ClaimRepository)_unitOfWork.Claims; short maxCustomerClaim = clRepos.MaxClaimSeqeunce(customer.CustomerId, currentYear); if (maxCustomerClaim >= 3) { return(-1); } return(++maxCustomerClaim); }
public void AddToDirectory_ShouldGetCorrectBoolean() { //Arrange KClaim claim = new KClaim(); ClaimRepository repository = new ClaimRepository(); //Act bool addResult = repository.AddClaimToDirectory(claim); //Assert Assert.IsTrue(addResult); }
public void ClaimRepository_CountDown_ShouldCountDown() { ClaimRepository claimRepo = new ClaimRepository(); claimRepo.CountDown(); int expected = -1; int actual = claimRepo.claimCount; Assert.AreEqual(expected, actual); }
public void RepositoryGetStatusFail(int claimID, int policyID) { string p = ""; Mock <IClaimRepository> claimContextMock = new Mock <IClaimRepository>(); var claimRepoObject = new ClaimRepository(); claimContextMock.Setup(x => x.GetClaimStatus(claimID, policyID)).Returns(p); var claimStatus = claimRepoObject.GetClaimStatus(claimID, policyID); Assert.IsNull(claimStatus); Assert.AreNotEqual("Pending", claimStatus); }
public void AddClaim_ShouldReturnTrue() { //Arrange ClaimRepository claimRepo = new ClaimRepository(); Claim claim = new Claim(); //Act bool addSucceeded = claimRepo.AddClaim(claim); //Assert Assert.IsTrue(addSucceeded); }
public void AddToList_Should_GetNotNull() { DateTime AccDate2 = new DateTime(2018, 4, 11); DateTime ClmDate2 = new DateTime(2018, 4, 12); Claim claim = new Claim(2, ClaimType.Home, "House fire in kitchen", 4000.00, AccDate2, ClmDate2, true); ClaimRepository repository = new ClaimRepository(); repository.AddClaimToList(claim); Claim getNewClaim = repository.GetClaimByIDnumber(2); Assert.IsNotNull(getNewClaim); }
public void SeeAllClaimsList_ShouldReturnTrue() { Claim claim = new Claim(); ClaimRepository repository = new ClaimRepository(); repository.AddClaimToList(claim); List <Claim> directory = repository.SeeAllClaimsList(); bool directoryHasClaim = directory.Contains(claim); Assert.IsTrue(directoryHasClaim); }
public void AddClaimToQueue_ShouldReturnCorrectBool() { //Arrange ClaimRepository claimRepo = new ClaimRepository(); InsuranceClaim claim = new InsuranceClaim(24, ClaimType.Theft, "stole my bike", 2000.00M, new DateTime(2018, 12, 23), new DateTime(2019, 12, 20)); //ACT bool wasAdded = claimRepo.AddClaimToQueue(claim); //Assert Assert.IsTrue(wasAdded); }
public async Task <ActionResult> Index(int projectId) { var project = await ProjectRepository.GetProjectWithDetailsAsync(projectId); var claims = await ClaimRepository.GetClaimsCountByMasters(projectId, ClaimStatusSpec.Active); var groups = await ProjectRepository.GetGroupsWithResponsible(projectId); var currentUser = await GetCurrentUserAsync(); return(View(new MastersListViewModel(project, claims, groups, currentUser, UriService))); }
public void ClaimRepository_GetClaimsCorrectCount() { ClaimRepository _claimRepo = new ClaimRepository(); Claim itemOne = new Claim(); _claimRepo.AddClaimToQueue(itemOne); int actual = _claimRepo.GetClaimQueue().Count; int expected = 1; Assert.AreEqual(expected, actual); }
public void ReturnPrettyDateTest() { ClaimRepository cRepo = new ClaimRepository(); DateTime uglyDate = new DateTime(05, 05, 01); string actual = cRepo.ReturnPrettyDate(uglyDate); string expected = "5/1/5"; Console.WriteLine(actual); Assert.AreEqual(expected, actual); }
public void GetClaimsTest() { ClaimContent claim = new ClaimContent(); ClaimRepository repository = new ClaimRepository(); repository.AddClaimToQueue(claim); List <ClaimContent> allClaims = repository.GetClaims(); bool queueHasContent = allClaims.Contains(claim); Assert.IsTrue(queueHasContent); }
public void ClaimRepository_AddClaim_ShouldReturnQueueOfOne() { ClaimRepository claimRepo = new ClaimRepository(); Queue <Claim> claimQueue = new Queue <Claim>(); claimRepo.AddClaim(ClaimType.Car, "desc", 30m, DateTime.Now, DateTime.Now); claimQueue = claimRepo.GetClaims(); int expected = 1; int actual = claimQueue.Count; Assert.AreEqual(expected, actual); }
public void Arrange() { _testRepo = new ClaimRepository(); _claimOne = new Claim(1, ClaimType.Car, "Car crash", 2000, new DateTime(2010, 1, 1), new DateTime(2010, 1, 25)); _claimTwo = new Claim(2, ClaimType.Home, "Break-in", 50000, new DateTime(2011, 6, 30), new DateTime(2011, 8, 2)); _claimThree = new Claim(3, ClaimType.Theft, "Lost Car Keys", 50, new DateTime(2011, 2, 27), new DateTime(2011, 3, 14)); _claimFour = new Claim(4, ClaimType.Theft, "Kidnapped Dog", 3500, new DateTime(2012, 9, 8), new DateTime(2012, 10, 21)); _testRepo.AddClaim(_claimOne); _testRepo.AddClaim(_claimTwo); _testRepo.AddClaim(_claimThree); _testRepo.AddClaim(_claimFour); }
public void GetAllClaims_ShouldReturnCorrectCollection() { ClaimClass testClaim = new ClaimClass(); ClaimRepository repository = new ClaimRepository(); repository.AddClaimToDirectory(testClaim); Queue <ClaimClass> listOfClaims = repository.GetAllClaims(); bool directoryHasClaims = listOfClaims.Contains(testClaim); Assert.IsTrue(directoryHasClaims); }
public void GetNextClaim_ShouldReturnClaim() { ClaimRepository claimRepo = new ClaimRepository(); Claim numberOne = new Claim(1, ClaimType.Car, "whatever", 1050, new DateTime(2020, 2, 8), new DateTime(2020, 2, 16)); claimRepo.AddNewClaim(numberOne); Claim numberTwo = new Claim(2, ClaimType.Car, "whatever", 1050, new DateTime(2020, 2, 8), new DateTime(2020, 2, 16)); claimRepo.AddNewClaim(numberTwo); var nextClaim = claimRepo.GetNextClaim(); Assert.AreEqual(numberOne.ClaimId, nextClaim.ClaimId); }
public void GetClaim_ShouldReturnCorrectMenuItemList() { Claim claim = new Claim(); ClaimRepository repo = new ClaimRepository(); repo.AddClaimToClaimsQueue(claim); Queue <Claim> claims = repo.GetClaimsQueue(); bool queueHasClaim = claims.Contains(claim); Assert.IsTrue(queueHasClaim); Console.WriteLine(queueHasClaim); }
public void CheckAddToQueue() { //arrange ClaimRepository claimRepo = new ClaimRepository(); Claim claim = new Claim(ClaimType.Home, 789, "shed fire", 500m, new DateTime(2019, 4, 1), new DateTime(2019, 4, 3), true); //act claimRepo.AddToQueue(claim); Queue <Claim> queueClaim = claimRepo.GetClaimQueue(); //assert Assert.AreSame(claim, queueClaim); }
public void TestAddClaimToQueue() { Claim claims = new Claim(); _claimRepo = new ClaimRepository(); _claimRepo.AddClaimToQueue(claims); int expected = 1; int actual = _claimRepo.GetClaims().Count; Assert.AreEqual(expected, actual); }
public void DequeueClaim_ShouldReturnCorrectBool() { _repo = new ClaimRepository(); _claim = new Claim("1", ClaimType.Car, "Car accident on 465", 400.00m, Convert.ToDateTime("4 / 25 / 2018"), Convert.ToDateTime("4 / 27 / 2018")); _repo.AddClaimToClaimsQueue(_claim); Queue <Claim> testQueue = _repo.GetClaimsQueue(); Assert.IsTrue(testQueue.Count == 1); _repo.DequeueExistingClaim(); testQueue = _repo.GetClaimsQueue(); Assert.AreEqual(0, testQueue.Count); }
public void ClaimRepository_RemoveClaimFromQueue() { ClaimRepository _claimRepo = new ClaimRepository(); Claim itemOne = new Claim(); Claim itemTwo = new Claim(); _claimRepo.AddClaimToQueue(itemOne); _claimRepo.AddClaimToQueue(itemTwo); _claimRepo.RemoveClaimFromQueue(); int actual = _claimRepo.GetClaimQueue().Count; int expected = 1; }
public async Task <ActionResult> Delete(int projectId, int projectaclid) { var project = await ProjectRepository.GetProjectAsync(projectId); var projectAcl = project.ProjectAcls.Single(acl => acl.ProjectAclId == projectaclid); var claims = await ClaimRepository.GetClaimsForMaster(projectId, projectAcl.UserId, ClaimStatusSpec.Any); var groups = await ProjectRepository.GetGroupsWithResponsible(projectId); return(View(DeleteAclViewModel.FromAcl(projectAcl, claims.Count, groups.Where(gr => gr.ResponsibleMasterUserId == projectAcl.UserId).ToList(), UriService))); }