Skip to content
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
27 changes: 27 additions & 0 deletions StudentApp.Tests/StudentApp.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit.Analyzers" Version="3.9.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="Selenium.Support" Version="4.28.0" />
<PackageReference Include="Selenium.WebDriver" Version="4.28.0" />
<PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="133.0.6943.12600" />
</ItemGroup>

<ItemGroup>
<Using Include="NUnit.Framework" />
</ItemGroup>

</Project>
64 changes: 64 additions & 0 deletions StudentApp.Tests/UnitTest1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Support.UI;
using System;
using System.Threading;

namespace StudentApp.Tests
{
public class RegisterTests
{
private ChromeDriver driver;
private WebDriverWait wait;

[SetUp]
public void Setup()
{
driver = new ChromeDriver();
driver.Manage().Window.Maximize();
wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
}

[Test]
public void RegisterNewStudent()
{
driver.Navigate().GoToUrl("https://localhost:7047/User/Register");

string email = $"juan.perez{DateTime.Now.Ticks}danivarelacor@gmail.com";
driver.FindElement(By.Id("r-name")).SendKeys("Juan Pérez");
driver.FindElement(By.Id("r-email")).SendKeys(email);
driver.FindElement(By.Id("r-password")).SendKeys("Password123!");
driver.FindElement(By.Id("confirm-password")).SendKeys("Password123!");


driver.FindElement(By.Id("form-submit")).Click();


Thread.Sleep(6000);

IWebElement validationMessage = wait.Until(d => d.FindElement(By.Id("validation")));
string messageText = validationMessage.Text;


string[] expectedMessages = {
"Su solicitud ha sido enviada correctamente. Revisa tu correo.",
"El correo electrónico ya ha sido registrado en el sistema.",
"No ha sido posible hacer la solicitud de registro. Intente de nuevo más tarde.",
"Ha ocurrido un error inesperado en el sistema. Intente de nuevo más tarde."
};

Assert.IsTrue(Array.Exists(expectedMessages, msg => messageText.Contains(msg)),
$"Mensaje recibido inesperado: {messageText}");
}

[TearDown]
public void Teardown()
{
if (driver != null)
{
driver.Dispose();
}
}
}
}
9 changes: 9 additions & 0 deletions StudentApp.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ VisualStudioVersion = 17.12.35527.113
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StudentApp", "StudentApp\StudentApp.csproj", "{8A67DCE4-01B5-4085-9295-7E8ED7AC6FF5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StudentApp.Tests", "StudentApp.Tests\StudentApp.Tests.csproj", "{909D1A0E-5B19-4E79-B542-A3EF3A45FB74}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -15,8 +17,15 @@ Global
{8A67DCE4-01B5-4085-9295-7E8ED7AC6FF5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8A67DCE4-01B5-4085-9295-7E8ED7AC6FF5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8A67DCE4-01B5-4085-9295-7E8ED7AC6FF5}.Release|Any CPU.Build.0 = Release|Any CPU
{909D1A0E-5B19-4E79-B542-A3EF3A45FB74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{909D1A0E-5B19-4E79-B542-A3EF3A45FB74}.Debug|Any CPU.Build.0 = Debug|Any CPU
{909D1A0E-5B19-4E79-B542-A3EF3A45FB74}.Release|Any CPU.ActiveCfg = Release|Any CPU
{909D1A0E-5B19-4E79-B542-A3EF3A45FB74}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6C4BE241-D11E-478B-9710-4A578CEC79DB}
EndGlobalSection
EndGlobal
1 change: 1 addition & 0 deletions StudentApp/Controllers/UserController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ public IActionResult Register([FromBody] User user)

}


[HttpGet]
public IActionResult GetByEmail([FromQuery] string email)
{
Expand Down
24 changes: 12 additions & 12 deletions StudentApp/Models/DAO/AppointmentDAO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,36 +26,36 @@ public int CreateAppointment(AppointmentDTO appointment)
{
try
{

using (SqlCommand command = new SqlCommand("CreateAppointment", connection, transaction))
{
command.CommandType = System.Data.CommandType.StoredProcedure;

command.Parameters.AddWithValue("@Id", Guid.NewGuid().ToString());
command.Parameters.AddWithValue("@Id", appointment.Id);
command.Parameters.AddWithValue("@Date", appointment.Date);
command.Parameters.AddWithValue("@Mode", appointment.Mode);
command.Parameters.AddWithValue("@Status", "pending");
command.Parameters.AddWithValue("@CourseId", appointment.Course.Id);
command.Parameters.AddWithValue("@StudentId", appointment.User.Id);
command.Parameters.AddWithValue("@CourseId", appointment.CourseId);
command.Parameters.AddWithValue("@StudentId", appointment.StudentId);

result = command.ExecuteNonQuery();
}


using (SqlCommand command = new SqlCommand("GetProfessorEmail", connection, transaction))
{
command.CommandType = System.Data.CommandType.StoredProcedure;

command.Parameters.AddWithValue("@Id", appointment.Id);
command.Parameters.AddWithValue("@Date", appointment.Date);
command.Parameters.AddWithValue("@Mode", appointment.Mode);
command.Parameters.AddWithValue("@Status", "pending");
command.Parameters.AddWithValue("@CourseId", appointment.CourseId);
command.Parameters.AddWithValue("@StudentId", appointment.StudentId);
command.Parameters.AddWithValue("@CourseId", appointment.CourseId);

var professorEmail = command.ExecuteScalar()?.ToString() ?? string.Empty;

SendEmail.AppointmentEmail(professorEmail);
// Enviar el correo
if (!string.IsNullOrEmpty(professorEmail))
{
SendEmail.AppointmentEmail(professorEmail);
}
}


transaction.Commit();
}
catch (SqlException)
Expand Down
12 changes: 6 additions & 6 deletions StudentApp/obj/Debug/net8.0/StudentApp.AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Este código fue generado por una herramienta.
// Versión de runtime:4.0.30319.42000
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si
// se vuelve a generar el código.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

Expand All @@ -14,10 +14,10 @@
[assembly: System.Reflection.AssemblyCompanyAttribute("StudentApp")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+2394903217b2b4df673cd52ce6c821433bcd75aa")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f71dbdf8d42338753407b79f06745f883a395b27")]
[assembly: System.Reflection.AssemblyProductAttribute("StudentApp")]
[assembly: System.Reflection.AssemblyTitleAttribute("StudentApp")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

// Generado por la clase WriteCodeFragment de MSBuild.
// Generated by the MSBuild WriteCodeFragment class.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
4b0c0ff21470ffc2cb8da46cd8bc936f1be9f2c5092d96d7f2a64d6c7808b60c
99a0f1b92cd2028894593fa9f48a491fb16a3706f6427e46f9e84b1f631e32ba
Original file line number Diff line number Diff line change
Expand Up @@ -9,75 +9,75 @@ build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = StudentApp
build_property.RootNamespace = StudentApp
build_property.ProjectDir = C:\Users\Esteban\Documents\UCR\Tercer año\III Semestre\Lenguajes para Aplicaciones Comerciales\Proyecto\StudentApp\StudentApp\
build_property.ProjectDir = C:\Users\daniv\source\repos\StudentApp\StudentApp\
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
build_property.RazorLangVersion = 8.0
build_property.SupportLocalizedComponentNames =
build_property.GenerateRazorMetadataSourceChecksumAttributes =
build_property.MSBuildProjectDirectory = C:\Users\Esteban\Documents\UCR\Tercer año\III Semestre\Lenguajes para Aplicaciones Comerciales\Proyecto\StudentApp\StudentApp
build_property.MSBuildProjectDirectory = C:\Users\daniv\source\repos\StudentApp\StudentApp
build_property._RazorSourceGeneratorDebug =

[C:/Users/Esteban/Documents/UCR/Tercer año/III Semestre/Lenguajes para Aplicaciones Comerciales/Proyecto/StudentApp/StudentApp/Views/Home/Index.cshtml]
[C:/Users/daniv/source/repos/StudentApp/StudentApp/Views/Home/Index.cshtml]
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcSG9tZVxJbmRleC5jc2h0bWw=
build_metadata.AdditionalFiles.CssScope =

[C:/Users/Esteban/Documents/UCR/Tercer año/III Semestre/Lenguajes para Aplicaciones Comerciales/Proyecto/StudentApp/StudentApp/Views/Home/Privacy.cshtml]
[C:/Users/daniv/source/repos/StudentApp/StudentApp/Views/Home/Privacy.cshtml]
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcSG9tZVxQcml2YWN5LmNzaHRtbA==
build_metadata.AdditionalFiles.CssScope =

[C:/Users/Esteban/Documents/UCR/Tercer año/III Semestre/Lenguajes para Aplicaciones Comerciales/Proyecto/StudentApp/StudentApp/Views/Shared/AddNews.cshtml]
[C:/Users/daniv/source/repos/StudentApp/StudentApp/Views/Shared/AddNews.cshtml]
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcU2hhcmVkXEFkZE5ld3MuY3NodG1s
build_metadata.AdditionalFiles.CssScope =

[C:/Users/Esteban/Documents/UCR/Tercer año/III Semestre/Lenguajes para Aplicaciones Comerciales/Proyecto/StudentApp/StudentApp/Views/Shared/Advisement.cshtml]
[C:/Users/daniv/source/repos/StudentApp/StudentApp/Views/Shared/Advisement.cshtml]
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcU2hhcmVkXEFkdmlzZW1lbnQuY3NodG1s
build_metadata.AdditionalFiles.CssScope =

[C:/Users/Esteban/Documents/UCR/Tercer año/III Semestre/Lenguajes para Aplicaciones Comerciales/Proyecto/StudentApp/StudentApp/Views/Shared/AdvisementDetails.cshtml]
[C:/Users/daniv/source/repos/StudentApp/StudentApp/Views/Shared/AdvisementDetails.cshtml]
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcU2hhcmVkXEFkdmlzZW1lbnREZXRhaWxzLmNzaHRtbA==
build_metadata.AdditionalFiles.CssScope =

[C:/Users/Esteban/Documents/UCR/Tercer año/III Semestre/Lenguajes para Aplicaciones Comerciales/Proyecto/StudentApp/StudentApp/Views/Shared/Appointment.cshtml]
[C:/Users/daniv/source/repos/StudentApp/StudentApp/Views/Shared/Appointment.cshtml]
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcU2hhcmVkXEFwcG9pbnRtZW50LmNzaHRtbA==
build_metadata.AdditionalFiles.CssScope =

[C:/Users/Esteban/Documents/UCR/Tercer año/III Semestre/Lenguajes para Aplicaciones Comerciales/Proyecto/StudentApp/StudentApp/Views/Shared/Error.cshtml]
[C:/Users/daniv/source/repos/StudentApp/StudentApp/Views/Shared/Error.cshtml]
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcU2hhcmVkXEVycm9yLmNzaHRtbA==
build_metadata.AdditionalFiles.CssScope =

[C:/Users/Esteban/Documents/UCR/Tercer año/III Semestre/Lenguajes para Aplicaciones Comerciales/Proyecto/StudentApp/StudentApp/Views/Shared/Login.cshtml]
[C:/Users/daniv/source/repos/StudentApp/StudentApp/Views/Shared/Login.cshtml]
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcU2hhcmVkXExvZ2luLmNzaHRtbA==
build_metadata.AdditionalFiles.CssScope =

[C:/Users/Esteban/Documents/UCR/Tercer año/III Semestre/Lenguajes para Aplicaciones Comerciales/Proyecto/StudentApp/StudentApp/Views/Shared/News.cshtml]
[C:/Users/daniv/source/repos/StudentApp/StudentApp/Views/Shared/News.cshtml]
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcU2hhcmVkXE5ld3MuY3NodG1s
build_metadata.AdditionalFiles.CssScope =

[C:/Users/Esteban/Documents/UCR/Tercer año/III Semestre/Lenguajes para Aplicaciones Comerciales/Proyecto/StudentApp/StudentApp/Views/Shared/NewsDetails.cshtml]
[C:/Users/daniv/source/repos/StudentApp/StudentApp/Views/Shared/NewsDetails.cshtml]
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcU2hhcmVkXE5ld3NEZXRhaWxzLmNzaHRtbA==
build_metadata.AdditionalFiles.CssScope =

[C:/Users/Esteban/Documents/UCR/Tercer año/III Semestre/Lenguajes para Aplicaciones Comerciales/Proyecto/StudentApp/StudentApp/Views/Shared/Profile.cshtml]
[C:/Users/daniv/source/repos/StudentApp/StudentApp/Views/Shared/Profile.cshtml]
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcU2hhcmVkXFByb2ZpbGUuY3NodG1s
build_metadata.AdditionalFiles.CssScope =

[C:/Users/Esteban/Documents/UCR/Tercer año/III Semestre/Lenguajes para Aplicaciones Comerciales/Proyecto/StudentApp/StudentApp/Views/Shared/Register.cshtml]
[C:/Users/daniv/source/repos/StudentApp/StudentApp/Views/Shared/Register.cshtml]
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcU2hhcmVkXFJlZ2lzdGVyLmNzaHRtbA==
build_metadata.AdditionalFiles.CssScope =

[C:/Users/Esteban/Documents/UCR/Tercer año/III Semestre/Lenguajes para Aplicaciones Comerciales/Proyecto/StudentApp/StudentApp/Views/Shared/_ValidationScriptsPartial.cshtml]
[C:/Users/daniv/source/repos/StudentApp/StudentApp/Views/Shared/_ValidationScriptsPartial.cshtml]
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcU2hhcmVkXF9WYWxpZGF0aW9uU2NyaXB0c1BhcnRpYWwuY3NodG1s
build_metadata.AdditionalFiles.CssScope =

[C:/Users/Esteban/Documents/UCR/Tercer año/III Semestre/Lenguajes para Aplicaciones Comerciales/Proyecto/StudentApp/StudentApp/Views/_ViewImports.cshtml]
[C:/Users/daniv/source/repos/StudentApp/StudentApp/Views/_ViewImports.cshtml]
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcX1ZpZXdJbXBvcnRzLmNzaHRtbA==
build_metadata.AdditionalFiles.CssScope =

[C:/Users/Esteban/Documents/UCR/Tercer año/III Semestre/Lenguajes para Aplicaciones Comerciales/Proyecto/StudentApp/StudentApp/Views/_ViewStart.cshtml]
[C:/Users/daniv/source/repos/StudentApp/StudentApp/Views/_ViewStart.cshtml]
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcX1ZpZXdTdGFydC5jc2h0bWw=
build_metadata.AdditionalFiles.CssScope =

[C:/Users/Esteban/Documents/UCR/Tercer año/III Semestre/Lenguajes para Aplicaciones Comerciales/Proyecto/StudentApp/StudentApp/Views/Shared/_Layout.cshtml]
[C:/Users/daniv/source/repos/StudentApp/StudentApp/Views/Shared/_Layout.cshtml]
build_metadata.AdditionalFiles.TargetPath = Vmlld3NcU2hhcmVkXF9MYXlvdXQuY3NodG1s
build_metadata.AdditionalFiles.CssScope = b-ak0w5rm0kc
Binary file modified StudentApp/obj/Debug/net8.0/StudentApp.assets.cache
Binary file not shown.
14 changes: 7 additions & 7 deletions StudentApp/obj/StudentApp.csproj.nuget.dgspec.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"format": 1,
"restore": {
"C:\\Users\\Esteban\\Documents\\UCR\\Tercer año\\III Semestre\\Lenguajes para Aplicaciones Comerciales\\Proyecto\\StudentApp\\StudentApp\\StudentApp.csproj": {}
"C:\\Users\\daniv\\source\\repos\\StudentApp\\StudentApp\\StudentApp.csproj": {}
},
"projects": {
"C:\\Users\\Esteban\\Documents\\UCR\\Tercer año\\III Semestre\\Lenguajes para Aplicaciones Comerciales\\Proyecto\\StudentApp\\StudentApp\\StudentApp.csproj": {
"C:\\Users\\daniv\\source\\repos\\StudentApp\\StudentApp\\StudentApp.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "C:\\Users\\Esteban\\Documents\\UCR\\Tercer año\\III Semestre\\Lenguajes para Aplicaciones Comerciales\\Proyecto\\StudentApp\\StudentApp\\StudentApp.csproj",
"projectUniqueName": "C:\\Users\\daniv\\source\\repos\\StudentApp\\StudentApp\\StudentApp.csproj",
"projectName": "StudentApp",
"projectPath": "C:\\Users\\Esteban\\Documents\\UCR\\Tercer año\\III Semestre\\Lenguajes para Aplicaciones Comerciales\\Proyecto\\StudentApp\\StudentApp\\StudentApp.csproj",
"packagesPath": "C:\\Users\\Esteban\\.nuget\\packages\\",
"outputPath": "C:\\Users\\Esteban\\Documents\\UCR\\Tercer año\\III Semestre\\Lenguajes para Aplicaciones Comerciales\\Proyecto\\StudentApp\\StudentApp\\obj\\",
"projectPath": "C:\\Users\\daniv\\source\\repos\\StudentApp\\StudentApp\\StudentApp.csproj",
"packagesPath": "C:\\Users\\daniv\\.nuget\\packages\\",
"outputPath": "C:\\Users\\daniv\\source\\repos\\StudentApp\\StudentApp\\obj\\",
"projectStyle": "PackageReference",
"configFilePaths": [
"C:\\Users\\Esteban\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Users\\daniv\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
Expand Down
4 changes: 2 additions & 2 deletions StudentApp/obj/StudentApp.csproj.nuget.g.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Esteban\.nuget\packages\</NuGetPackageFolders>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\daniv\.nuget\packages\</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.11.1</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="C:\Users\Esteban\.nuget\packages\" />
<SourceRoot Include="C:\Users\daniv\.nuget\packages\" />
</ItemGroup>
</Project>
Loading