public virtual async void TestDelete()
        {
            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;

            IRetweetService service = testServer.Host.Services.GetService(typeof(IRetweetService)) as IRetweetService;
            var             model   = new ApiRetweetServerRequestModel();

            model.SetProperties(DateTime.Parse("1/1/1988 12:00:00 AM"), 1, TimeSpan.Parse("02:00:00"), 1);
            CreateResponse <ApiRetweetServerResponseModel> createdResponse = await service.Create(model);

            createdResponse.Success.Should().BeTrue();

            ActionResponse deleteResult = await client.RetweetDeleteAsync(2);

            deleteResult.Success.Should().BeTrue();
            ApiRetweetServerResponseModel verifyResponse = await service.Get(2);

            verifyResponse.Should().BeNull();
        }
Esempio n. 2
0
 public HomeController(ITweetService tweetService,
                       IRetweetService retweetService, IAppUserService appUserService, IUnitOfWork unitOfWork)
 {
     _appUserService = appUserService;
     _tweetService   = tweetService;
     _retweetService = retweetService;
 }
 public TweetController(ITweetService tweetService, IRetweetService retweetService, ICommentService commentService, IAppUserService appUserService)
 {
     _tweetService   = tweetService;
     _retweetService = retweetService;
     _commentService = commentService;
     _appUserService = appUserService;
 }
 public AbstractRetweetController(
     ApiSettings settings,
     ILogger <AbstractRetweetController> logger,
     ITransactionCoordinator transactionCoordinator,
     IRetweetService retweetService,
     IApiRetweetModelMapper retweetModelMapper
     )
     : base(settings, logger, transactionCoordinator)
 {
     this.RetweetService     = retweetService;
     this.RetweetModelMapper = retweetModelMapper;
 }
Esempio n. 5
0
 public RetweetController(
     ApiSettings settings,
     ILogger <RetweetController> logger,
     ITransactionCoordinator transactionCoordinator,
     IRetweetService retweetService,
     IApiRetweetServerModelMapper retweetModelMapper
     )
     : base(settings, logger, transactionCoordinator)
 {
     this.RetweetService     = retweetService;
     this.RetweetModelMapper = retweetModelMapper;
     this.BulkInsertLimit    = 250;
     this.MaxLimit           = 1000;
     this.DefaultLimit       = 250;
 }
        public virtual async void TestUpdate()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

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

            client.SetBearerToken(JWTTestHelper.GenerateBearerToken());
            var mapper = new ApiRetweetServerModelMapper();
            ApplicationDbContext          context = testServer.Host.Services.GetService(typeof(ApplicationDbContext)) as ApplicationDbContext;
            IRetweetService               service = testServer.Host.Services.GetService(typeof(IRetweetService)) as IRetweetService;
            ApiRetweetServerResponseModel model   = await service.Get(1);

            ApiRetweetClientRequestModel request = mapper.MapServerResponseToClientRequest(model);

            request.SetProperties(DateTime.Parse("1/1/1988 12:00:00 AM"), 1, TimeSpan.Parse("02:00:00"), 1);

            UpdateResponse <ApiRetweetClientResponseModel> updateResponse = await client.RetweetUpdateAsync(model.Id, request);

            context.Entry(context.Set <Retweet>().ToList()[0]).Reload();
            updateResponse.Record.Should().NotBeNull();
            updateResponse.Success.Should().BeTrue();
            updateResponse.Record.Id.Should().Be(1);
            context.Set <Retweet>().ToList()[0].Date.Should().Be(DateTime.Parse("1/1/1988 12:00:00 AM"));
            context.Set <Retweet>().ToList()[0].RetwitterUserId.Should().Be(1);
            context.Set <Retweet>().ToList()[0].Time.Should().Be(TimeSpan.Parse("02:00:00"));
            context.Set <Retweet>().ToList()[0].TweetTweetId.Should().Be(1);

            updateResponse.Record.Id.Should().Be(1);
            updateResponse.Record.Date.Should().Be(DateTime.Parse("1/1/1988 12:00:00 AM"));
            updateResponse.Record.RetwitterUserId.Should().Be(1);
            updateResponse.Record.Time.Should().Be(TimeSpan.Parse("02:00:00"));
            updateResponse.Record.TweetTweetId.Should().Be(1);
        }
 public RetweetController(IRetweetService retweetService, IAppUserService userService)
 {
     _retweetService = retweetService;
     _userService    = userService;
 }
Esempio n. 8
0
 public RetweetsController(ILogger <RetweetsController> logger, IRetweetService retweetService)
 {
     _logger         = logger;
     _retweetService = retweetService;
 }
 public ProfileController(IAppUserService userService, IRetweetService retweetService, ITweetService tweetService)
 {
     _userService    = userService;
     _retweetService = retweetService;
     _tweetService   = tweetService;
 }