1234567891011121314151617181920212223242526272829303132333435363738394041 |
- using AutoFixture;
- using Hotline.Api.Controllers;
- using Hotline.Share.Dtos.Order;
- using Microsoft.AspNetCore.Http;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.AspNetCore.Mvc.Testing;
- using Moq;
- using Shouldly;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Hotline.Application.Tests.Controller;
- public class OrderControllerTest : IClassFixture<WebApplicationFactory<Startup>>
- {
- private readonly OrderController _orderController;
- private readonly IFixture _fixture;
- private readonly WebApplicationFactory<Startup> _factory;
- public OrderControllerTest(OrderController orderController, WebApplicationFactory<Startup> factory)
- //public OrderControllerTest(HttpClient testClient)
- {
- _fixture = new Fixture();
- _orderController = orderController;
- //_testClient = testClient;
- _factory = factory;
- _orderController.ControllerContext = new ControllerContext
- {
- HttpContext = new DefaultHttpContext()
- };
- }
- [Fact]
- public async Task SendSMS_Test()
- {
- var inDto = _fixture.Create<VisitSmsInDto>();
- await _orderController.VisitPushSMSAsync(inDto);
- }
- }
|