public void GetDeviceId_ComponentsIsNull_ThrowsArgumentNullException()
        {
            var formatter = new HashDeviceIdFormatter(() => MD5.Create(), new HexByteArrayEncoder());

            Action act = () => formatter.GetDeviceId(null);

            act.ShouldThrow <ArgumentNullException>().WithMessage("Value cannot be null.\r\nParameter name: components");
        }
        public void GetDeviceId_ComponentsIsEmpty_ReturnsDeviceId()
        {
            var formatter = new HashDeviceIdFormatter(() => MD5.Create(), new HexByteArrayEncoder());

            var deviceId = formatter.GetDeviceId(new IDeviceIdComponent[] { });

            deviceId.Should().Be("d41d8cd98f00b204e9800998ecf8427e");
        }
示例#3
0
        public void GetDeviceId_ComponentReturnsNull_ReturnsDeviceId()
        {
            var formatter = new HashDeviceIdFormatter(() => MD5.Create(), new HexByteArrayEncoder());

            var deviceId = formatter.GetDeviceId(new IDeviceIdComponent[]
            {
                new DeviceIdComponent("Test1", default(string)),
            });

            deviceId.Should().Be("d41d8cd98f00b204e9800998ecf8427e");
        }
        public void GetDeviceId_ComponentsAreValid_ReturnsDeviceId()
        {
            var formatter = new HashDeviceIdFormatter(() => MD5.Create(), new HexByteArrayEncoder());

            var deviceId = formatter.GetDeviceId(new IDeviceIdComponent[]
            {
                new DeviceIdComponent("Test1", "Test1"),
                new DeviceIdComponent("Test2", "Test2"),
            });

            deviceId.Should().Be("b02f4481c190173f05192bc08a1b14bc");
        }