public void Test_CreateTag_Vehicle_id_uid_Pass() { var tag = TagFactory.CreateTag(id: _token_id, uid: _uid); //verify the correct implementation was created Assert.Equal(tag.GetType().Name, _vehicleTagImpl); Assert.Equal(_uid, tag.UID); Assert.Equal(_token_id, tag.ID); }
public void Test_CreateTag_validate_UID_Not_Valid_Length_Fail() { const string nibble = "A"; // too short Assert.Throws <ArgumentException>(() => TagFactory.CreateTag(id: _char_id, uid: nibble)); // too long Assert.Throws <ArgumentException>(() => TagFactory.CreateTag(id: _char_id, uid: _uid + nibble)); }
public void Test_CreateTag_Character_id_uid_Pass() { var tag = TagFactory.CreateTag(id: _char_id, uid: _uid); //verify the correct implementation was created Assert.Equal(tag.GetType().Name, _charTagImpl); Assert.Equal(_uid, tag.UID); Assert.Equal(_char_id, tag.ID); }
public void CreateTag_with_value_throws_exception_for_invalid_type() { // arrange TagType type; type = (TagType)(-1); // act TagFactory.CreateTag(string.Empty, type, 13); }
public void CreateTag_throws_exception_for_invalid_type() { // arrange TagType type; type = (TagType)(-1); // act TagFactory.CreateTag(type); }
private ITag WaitRead(ArduinoDriver arduino) { var output = WaitForNtagHere(arduino); if (output == ArduinoCommands.NTAG_FOUND) { return(NtagRead(arduino)); } return((ITag)TagFactory.CreateTag()); }
public void Test_Decrypt_Token_id_Pass() { var tag = TagFactory.CreateTag(id: _token_id, uid: _uid); tag.Decrypt(); Assert.Equal(_uid, tag.UID); Assert.Equal(_token_id, tag.ID); Assert.Equal(_pwd, tag.Pages[DataRegister.Page43]); }
public void ShouldCreateTag() { string title = "Hello"; string expectedId = "hello"; var tag = _factory.CreateTag(title); Assert.Equal(expectedId, tag.Id); Assert.Equal(title, tag.Title); }
public void CreateTag_with_list_type_for_non_list_throws_exception() { // arrange const TagType type = TagType.Byte; const TagType listType = TagType.ByteArray; // act var e = Assert.Throws <ArgumentException>(() => TagFactory.CreateTag(string.Empty, type, listType)); Assert.Equal($"Only lists can have a list type.{Environment.NewLine}Parameter name: listType", e.Message); }
public void CreateTag_with_value_throws_exception_for_invalid_type() { // arrange const TagType type = (TagType)(-1); // act var e = Assert.Throws <ArgumentException>(() => TagFactory.CreateTag(string.Empty, type, 13)); Assert.Equal($"Unrecognized or unsupported tag type.{Environment.NewLine}Parameter name: tagType", e.Message); }
public void CreateTag_with_list_type_for_non_list_throws_exception() { // arrange TagType type; TagType listType; type = TagType.Byte; listType = TagType.ByteArray; // act TagFactory.CreateTag(string.Empty, type, listType); }
public void CreateTag_creates_list() { // arrange const TagType type = TagType.List; const TagType listType = TagType.Byte; // act var actual = TagFactory.CreateTag(type, listType); // assert Assert.NotNull(actual); Assert.Equal(listType, actual.ListType); }
public void Test_CreateTag_Token_data_Pass() { var tag = TagFactory.CreateTag(data: _uid + _vehicle_page35 + _vehicle_page36 + _vehicle_page37 + _vehicle_page38); //verify the correct implementation was created Assert.Equal(tag.GetType().Name, _vehicleTagImpl); Assert.Equal(_uid, tag.UID); Assert.Equal(_token_id, tag.ID); Assert.Equal(_vehicle_page35, tag.Pages[DataRegister.Page35]); Assert.Equal(_vehicle_page36, tag.Pages[DataRegister.Page36]); Assert.Equal(_vehicle_page37, tag.Pages[DataRegister.Page37]); Assert.Equal(_vehicle_page38, tag.Pages[DataRegister.Page38]); }
public void Create_with_value_sets_int_value() { // arrange Tag actual; int expected; expected = 1073741823; // act actual = TagFactory.CreateTag(expected); // assert Assert.Equal(expected, actual.GetValue()); }
public void Create_with_value_sets_string_value() { // arrange Tag actual; string expected; expected = "HELLO WORLD THIS IS A TEST STRING ÅÄÖ!"; // act actual = TagFactory.CreateTag(expected); // assert Assert.Equal(expected, actual.GetValue()); }
public void Create_with_value_sets_double_value() { // arrange Tag actual; double expected; expected = 8.98846567431158E+307; // act actual = TagFactory.CreateTag(expected); // assert Assert.Equal(expected, actual.GetValue()); }
public void Create_with_value_sets_float_value() { // arrange Tag actual; float expected; expected = 1.701412E+38F; // act actual = TagFactory.CreateTag(expected); // assert Assert.Equal(expected, actual.GetValue()); }
public void Create_with_value_sets_short_value() { // arrange Tag actual; short expected; expected = (short)(short.MaxValue >> 1); // act actual = TagFactory.CreateTag(expected); // assert Assert.Equal(expected, actual.GetValue()); }
public void Create_with_value_sets_byte_value() { // arrange Tag actual; byte expected; expected = (byte)(byte.MaxValue >> 1); // act actual = TagFactory.CreateTag(expected); // assert Assert.Equal(expected, actual.GetValue()); }
public void Test_Decrypt_Token_data_Pass() { var tag = TagFactory.CreateTag(data: _uid + _vehicle_page35 + _vehicle_page36 + _vehicle_page37 + _vehicle_page38); tag.Decrypt(); Assert.Equal(_uid, tag.UID); Assert.Equal(_token_id, tag.ID); Assert.Equal(_vehicle_page35, tag.Pages[DataRegister.Page35]); Assert.Equal(_vehicle_page36, tag.Pages[DataRegister.Page36]); Assert.Equal(_vehicle_page37, tag.Pages[DataRegister.Page37]); Assert.Equal(_vehicle_page38, tag.Pages[DataRegister.Page38]); Assert.Equal(_pwd, tag.Pages[DataRegister.Page43]); }
public void Create_with_value_sets_long_value() { // arrange Tag actual; long expected; expected = 4611686018427387903; // act actual = TagFactory.CreateTag(expected); // assert Assert.Equal(expected, actual.GetValue()); }
public void Test_Encrypt_Character_Pass() { var tag = TagFactory.CreateTag(id: _char_id, uid: _uid); tag.Encrypt(); Assert.Equal(_uid, tag.UID); Assert.Equal(_char_id, tag.ID); Assert.Equal(_char_page35, tag.Pages[DataRegister.Page35]); Assert.Equal(_char_page36, tag.Pages[DataRegister.Page36]); Assert.Equal(_char_page37, tag.Pages[DataRegister.Page37]); Assert.Equal(_char_page38, tag.Pages[DataRegister.Page38]); Assert.Equal(_pwd, tag.Pages[DataRegister.Page43]); }
public void Create_with_value_sets_bytearray_value() { // arrange Tag actual; byte[] expected; expected = new byte[] { 2, 4, 8, 16, 32, 64, 128 }; // act actual = TagFactory.CreateTag(expected); // assert Assert.Equal(expected, actual.GetValue()); }
public void Create_with_type_creates_bytearray() { // arrange Tag actual; TagType type; type = TagType.ByteArray; // act actual = TagFactory.CreateTag(type); // assert Assert.NotNull(actual); Assert.IsType <TagByteArray>(actual); }
public void Test_CreateTag_Character_data_Pass() { var tag = TagFactory.CreateTag(data: _uid + _char_page35 + _char_page36 + _char_page37 + _char_page38); //verify the correct implementation was created var test = tag.GetType(); Assert.Equal(tag.GetType().Name, _charTagImpl); Assert.Equal(_uid, tag.UID); Assert.Equal(_char_id, tag.ID); Assert.Equal(_char_page35, tag.Pages[DataRegister.Page35]); Assert.Equal(_char_page36, tag.Pages[DataRegister.Page36]); Assert.Equal(_char_page37, tag.Pages[DataRegister.Page37]); Assert.Equal(_char_page38, tag.Pages[DataRegister.Page38]); }
public void Create_with_value_creates_string_type() { // arrange Tag actual; string expected; expected = "HELLO WORLD THIS IS A TEST STRING ÅÄÖ!"; // act actual = TagFactory.CreateTag(expected); // assert Assert.NotNull(actual); Assert.IsType <TagString>(actual); }
public void Create_with_value_creates_byte_type() { // arrange Tag actual; byte expected; expected = (byte)(byte.MaxValue >> 1); // act actual = TagFactory.CreateTag(expected); // assert Assert.NotNull(actual); Assert.IsType <TagByte>(actual); }
public void Create_with_type_creates_list() { // arrange Tag actual; TagType type; type = TagType.List; // act actual = TagFactory.CreateTag(type); // assert Assert.NotNull(actual); Assert.IsType <TagList>(actual); }
private ITag NtagRead(ArduinoDriver arduino) { var result = string.Empty; result = arduino.SendCommand(ArduinoCommands.NTAG_FULL); string[] SplitResult = result.Split('/', ' '); if (SplitResult.Length > 1) { Console.WriteLine(result); return(WaitRead(arduino)); } return(TagFactory.CreateTag(result)); }
public void Create_with_type_creates_string() { // arrange Tag actual; TagType type; type = TagType.String; // act actual = TagFactory.CreateTag(type); // assert Assert.NotNull(actual); Assert.IsType <TagString>(actual); }