-
Notifications
You must be signed in to change notification settings - Fork 0
6 homework #8
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
Open
Niksen111
wants to merge
4
commits into
main
Choose a base branch
from
6Homework
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
6 homework #8
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| **/.dockerignore | ||
| **/.env | ||
| **/.git | ||
| **/.gitignore | ||
| **/.project | ||
| **/.settings | ||
| **/.toolstarget | ||
| **/.vs | ||
| **/.vscode | ||
| **/.idea | ||
| **/*.*proj.user | ||
| **/*.dbmdl | ||
| **/*.jfm | ||
| **/azds.yaml | ||
| **/bin | ||
| **/charts | ||
| **/docker-compose* | ||
| **/Dockerfile* | ||
| **/node_modules | ||
| **/npm-debug.log | ||
| **/obj | ||
| **/secrets.dev.yaml | ||
| **/values.dev.yaml | ||
| LICENSE | ||
| README.md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| | ||
| Microsoft Visual Studio Solution File, Format Version 12.00 | ||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyNUnitWeb", "MyNUnitWeb\MyNUnitWeb.csproj", "{3FEAAE92-D751-4E3D-9981-F689E9356C25}" | ||
| EndProject | ||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyNUnit", "..\..\5Homework23.11.22\MyNUnit\MyNUnit\MyNUnit.csproj", "{E2F7FBFB-7BCE-4825-B0AA-DF4651B9C9C7}" | ||
| EndProject | ||
| Global | ||
| GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
| Debug|Any CPU = Debug|Any CPU | ||
| Release|Any CPU = Release|Any CPU | ||
| EndGlobalSection | ||
| GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
| {3FEAAE92-D751-4E3D-9981-F689E9356C25}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {3FEAAE92-D751-4E3D-9981-F689E9356C25}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {3FEAAE92-D751-4E3D-9981-F689E9356C25}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {3FEAAE92-D751-4E3D-9981-F689E9356C25}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| {E2F7FBFB-7BCE-4825-B0AA-DF4651B9C9C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
| {E2F7FBFB-7BCE-4825-B0AA-DF4651B9C9C7}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
| {E2F7FBFB-7BCE-4825-B0AA-DF4651B9C9C7}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
| {E2F7FBFB-7BCE-4825-B0AA-DF4651B9C9C7}.Release|Any CPU.Build.0 = Release|Any CPU | ||
| EndGlobalSection | ||
| EndGlobal |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| namespace MyNUnitWeb.Data; | ||
|
|
||
| using System.ComponentModel.DataAnnotations.Schema; | ||
|
|
||
| public class Assembly | ||
| { | ||
| [Column("id_assembly")] | ||
| public int AssemblyId { get; set; } | ||
|
|
||
| [Column("name")] | ||
| public string Name { get; set; } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nullability-анализ недоволен происходящим, тут и ниже. Если эти данные могут приходить извне, возможно, стоило поля явно nullable сделать. |
||
|
|
||
| [Column("test_count")] | ||
| public int TestsCount { get; set; } | ||
|
|
||
| [Column("passed")] | ||
| public int Passed { get; set; } | ||
|
|
||
| [Column("failed")] | ||
| public int Failed { get; set; } | ||
|
|
||
| [Column("ignored")] | ||
| public int Ignored { get; set; } | ||
|
|
||
| [Column("datetime")] | ||
| public string? Datetime { get; set; } | ||
|
|
||
| public virtual ICollection<Test> Tests { get; set; } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| namespace MyNUnitWeb.Data; | ||
|
|
||
| using System.ComponentModel.DataAnnotations.Schema; | ||
|
|
||
| public class Test | ||
| { | ||
| [Column("id_test")] | ||
| public int TestId { get; set; } | ||
|
|
||
| [Column("id_assembly")] | ||
| public int AssemblyId { get; set; } | ||
|
|
||
| [Column("name")] | ||
| public string Name { get; set; } | ||
|
|
||
| [Column("is_passed")] | ||
| public bool IsPassed { get; set; } | ||
|
|
||
| [Column("running_time")] | ||
| public int RunningTime { get; set; } | ||
|
|
||
| [Column("reason_for_ignoring")] | ||
| public string? ReasonForIgnoring { get; set; } | ||
|
|
||
| [Column("comment")] | ||
| public string? Comment { get; set; } | ||
|
|
||
| public virtual Assembly Assembly { get; set; } | ||
| } |
15 changes: 15 additions & 0 deletions
15
6Homework7.12.22/MyNUnitWeb/MyNUnitWeb/Data/TestingDataDbContext.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| namespace MyNUnitWeb.Data; | ||
|
|
||
| using Microsoft.EntityFrameworkCore; | ||
|
|
||
| public class TestingDataDbContext : DbContext | ||
| { | ||
| public TestingDataDbContext(DbContextOptions<TestingDataDbContext> options) | ||
| : base(options) | ||
| { | ||
| } | ||
|
|
||
| public DbSet<Assembly> Assemblies { get; set; } | ||
|
|
||
| public DbSet<Test> Tests { get; set; } | ||
| } |
35 changes: 35 additions & 0 deletions
35
6Homework7.12.22/MyNUnitWeb/MyNUnitWeb/Data/database-scripts.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| --/* | ||
| CREATE TABLE assembly ( | ||
| name TEXT NOT NULL, | ||
| tests_count INT NOT NULL, | ||
| passed INT NOT NULL, | ||
| failed INT NOT NULL, | ||
| ignored INT NOT NULL, | ||
| datetime TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP | ||
| ); | ||
| --*/ | ||
|
|
||
| --/* | ||
| CREATE TABLE test ( | ||
| id_assembly INT, | ||
| name TEXT NOT NULL, | ||
| is_passed INT NOT NULL, | ||
| running_time INT NOT NULL, | ||
| reason_for_ignoring TEXT, | ||
| comment TEXT, | ||
| FOREIGN KEY(id_assembly) REFERENCES assembly(ROWID) | ||
| ); | ||
| --*/ | ||
|
|
||
| INSERT INTO assembly (name, tests_count, passed, failed, ignored) | ||
| values ('assembly_name1', 3, 1, 1, 1); | ||
|
|
||
| INSERT INTO test (id_assembly, name, is_passed, running_time, reason_for_ignoring, comment) | ||
| values (1, 'test_name3', FALSE, 0, 'Ignored.', ''); | ||
|
|
||
| SELECT * FROM assembly; | ||
| SELECT * FROM assembly WHERE ROWID = 1; | ||
| SELECT * FROM test; | ||
|
|
||
| DROP TABLE assembly; | ||
| DROP TABLE test; |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base | ||
| WORKDIR /app | ||
| EXPOSE 80 | ||
| EXPOSE 443 | ||
|
|
||
| FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build | ||
| WORKDIR /src | ||
| COPY ["MyNUnitWeb/MyNUnitWeb.csproj", "MyNUnitWeb/"] | ||
| RUN dotnet restore "MyNUnitWeb/MyNUnitWeb.csproj" | ||
| COPY . . | ||
| WORKDIR "/src/MyNUnitWeb" | ||
| RUN dotnet build "MyNUnitWeb.csproj" -c Release -o /app/build | ||
|
|
||
| FROM build AS publish | ||
| RUN dotnet publish "MyNUnitWeb.csproj" -c Release -o /app/publish | ||
|
|
||
| FROM base AS final | ||
| WORKDIR /app | ||
| COPY --from=publish /app/publish . | ||
| ENTRYPOINT ["dotnet", "MyNUnitWeb.dll"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
|
||
| <PropertyGroup> | ||
| <TargetFramework>net7.0</TargetFramework> | ||
| <Nullable>enable</Nullable> | ||
| <ImplicitUsings>enable</ImplicitUsings> | ||
| <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <Content Include="..\.dockerignore"> | ||
| <Link>.dockerignore</Link> | ||
| </Content> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0-preview.1.23111.4" /> | ||
| <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="8.0.0-preview.1.23111.4" /> | ||
| <PackageReference Include="SQLite" Version="3.13.0" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\..\..\5Homework23.11.22\MyNUnit\MyNUnit\MyNUnit.csproj" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| @page | ||
| @model MyNUnitWeb.Pages.About | ||
|
|
||
| @{ | ||
| ViewData["Title"] = "About"; | ||
| } | ||
|
|
||
| <div> | ||
| <a href="https://github.com/Niksen111/spbuHomeworksSem3/tree/main/5Homework23.11.22/MyNUnit" class="link-primary">MyNUnit github</a> | ||
| </div> |
11 changes: 11 additions & 0 deletions
11
6Homework7.12.22/MyNUnitWeb/MyNUnitWeb/Pages/About.cshtml.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| using Microsoft.AspNetCore.Mvc.RazorPages; | ||
|
|
||
| namespace MyNUnitWeb.Pages; | ||
|
|
||
| public class About : PageModel | ||
| { | ||
| public void OnGet() | ||
| { | ||
|
|
||
| } | ||
| } |
29 changes: 29 additions & 0 deletions
29
6Homework7.12.22/MyNUnitWeb/MyNUnitWeb/Pages/Assembly.cshtml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| @page "{assmeblyId}" | ||
| @model MyNUnitWeb.Pages.Assembly | ||
|
|
||
| @{ | ||
| ViewData["Title"] = "Assembly"; | ||
| } | ||
|
|
||
| <table class="table table-striped table-bordered"> | ||
| <thead> | ||
| <tr> | ||
| <th>Test name</th> | ||
| <th>Is passed</th> | ||
| <th>Running time</th> | ||
| <th>Reason for ignoring</th> | ||
| <th>Comment</th> | ||
| </tr> | ||
| </thead> | ||
| <tbody> | ||
| @foreach (Data.Test t in Model.Tests) { | ||
| <tr> | ||
| <td>@t.Name</td> | ||
| <td>@(t.IsPassed ? "Yes" : "No")</td> | ||
| <td>@t.RunningTime</td> | ||
| <td>@t.ReasonForIgnoring</td> | ||
| <td>@t.Comment</td> | ||
| </tr> | ||
| } | ||
| </tbody> | ||
| </table> |
19 changes: 19 additions & 0 deletions
19
6Homework7.12.22/MyNUnitWeb/MyNUnitWeb/Pages/Assembly.cshtml.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| using Microsoft.AspNetCore.Mvc.RazorPages; | ||
| using MyNUnitWeb.Data; | ||
|
|
||
| namespace MyNUnitWeb.Pages; | ||
|
|
||
| public class Assembly : PageModel | ||
| { | ||
| private readonly TestingDataDbContext context; | ||
|
|
||
| public Assembly(TestingDataDbContext context) | ||
| => this.context = context; | ||
|
|
||
| public IList<Test> Tests { get; private set; } = new List<Test>(); | ||
|
|
||
| public void OnGet(int assemblyId) | ||
| { | ||
| Tests = context.Tests.Where(t => t.AssemblyId == assemblyId).Select(t => t).ToList(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| @page | ||
| @model ErrorModel | ||
| @{ | ||
| ViewData["Title"] = "Error"; | ||
| } | ||
|
|
||
| <h1 class="text-danger">Error.</h1> | ||
| <h2 class="text-danger">An error occurred while processing your request.</h2> | ||
|
|
||
| @if (Model.ShowRequestId) | ||
| { | ||
| <p> | ||
| <strong>Request ID:</strong> <code>@Model.RequestId</code> | ||
| </p> | ||
| } | ||
|
|
||
| <h3>Development Mode</h3> | ||
| <p> | ||
| Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred. | ||
| </p> | ||
| <p> | ||
| <strong>The Development environment shouldn't be enabled for deployed applications.</strong> | ||
| It can result in displaying sensitive information from exceptions to end users. | ||
| For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong> | ||
| and restarting the app. | ||
| </p> |
26 changes: 26 additions & 0 deletions
26
6Homework7.12.22/MyNUnitWeb/MyNUnitWeb/Pages/Error.cshtml.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| using System.Diagnostics; | ||
| using Microsoft.AspNetCore.Mvc; | ||
| using Microsoft.AspNetCore.Mvc.RazorPages; | ||
|
|
||
| namespace MyNUnitWeb.Pages; | ||
|
|
||
| [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] | ||
| [IgnoreAntiforgeryToken] | ||
| public class ErrorModel : PageModel | ||
| { | ||
| public string? RequestId { get; set; } | ||
|
|
||
| public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); | ||
|
|
||
| private readonly ILogger<ErrorModel> _logger; | ||
|
|
||
| public ErrorModel(ILogger<ErrorModel> logger) | ||
| { | ||
| _logger = logger; | ||
| } | ||
|
|
||
| public void OnGet() | ||
| { | ||
| RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier; | ||
| } | ||
| } |
30 changes: 30 additions & 0 deletions
30
6Homework7.12.22/MyNUnitWeb/MyNUnitWeb/Pages/History.cshtml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| @page | ||
| @model MyNUnitWeb.Pages.History | ||
|
|
||
| @{ | ||
| ViewData["Title"] = "History"; | ||
| } | ||
|
|
||
| <table class="table table-striped table-bordered"> | ||
| <thead> | ||
| <tr> | ||
| <th>Assembly name</th> | ||
| <th>Tests count</th> | ||
| <th>Passed</th> | ||
| <th>Failed</th> | ||
| <th>Ignored</th> | ||
| <th>Date and Time</th> | ||
| </tr> | ||
| </thead> | ||
| <tbody> | ||
| @foreach (Data.Assembly t in Model.Assemblies) { | ||
| <tr> | ||
| <td>@t.Name</td> | ||
| <td>@t.Passed</td> | ||
| <td>@t.Failed</td> | ||
| <td>@t.Ignored</td> | ||
| <td>@t.Datetime</td> | ||
| </tr> | ||
| } | ||
| </tbody> | ||
| </table> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Комментариев глобально не хватает.