Skip to content

Commit c84ca20

Browse files
committed
Synced the latest code from the TFS: changeset 2305 build 3508
1 parent 96f030d commit c84ca20

38 files changed

Lines changed: 184 additions & 77 deletions

Open Judge System/OJS.Common/Extensions/StringExtensions.cs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -138,22 +138,6 @@ public static SecureString ToSecureString(this string sourceString)
138138
return secureString;
139139
}
140140

141-
// TODO: Remove and replace with ToUrl
142-
public static string ToUrlSafeString(this string input)
143-
{
144-
input = input.Replace("+", "Plus");
145-
input = input.Replace("#", "Sharp");
146-
return input;
147-
}
148-
149-
// TODO: Remove and replace with ToUrl
150-
public static string FromUrlSafeString(this string input)
151-
{
152-
input = input.Replace("Plus", "+");
153-
input = input.Replace("Sharp", "#");
154-
return input;
155-
}
156-
157141
// TODO: Test
158142
public static string ToValidFileName(this string input)
159143
{

Open Judge System/Tests/OJS.Web.Tests/Controllers/Contests/CompeteControllerTests/ProblemActionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
using Microsoft.VisualStudio.TestTools.UnitTesting;
1111

1212
using OJS.Data.Models;
13-
using OJS.Web.Areas.Contests.ViewModels;
13+
using OJS.Web.Areas.Contests.ViewModels.Contests;
1414

1515
[TestClass]
1616
public class ProblemActionTests : CompeteControllerBaseTestsClass

Open Judge System/Tests/OJS.Web.Tests/Controllers/Contests/CompeteControllerTests/RegisterActionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
using OJS.Common;
1212
using OJS.Data.Models;
1313
using OJS.Web.Areas.Contests.Models;
14-
using OJS.Web.Areas.Contests.ViewModels;
14+
using OJS.Web.Areas.Contests.ViewModels.Contests;
1515

1616
[TestClass]
1717
public class RegisterActionTests : CompeteControllerBaseTestsClass
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
namespace OJS.Web.Tests.Controllers.Contests.CompeteControllerTests
2+
{
3+
using System.Net;
4+
using System.Web;
5+
using System.Collections.Generic;
6+
7+
using Microsoft.VisualStudio.TestTools.UnitTesting;
8+
9+
using OJS.Data.Models;
10+
using OJS.Web.Areas.Contests.Controllers;
11+
12+
[TestClass]
13+
public class ValidateSubmissionTypeTests
14+
{
15+
[TestMethod]
16+
public void ValidateSubmissionTypeWhenSubmissionTypeIsNotFoundThrowException()
17+
{
18+
var contest = new Contest
19+
{
20+
SubmissionTypes = new List<SubmissionType>
21+
{
22+
new SubmissionType { Id = 1 },
23+
}
24+
};
25+
26+
try
27+
{
28+
CompeteController.ValidateSubmissionType(0, contest);
29+
Assert.Fail("Expected an exception when submission type is null");
30+
}
31+
catch (HttpException ex)
32+
{
33+
Assert.AreEqual((int)HttpStatusCode.BadRequest, ex.GetHttpCode());
34+
}
35+
}
36+
37+
[TestMethod]
38+
public void ValidateSubmissionTypeWhenSubmissionTypeIsFoundShouldNotThrowException()
39+
{
40+
var contest = new Contest
41+
{
42+
SubmissionTypes = new List<SubmissionType>
43+
{
44+
new SubmissionType { Id = 1 },
45+
}
46+
};
47+
48+
CompeteController.ValidateSubmissionType(1, contest);
49+
}
50+
}
51+
}

Open Judge System/Tests/OJS.Web.Tests/Controllers/Contests/ContestsControllerTests/DetailsActionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
using OJS.Data.Models;
1111
using OJS.Web.Areas.Contests.Controllers;
12-
using OJS.Web.Areas.Contests.ViewModels;
12+
using OJS.Web.Areas.Contests.ViewModels.Contests;
1313

1414
[TestClass]
1515
public class DetailsActionTests : BaseWebTests, IDisposable

Open Judge System/Tests/OJS.Web.Tests/OJS.Web.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@
150150
<Compile Include="Controllers\Contests\CompeteControllerTests\DownloadResourceActionTests.cs" />
151151
<Compile Include="Controllers\Contests\CompeteControllerTests\SubmitActionTests.cs" />
152152
<Compile Include="Controllers\Contests\CompeteControllerTests\ValidateContestTests.cs" />
153+
<Compile Include="Controllers\Contests\CompeteControllerTests\ValidateSubmissionTypeTests.cs" />
153154
<Compile Include="Controllers\Contests\ContestsControllerTests\DetailsActionTests.cs" />
154155
<Compile Include="Controllers\HomeControllerTests.cs" />
155156
<Compile Include="Controllers\FeedbackControllerTests.cs" />

Open Judge System/Web/OJS.Web/App_GlobalResources/Areas/Contests/ContestsGeneral.Designer.cs

Lines changed: 10 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Open Judge System/Web/OJS.Web/App_GlobalResources/Areas/Contests/ContestsGeneral.bg.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@
153153
<data name="Submission_too_long" xml:space="preserve">
154154
<value>Изпратеният код е прекалено дълъг!</value>
155155
</data>
156+
<data name="Submission_type_not_found" xml:space="preserve">
157+
<value>Грешен тип за оценяване на решението!</value>
158+
</data>
156159
<data name="Submission_was_sent_too_soon" xml:space="preserve">
157160
<value>Решението е изпратено прекалено скоро!</value>
158161
</data>

Open Judge System/Web/OJS.Web/App_GlobalResources/Areas/Contests/ContestsGeneral.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@
153153
<data name="Submission_too_long" xml:space="preserve">
154154
<value>The submitted code is too long!</value>
155155
</data>
156+
<data name="Submission_type_not_found" xml:space="preserve">
157+
<value>Wrong submission type!</value>
158+
</data>
156159
<data name="Submission_was_sent_too_soon" xml:space="preserve">
157160
<value>Submission was sent too soon!</value>
158161
</data>

Open Judge System/Web/OJS.Web/Areas/Contests/ContestsAreaRegistration.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ public override void RegisterArea(AreaRegistrationContext context)
2525

2626
context.MapRoute(
2727
"Contests_by_submission_type",
28-
"Contests/BySubmissionType/{submissionType}",
29-
new { controller = "List", action = "BySubmissionType", submissionType = UrlParameter.Optional });
28+
"Contests/BySubmissionType/{id}/{submissionTypeName}",
29+
new { controller = "List", action = "BySubmissionType", id = UrlParameter.Optional, submissionTypeName = UrlParameter.Optional });
3030

3131
context.MapRoute(
3232
"Contests_by_category",

0 commit comments

Comments
 (0)