Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifiche per i test di Roberto Catania #34

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions TestAPI.sln
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
Readme.md = Readme.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTest", "UnitTest\UnitTest.csproj", "{3DA60C53-90BD-4D3E-A3EE-23C202269280}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -28,6 +30,10 @@ Global
{A720BF0D-868C-404E-9A87-410694A01C6F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A720BF0D-868C-404E-9A87-410694A01C6F}.Release|Any CPU.Build.0 = Release|Any CPU
{A720BF0D-868C-404E-9A87-410694A01C6F}.Release|Any CPU.Deploy.0 = Release|Any CPU
{3DA60C53-90BD-4D3E-A3EE-23C202269280}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3DA60C53-90BD-4D3E-A3EE-23C202269280}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3DA60C53-90BD-4D3E-A3EE-23C202269280}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3DA60C53-90BD-4D3E-A3EE-23C202269280}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
8 changes: 4 additions & 4 deletions TestAPI/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
Expand All @@ -11,13 +11,13 @@
"profiles": {
"TestAPI": {
"commandName": "Project",
"dotnetRunMessages": "true",
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:5100",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"dotnetRunMessages": "true"
},
"IIS Express": {
"commandName": "IISExpress",
Expand All @@ -28,4 +28,4 @@
}
}
}
}
}
13 changes: 7 additions & 6 deletions TestAPI/TestAPI.csproj
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.15" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.15" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.15">
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.14" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.14" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.14">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.3.0" />
<PackageReference Include="System.Linq.Async" Version="5.1.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.14" />
</ItemGroup>

</Project>
44 changes: 40 additions & 4 deletions TestDB/Stored Procedures/usp_movecase.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE PROCEDURE [dbo].[usp_movecase]
alter PROCEDURE [dbo].[usp_movecase]
@casetomove UNIQUEIDENTIFIER
WITH ENCRYPTION
AS
Expand All @@ -11,7 +11,41 @@ BEGIN
BEGIN TRANSACTION
BEGIN TRY

PRINT 'your code goes here'
--PRINT 'your code goes here'
with all_data as (
select c.serial as case_serial,
c.guid as case_guid,
--
p.serial as product_serial,
p.guid as product_guid,
p.name as product_name,
--
pc.guid as productcategory_guid,
pc.serial as productcategory_serial,
pc.name as productcategoty_name,
--
pl.guid as pallet_guid,
pl.serial as pallet_serial
from dbo.[case] as c
left join dbo.product as p on p.guid = c.productguid
left join dbo.productcategory as pc on pc.guid = p.productcategoryguid
left join dbo.pallet as pl on pl.guid = c.palletguid
),
to_move as (
select *
from all_data as tomove
where tomove.case_guid = @casetomove
),
new_pallet as (
select top 1 dest.*
from dbo.pallet as dest
inner join to_move on to_move.pallet_guid != dest.guid
--where dest.productcategory_guid = to_move.productcategory_guid
where exists (select 1 from all_data as x where x.pallet_guid = dest.guid and x.productcategory_guid = to_move.productcategory_guid)
)
update dbo.[case] set palletguid = x.guid
from new_pallet as x
where dbo.[case].[guid] = @casetomove

END TRY
BEGIN CATCH
Expand All @@ -26,12 +60,14 @@ BEGIN
IF (@Result >= 0)
BEGIN
COMMIT TRANSACTION
PRINT 'Commited Transaction at ' + GETDATE()
--PRINT 'Commited Transaction at ' + GETDATE()
PRINT 'Commited Transaction at ' + convert(varchar, GETDATE(), 121)
END
ELSE
BEGIN
ROLLBACK TRANSACTION
PRINT 'Rolled back Transaction at ' + GETDATE() + 'because of error: ' + @_errormessage
--PRINT 'Rolled back Transaction at ' + GETDATE() + 'because of error: ' + @_errormessage
PRINT 'Rolled back Transaction at ' + convert(varchar, GETDATE(), 121) + 'because of error: ' + @_errormessage
END
END

Expand Down
3 changes: 3 additions & 0 deletions TestUI/angular.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"cli": {
"analytics": false
},
"version": 1,
"newProjectRoot": "projects",
"projects": {
Expand Down
9 changes: 7 additions & 2 deletions TestUI/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@
<div class="col-6 offset-3" *ngFor="let weather of weatherData">
<div class="card">
<div class="card-body">
<h5 class="card-title">{{weather.date}}</h5>
<h5 class="card-title">{{weather.date | date: 'dd/MM/yyyy':'':'it'}}</h5>
<h6 class="card-subtitle mb-2 text-muted">{{weather.temperatureF}} &#176;F </h6>
<h6 class="card-subtitle mb-2 text-muted">{{weather.temperatureC}} &#176;C</h6>
<p class="card-text">{{weather.summary}}</p>
<p class="card-text"[ngClass]="{'weather-desc-cyan': weather.summary == 'Freezing' || weather.summary == 'Bracing' ||weather.summary == 'Chilly',
'weather-desc-green': weather.summary == 'Mild' || weather.summary == 'Balmy' || weather.summary == 'Cool',
'weather-desc-orange': weather.summary == 'Warm' || weather.summary == 'Hot',
'weather-desc-red': weather.summary == 'Sweltering' || weather.summary == 'Scorching' }">
{{weather.summary}}
</p>
</div>
</div>
</div>
Expand Down
17 changes: 17 additions & 0 deletions TestUI/src/app/app.component.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
.card {
top: 1rem;
}

.weather-desc-cyan {
color: cyan;
}

.weather-desc-green {
color: green;
}

.weather-desc-orange {
color: orange;
}

.weather-desc-red {
color: red;
}

7 changes: 5 additions & 2 deletions TestUI/src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { HttpClientModule } from '@angular/common/http';
import { AppComponent } from './app.component';

describe('AppComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
RouterTestingModule
RouterTestingModule,
HttpClientModule
],
declarations: [
AppComponent
Expand All @@ -25,11 +27,12 @@ describe('AppComponent', () => {
const app = fixture.componentInstance;
expect(app.title).toEqual('TestUI');
});

/*
it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('.content span')?.textContent).toContain('TestUI app is running!');
});
*/
});
2 changes: 2 additions & 0 deletions TestUI/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {Client, WeatherForecast} from "./weatherapp.swagger";
})
export class AppComponent {
weatherData: WeatherForecast[] = [];
public title: string = "TestUI";

constructor(
private client: Client
Expand Down Expand Up @@ -43,4 +44,5 @@ export class AppComponent {
handleError(error: string) {
alert(error);
}

}
7 changes: 4 additions & 3 deletions TestUI/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import {API_BASE_URL, Client} from "./weatherapp.swagger";
import {HttpClient, HttpClientModule} from "@angular/common/http";
import {environment} from "../environments/environment";
import { API_BASE_URL, Client } from "./weatherapp.swagger";
import { HttpClient, HttpClientModule } from "@angular/common/http";
import { environment } from "../environments/environment";

@NgModule({
declarations: [
Expand All @@ -18,6 +18,7 @@ import {environment} from "../environments/environment";
providers: [
Client,
HttpClient,
HttpClientModule,
{provide: API_BASE_URL, useValue: environment.url},
],
bootstrap: [AppComponent]
Expand Down
3 changes: 2 additions & 1 deletion TestUI/src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export const environment = {
production: true
production: true,
url:'https://localhost:5001'
};