Beispiel #1
0
        public void ConstructorTest()
        {
            // Arrange
            var mockDeviceCountryIdentifier = new Mock <IDeviceCountryIdentifier>(MockBehavior.Default);

            // Act
            var gdprInfoService = new GdprInfoService(mockDeviceCountryIdentifier.Object);

            // Assert
            Assert.IsNotNull(gdprInfoService);
        }
Beispiel #2
0
        public void CountryNumber_Always_ReturnsExpectedResult(string countryCode, string?expectedResult)
        {
            // Arrange
            var mockDeviceCountryIdentifier = new Mock <IDeviceCountryIdentifier>(MockBehavior.Strict);

            _ = mockDeviceCountryIdentifier.Setup(mock => mock.TryGetDeviceCountryCode()).Returns(countryCode);

            var gdprInfoService = new GdprInfoService(mockDeviceCountryIdentifier.Object);

            // Act
            var result = gdprInfoService.CountryNumber;

            // Assert
            Assert.That(result, Is.EqualTo(expectedResult));

            mockDeviceCountryIdentifier.VerifyAll();
        }
Beispiel #3
0
        public void IsDeviceInEeaOrUnknow_Always_ShouldReturnExpectedResult(string countryCode, bool expectedResult)
        {
            // Arrange
            var mockDeviceCountryIdentifier = new Mock <IDeviceCountryIdentifier>(MockBehavior.Strict);

            _ = mockDeviceCountryIdentifier.Setup(mock => mock.TryGetDeviceCountryCode()).Returns(countryCode);

            var gdprInfoService = new GdprInfoService(mockDeviceCountryIdentifier.Object);

            // Act
            var result = gdprInfoService.IsDeviceInEeaOrUnknow;

            // Assert
            Assert.That(result, Is.EqualTo(expectedResult));

            mockDeviceCountryIdentifier.VerifyAll();
        }