Nfield.Services.NfieldSurveysServiceTests.TestQuotaQueryAsync_ServerReturnsQuery_ReturnsListWithQuotaLevel C# (CSharp) Method

TestQuotaQueryAsync_ServerReturnsQuery_ReturnsListWithQuotaLevel() private method

        public void TestQuotaQueryAsync_ServerReturnsQuery_ReturnsListWithQuotaLevel()
        {
            const string levelId = "LevelId";
            const string name = "Name";

            var expectedQuotaLevel = new QuotaLevel
            {
                Id = levelId,
                Name = name
            };
            var mockedNfieldConnection = new Mock<INfieldConnectionClient>();
            var mockedHttpClient = CreateHttpClientMock(mockedNfieldConnection);
            mockedHttpClient
                .Setup(client => client.GetAsync(ServiceAddress + "surveys/1/quota"))
                .Returns(CreateTask(HttpStatusCode.OK, new StringContent(JsonConvert.SerializeObject(expectedQuotaLevel))));

            var target = new NfieldSurveysService();
            target.InitializeNfieldConnection(mockedNfieldConnection.Object);

            var actualQuotaLevel = target.QuotaQueryAsync("1").Result;
            mockedHttpClient.Verify(hc => hc.GetAsync(It.IsAny<string>()), Times.Once());
            Assert.Equal(expectedQuotaLevel.Id, actualQuotaLevel.Id);
            Assert.Equal(expectedQuotaLevel.Name, actualQuotaLevel.Name);
        }
NfieldSurveysServiceTests