2017-07-05 17:21:52 +02:00
|
|
|
|
/*
|
2024-03-05 18:37:42 +01:00
|
|
|
|
* Copyright (c) 2024 ETH Zürich, IT Services
|
2017-07-05 17:21:52 +02:00
|
|
|
|
*
|
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
|
*/
|
|
|
|
|
|
2020-03-09 17:35:48 +01:00
|
|
|
|
using System.Globalization;
|
2017-07-05 17:21:52 +02:00
|
|
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
2017-07-06 18:18:39 +02:00
|
|
|
|
using Moq;
|
2019-08-30 09:55:26 +02:00
|
|
|
|
using SafeExamBrowser.I18n.Contracts;
|
|
|
|
|
using SafeExamBrowser.Logging.Contracts;
|
2017-07-05 17:21:52 +02:00
|
|
|
|
|
2018-08-31 10:06:27 +02:00
|
|
|
|
namespace SafeExamBrowser.I18n.UnitTests
|
2017-07-05 17:21:52 +02:00
|
|
|
|
{
|
|
|
|
|
[TestClass]
|
2017-07-06 10:56:03 +02:00
|
|
|
|
public class TextTests
|
2017-07-05 17:21:52 +02:00
|
|
|
|
{
|
2017-10-10 10:17:28 +02:00
|
|
|
|
private Mock<ILogger> loggerMock;
|
2020-03-09 17:35:48 +01:00
|
|
|
|
private Text sut;
|
2017-10-10 10:17:28 +02:00
|
|
|
|
|
|
|
|
|
[TestInitialize]
|
|
|
|
|
public void Initialize()
|
|
|
|
|
{
|
|
|
|
|
loggerMock = new Mock<ILogger>();
|
2020-03-09 17:35:48 +01:00
|
|
|
|
sut = new Text(loggerMock.Object);
|
2017-10-10 10:17:28 +02:00
|
|
|
|
}
|
|
|
|
|
|
2017-07-05 17:21:52 +02:00
|
|
|
|
[TestMethod]
|
|
|
|
|
public void MustNeverReturnNull()
|
2017-10-10 10:17:28 +02:00
|
|
|
|
{
|
|
|
|
|
var text = sut.Get((TextKey)(-1));
|
|
|
|
|
|
|
|
|
|
Assert.IsNotNull(text);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestMethod]
|
2020-03-09 17:35:48 +01:00
|
|
|
|
public void MustNotFailToInitializeWhenDataNotFound()
|
2017-10-10 10:17:28 +02:00
|
|
|
|
{
|
2020-03-09 17:35:48 +01:00
|
|
|
|
CultureInfo.CurrentUICulture = CultureInfo.InvariantCulture;
|
2017-10-10 10:17:28 +02:00
|
|
|
|
|
2020-03-09 17:35:48 +01:00
|
|
|
|
sut.Initialize();
|
2017-07-05 17:21:52 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|