public void GetDeviceId_ComponentsIsEmpty_ReturnsEmptyXmlDocument() { var formatter = new XmlDeviceIdFormatter(new HashDeviceIdComponentEncoder(() => MD5.Create(), new HexByteArrayEncoder())); var deviceId = formatter.GetDeviceId(new IDeviceIdComponent[] { }); deviceId.Should().Be("<DeviceId />"); }
public void GetDeviceId_ComponentsIsNull_ThrowsArgumentNullException() { var formatter = new XmlDeviceIdFormatter(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 XmlDeviceIdFormatter(new HashDeviceIdComponentEncoder(() => MD5.Create(), new HexByteArrayEncoder())); var deviceId = formatter.GetDeviceId(new IDeviceIdComponent[] { new DeviceIdComponent("Test1", default(string)), }); deviceId.Should().Be("<DeviceId><Component Name=\"Test1\" Value=\"d41d8cd98f00b204e9800998ecf8427e\" /></DeviceId>"); }
public void GetDeviceId_ComponentsAreValid_ReturnsDeviceId() { var formatter = new XmlDeviceIdFormatter(new HashDeviceIdComponentEncoder(() => MD5.Create(), new HexByteArrayEncoder())); var deviceId = formatter.GetDeviceId(new IDeviceIdComponent[] { new DeviceIdComponent("Test1", "Test1"), new DeviceIdComponent("Test2", "Test2"), }); deviceId.Should().Be("<DeviceId><Component Name=\"Test1\" Value=\"e1b849f9631ffc1829b2e31402373e3c\" /><Component Name=\"Test2\" Value=\"c454552d52d55d3ef56408742887362b\" /></DeviceId>"); }