Esempio n. 1
0
        public async Task ShouldAddSiteHandler()
        {
            //arrange
            var useCase = new AddSiteHandlerUseCase(DbContext);

            var addSiteHandlerRequest = new AddSiteHandlerRequest()
            {
                SiteName   = "Test",
                SiteUrl    = "test.com",
                HandlerUrl = "testhandler.com"
            };

            //action
            var siteHandlerId = useCase.Handle(addSiteHandlerRequest);

            SiteHandler siteHandler = await DbContext.SiteHandlers.SingleAsync(x => x.Id == 1);

            //assert
            siteHandler.Should().NotBe(null);

            siteHandler.Id.Should().Be(1);
            siteHandler.SiteName.Should().Be("Test");
            siteHandler.SiteUrl.Should().Be("test.com");
            siteHandler.HandlerUrl.Should().Be("testhandler.com");
        }
 public async Task <ActionResult <int> > Add(AddSiteHandlerRequest request)
 {
     return(await _addSiteHandlerUseCase.Handle(request));
 }