public void Constructor_SetsProperties() { var dut = new GetFunctionalRolesQuery("PCS$TESTPLANT", "NOTIFICATION"); Assert.AreEqual("PCS$TESTPLANT", dut.Plant); Assert.AreEqual("NOTIFICATION", dut.Classification); }
public void Setup() { _personInFunctionalRole = new PersonInFunctionalRole() { AzureOid = "3BFB54C7-91E2-422E-833F-951AD07FE37F", Email = "*****@*****.**", FirstName = "FirstName", LastName = "LastName", UserName = "******" }; _persons = new List <PersonInFunctionalRole> { _personInFunctionalRole }; var options = new MainApiOptions { ApiVersion = "1", Audience = "Aud", BaseAddress = "http://example.com/" }; _optionsMonitorMock = new Mock <IOptionsMonitor <MainApiOptions> >(); _optionsMonitorMock .Setup(x => x.CurrentValue) .Returns(options); _request = new GetFunctionalRolesQuery(Plant, Classification); var url = $"{options.BaseAddress}Library/FunctionalRoles" + $"?plantId={_request.Plant}" + $"&classification={_request.Classification}" + $"&api-version={options.ApiVersion}"; var functionalRoles = new List <MainApiFunctionalRole> { new MainApiFunctionalRole { Code = "CodeA", Description = "DescriptionA", Email = "*****@*****.**", InformationEmail = "*****@*****.**", UsePersonalEmail = true, Persons = _persons }, new MainApiFunctionalRole { Code = "CodeB", Description = "DescriptionB", Email = "*****@*****.**", InformationEmail = "*****@*****.**", UsePersonalEmail = false, Persons = new List <PersonInFunctionalRole>() } }; _clientMock = new Mock <IBearerTokenApiClient>(); _clientMock .Setup(x => x.QueryAndDeserializeAsync <List <MainApiFunctionalRole> >(url)) .Returns(Task.FromResult(functionalRoles)); _dut = new GetFunctionalRolesQueryHandler(_clientMock.Object, _optionsMonitorMock.Object); }