public async Task UpdateIdentifier_IdentifierJustCreated_IdentifierUpdated() { // Arrange var user = TestHelper.GeorgeShazel; var loginResponse = await AuthClient.GetJwtToken(user.Username, "Start@123"); user.SetJwtEncodedString(loginResponse.Data.JwtAccessToken); UserContext.SetUser(user); var bpNumber = user.BPNumber.ToString(); var identifier = new BpIdentifier { AccountId = bpNumber, IdentifierType = IdentifierType.ZPASWD.ToString(), IdentifierNo = "Li0nOOjgfui" }; var password = GetIdentifierData(bpNumber, IdentifierType.ZPASWD); if (password != null) { McfClient.DeleteIdentifier(identifier); } McfClient.CreateIdentifier(identifier); // Act var response = McfClient.UpdateIdentifier(identifier); // Assert response.ShouldNotBeNull(); response.HttpStatusCode.ShouldBe(HttpStatusCode.Created); }
public async Task CreateIdentifier_NotAuthenticatedIdentifierDoesNotExist_IdentifierCreated() { // Arrange var user = TestHelper.GeorgeShazel; var loginResponse = await AuthClient.GetJwtToken(user.Username, "Start@123"); user.SetJwtEncodedString(loginResponse.Data.JwtAccessToken); UserContext.SetUser(user); var bpNumber = user.BPNumber.ToString(); var identifier = new BpIdentifier { AccountId = bpNumber, IdentifierType = IdentifierType.ZPASWD.ToString(), IdentifierNo = "zi1py786lOP" }; var password = GetIdentifierData(bpNumber, IdentifierType.ZPASWD); if (password != null) { McfClient.DeleteIdentifier(identifier); } // Next call should be unauthorized UserContext.JWT = null; // Act var response = McfClient.CreateIdentifier(identifier); // Assert response.ShouldNotBeNull(); response.Result.ShouldNotBeNull(); }
public async Task CreateIdentifier_IdentifierAlreadyExists_BadRequest() { // Arrange var user = TestHelper.ActivePaUser; var loginResponse = await AuthClient.GetJwtToken(user.Username, "Start@123"); user.SetJwtEncodedString(loginResponse.Data.JwtAccessToken); UserContext.SetUser(user); var bpNumber = user.BPNumber.ToString(); var startSocial = GetLast4Social(bpNumber); var identifier = new BpIdentifier { AccountId = bpNumber, IdentifierType = IdentifierType.ZLAST4.ToString(), IdentifierNo = startSocial }; // Act var response = McfClient.CreateIdentifier(identifier); // Assert response.ShouldNotBeNull(); response.Result.ShouldBeNull(); response.Error.Message.Value.ShouldContain("Already exists"); }
public async Task CreateIdentifier_IdentifierDoesNotExist_IdentifierCreated() { // Arrange var user = TestHelper.GeorgeShazel; var loginResponse = await AuthClient.GetJwtToken(user.Username, "Start@123"); user.SetJwtEncodedString(loginResponse.Data.JwtAccessToken); UserContext.SetUser(user); var bpNumber = user.BPNumber.ToString(); var identifier = new BpIdentifier { AccountId = bpNumber, IdentifierType = IdentifierType.ZPASWD.ToString(), IdentifierNo = "a4rFr3dKOPe" }; var password = GetIdentifierData(bpNumber, IdentifierType.ZPASWD); if (!string.IsNullOrEmpty(password)) { McfClient.DeleteIdentifier(identifier); } // Act var response = McfClient.CreateIdentifier(identifier); // Assert response.ShouldNotBeNull(); response.Result.ShouldNotBeNull(); response.Result.AccountId.ShouldBe(identifier.AccountId); response.Result.IdentifierType.ShouldBe(identifier.IdentifierType); response.Result.IdentifierNo.ShouldBe(identifier.IdentifierNo); }