public void DeleteUserClaim_StateUnderTest_ExpectedBehavior() { // Arrange var accessorFactory = new AccessorFactory(); var userClaimsAccessor = accessorFactory.CreateAccessor <IUserClaimsAccessor>(); var DatabaseMock = new DatabaseMock(); DatabaseMock.SeedDatabase(); var userClaimId = DatabaseMock.GetId("userClaimId"); var userId = DatabaseMock.GetId("userId"); // Act userClaimsAccessor.DeleteUserClaim(userClaimId); var result = userClaimsAccessor.FindAllUserClaims(userId).Where(userClaim => userClaim.ClaimId == userClaimId); // Assert Assert.Empty(result); }
public void DeleteMembership_StateUnderTest_ExpectedBehavior() { // Arrange var accessorFactory = new AccessorFactory(); var membershipsAccessor = accessorFactory.CreateAccessor <IMembershipsAccessor>(); var DatabaseMock = new DatabaseMock(); DatabaseMock.SeedDatabase(); var membershipId = DatabaseMock.GetId("membershipId"); var userId = DatabaseMock.GetId("userId"); // Act membershipsAccessor.DeleteMembership(membershipId); var result = membershipsAccessor.FindAllUserApplications(userId).Where(membership => membership.Id == membershipId); // Assert Assert.Empty(result); }
public void SaveUserClaim_StateUnderTest_ExpectedBehavior() { // Arrange var accessorFactory = new AccessorFactory(); var userClaimsAccessor = accessorFactory.CreateAccessor <IUserClaimsAccessor>(); var DatabaseMock = new DatabaseMock(); DatabaseMock.SeedDatabase(); var claimId = DatabaseMock.GetId("claimId"); var userId = DatabaseMock.GetId("userId"); var userClaim = new UserClaim { Id = Guid.NewGuid(), ClaimId = claimId, UserId = userId }; // Act var result = userClaimsAccessor.SaveUserClaim(userClaim); // Assert Assert.NotNull(result); }
public void SaveMembership_StateUnderTest_ExpectedBehavior() { // Arrange var accessorFactory = new AccessorFactory(); var membershipsAccessor = accessorFactory.CreateAccessor <IMembershipsAccessor>(); var DatabaseMock = new DatabaseMock(); DatabaseMock.SeedDatabase(); var applicationId = DatabaseMock.GetId("applicationId"); var userId = DatabaseMock.GetId("userId"); var membership = new Membership { Id = Guid.NewGuid(), ApplicationId = applicationId, UserId = userId }; // Act var result = membershipsAccessor.SaveMembership(membership); // Assert Assert.NotNull(result); }
public void Find_StateUnderTest_ExpectedBehavior() { // Arrange var accessorFactory = new AccessorFactory(); var applicationsAccessor = accessorFactory.CreateAccessor <IApplicationsAccessor>(); var DatabaseMock = new DatabaseMock(); DatabaseMock.SeedDatabase(); var applicationId = DatabaseMock.GetId("applicationId"); // Act var result = applicationsAccessor.Find(applicationId); // Assert Assert.Equal(expected: applicationId, actual: result.Id); }
public void DeleteApplication_StateUnderTest_ExpectedBehavior() { // Arrange var accessorFactory = new AccessorFactory(); var applicationsAccessor = accessorFactory.CreateAccessor <IApplicationsAccessor>(); var DatabaseMock = new DatabaseMock(); DatabaseMock.SeedDatabase(); var applicationId = DatabaseMock.GetId("applicationId"); // Act applicationsAccessor.DeleteApplication(applicationId); // Assert Assert.Null(applicationsAccessor.Find(applicationId)); }
public void DeleteClaim_StateUnderTest_ExpectedBehavior() { // Arrange var accessorFactory = new AccessorFactory(); var claimsAccessor = accessorFactory.CreateAccessor <IClaimsAccessor>(); var DatabaseMock = new DatabaseMock(); DatabaseMock.SeedDatabase(); var claimId = DatabaseMock.GetId("claimId"); // Act claimsAccessor.DeleteClaim(claimId); // Assert Assert.Null(claimsAccessor.Find(claimId)); }
public void GetUser_StateUnderTest_ExpectedBehavior() { // Arrange var managerFactory = new ManagerFactory(); var manager = managerFactory.CreateManager <IApplicationManager>(); var DatabaseMock = new DatabaseMock(); DatabaseMock.SeedDatabase(); var userId = DatabaseMock.GetId("userId"); // Act var result = manager.GetUser(userId); // Assert Assert.NotEmpty(result.Applications); }
public void RemoveApplication_StateUnderTest_ExpectedBehavior() { // Arrange var managerFactory = new ManagerFactory(); var manager = managerFactory.CreateManager <IApplicationManager>(); var DatabaseMock = new DatabaseMock(); DatabaseMock.SeedDatabase(); var applicationId = DatabaseMock.GetId("applicationId"); string applicationName = DatabaseMock.GetValue("applicationName"); // Act manager.RemoveApplication(applicationId); // Assert Assert.Null(manager.GetApplicationUsers(applicationName)); }
public void RemoveApplication_StateUnderTest_ExpectedBehavior() { // Arrange ActorSystem actorSystem = ActorSystem.Create("TestActorSystem"); Props actorRouter = Props.Create <ApplicationsActor>().WithRouter(new RoundRobinPool(5)); IActorRef actorPool = actorSystem.ActorOf(actorRouter, "Test"); var applicationsController = new ApplicationsController(actorPool); var DatabaseMock = new DatabaseMock(); DatabaseMock.SeedDatabase(); var applicationId = DatabaseMock.GetId("applicationId"); // Act var result = applicationsController.RemoveApplication(applicationId).Result; // Assert Assert.IsType <AcceptedResult>(result); }
public void GetUser_StateUnderTest_ExpectedBehavior() { // Arrange ActorSystem actorSystem = ActorSystem.Create("TestActorSystem"); Props actorRouter = Props.Create <ApplicationsActor>().WithRouter(new RoundRobinPool(5)); IActorRef actorPool = actorSystem.ActorOf(actorRouter, "Test"); var applicationsController = new ApplicationsController(actorPool); var DatabaseMock = new DatabaseMock(); DatabaseMock.SeedDatabase(); var userId = DatabaseMock.GetId("userId"); // Act var result = applicationsController.GetUser(userId).Result; // Assert Assert.NotNull(result.Value.Applications); }
public void SaveClaim_StateUnderTest_ExpectedBehavior() { // Arrange var accessorFactory = new AccessorFactory(); var claimsAccessor = accessorFactory.CreateAccessor <IClaimsAccessor>(); var DatabaseMock = new DatabaseMock(); DatabaseMock.SeedDatabase(); var id = DatabaseMock.GetId("Applications"); var claim = new Claim { Id = Guid.NewGuid(), ApplicationId = id, ClaimType = Guid.NewGuid().ToString(), ClaimValue = Guid.NewGuid().ToString() }; // Act var result = claimsAccessor.SaveClaim(claim); // Assert Assert.NotNull(result); }