Exemplo 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());
            ApiPetClientResponseModel response = await client.PetGetAsync(default(int));

            response.Should().BeNull();
        }
Exemplo n.º 2
0
        public void MapClientResponseToRequest()
        {
            var mapper = new ApiPetModelMapper();
            var model  = new ApiPetClientResponseModel();

            model.SetProperties(1, 1, 1, "A", 1);
            ApiPetClientRequestModel response = mapper.MapClientResponseToRequest(model);

            response.Should().NotBeNull();
            response.BreedId.Should().Be(1);
            response.ClientId.Should().Be(1);
            response.Name.Should().Be("A");
            response.Weight.Should().Be(1);
        }
Exemplo n.º 3
0
        public void MapClientResponseToRequest()
        {
            var mapper = new ApiPetModelMapper();
            var model  = new ApiPetClientResponseModel();

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

            response.Should().NotBeNull();
            response.AcquiredDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.BreedId.Should().Be(1);
            response.Description.Should().Be("A");
            response.PenId.Should().Be(1);
            response.Price.Should().Be(1m);
        }
Exemplo n.º 4
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;

            ApiPetClientResponseModel response = await client.PetGetAsync(1);

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