public void MapClientRequestToResponse()
        {
            var mapper = new ApiOrganizationModelMapper();
            var model  = new ApiOrganizationClientRequestModel();

            model.SetProperties("A");
            ApiOrganizationClientResponseModel response = mapper.MapClientRequestToResponse(1, model);

            response.Should().NotBeNull();
            response.Name.Should().Be("A");
        }
Esempio n. 2
0
        public virtual async void TestByNameNotFound()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

            var client = new ApiClient(testServer.CreateClient());

            client.SetBearerToken(JWTTestHelper.GenerateBearerToken());
            ApiOrganizationClientResponseModel response = await client.ByOrganizationByName("test_value");

            response.Should().BeNull();
        }
Esempio n. 3
0
        public virtual async void TestGetFound()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

            var client = new ApiClient(testServer.CreateClient());

            client.SetBearerToken(JWTTestHelper.GenerateBearerToken());
            ApplicationDbContext context = testServer.Host.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext;

            ApiOrganizationClientResponseModel response = await client.OrganizationGetAsync(1);

            response.Should().NotBeNull();
            response.Id.Should().Be(1);
            response.Name.Should().Be("A");
        }