Ejemplo n.º 1
0
        public virtual async void TestGetNotFound()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

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

            client.SetBearerToken(JWTTestHelper.GenerateBearerToken());
            ApiFollowerClientResponseModel response = await client.FollowerGetAsync(default(int));

            response.Should().BeNull();
        }
        public void MapClientRequestToResponse()
        {
            var mapper = new ApiFollowerModelMapper();
            var model  = new ApiFollowerClientRequestModel();

            model.SetProperties("A", DateTime.Parse("1/1/1987 12:00:00 AM"), 1, 1, "A", "A");
            ApiFollowerClientResponseModel response = mapper.MapClientRequestToResponse(1, model);

            response.Should().NotBeNull();
            response.Blocked.Should().Be("A");
            response.DateFollowed.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.FollowedUserId.Should().Be(1);
            response.FollowingUserId.Should().Be(1);
            response.FollowRequestStatu.Should().Be("A");
            response.Muted.Should().Be("A");
        }
Ejemplo 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;

            ApiFollowerClientResponseModel response = await client.FollowerGetAsync(1);

            response.Should().NotBeNull();
            response.Blocked.Should().Be("A");
            response.DateFollowed.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.FollowedUserId.Should().Be(1);
            response.FollowingUserId.Should().Be(1);
            response.FollowRequestStatu.Should().Be("A");
            response.Id.Should().Be(1);
            response.Muted.Should().Be("A");
        }