public void GetDeviceId_ComponentsIsEmpty_ReturnsEmptyString()
        {
            var formatter = new StringDeviceIdFormatter(new HashDeviceIdComponentEncoder(() => MD5.Create(), new HexByteArrayEncoder()));

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

            deviceId.Should().Be(String.Empty);
        }
        public void GetDeviceId_ComponentsIsNull_ThrowsArgumentNullException()
        {
            var formatter = new StringDeviceIdFormatter(new HashDeviceIdComponentEncoder(() => MD5.Create(), new HexByteArrayEncoder()));

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

            act.ShouldThrow <ArgumentNullException>().WithMessage("Value cannot be null.\r\nParameter name: components");
        }
        public void GetDeviceId_ComponentReturnsNull_ReturnsDeviceId()
        {
            var formatter = new StringDeviceIdFormatter(new HashDeviceIdComponentEncoder(() => 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 StringDeviceIdFormatter(new HashDeviceIdComponentEncoder(() => MD5.Create(), new HexByteArrayEncoder()));

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

            deviceId.Should().Be("e1b849f9631ffc1829b2e31402373e3c.c454552d52d55d3ef56408742887362b");
        }