public async Task CreateApps() { // Arrange // Act var result = await sut.CreateApp(new LicenseRequest() { Name = "Test App 3", OwnerId = 1, DevUrl = "https://localhost:5001", LiveUrl = "https://testapp3.com" }); var apps = context.Apps.ToList(); // Assert Assert.That(result.Success, Is.True); Assert.That(result.Message, Is.EqualTo("App Created")); Assert.That(result.App.IsActive, Is.True); }
public async Task <ActionResult <App> > PostApp( [FromBody] LicenseRequest request) { var result = await appsService.CreateApp(request); if (result.Success) { result.Message = ControllerMessages.StatusCode201(result.Message); return(StatusCode((int)HttpStatusCode.Created, result)); } else { result.Message = ControllerMessages.StatusCode404(result.Message); return(NotFound(result)); } }
public async Task NotCreateAppsIfOwnerDoesNotExist() { // Arrange // Act var result = await sutUserRepoFailure.CreateApp(new LicenseRequest() { Name = "Test App 3", OwnerId = 4, DevUrl = "https://localhost:5001", LiveUrl = "https://testapp3.com" }); var apps = context.Apps.ToList(); // Assert Assert.That(result.Success, Is.False); Assert.That(result.Message, Is.EqualTo("User does not Exist")); Assert.That(apps.Count, Is.EqualTo(2)); }