public async Task WriteAsync_null_value() { var characteristic = new CharacteristicMock(); await Assert.ThrowsAsync <ArgumentNullException>(async() => { await characteristic.WriteAsync(null); }); }
public async Task WriteAsync_not_writable() { var characteristic = new CharacteristicMock(); await Assert.ThrowsAsync <InvalidOperationException>(async() => { await characteristic.WriteAsync(new byte[0]); }); }
public void WriteType_set_throws_InvalidOperationException(CharacteristicWriteType writeType, CharacteristicPropertyType currentProperties) { CharacteristicMock characteristic = new CharacteristicMock { MockPropterties = currentProperties }; Assert.Throws <InvalidOperationException>(() => { characteristic.WriteType = writeType; }); }
public void WriteType_set(CharacteristicWriteType writeType, CharacteristicPropertyType currentProperties) { var characteristic = new CharacteristicMock { MockPropterties = currentProperties, WriteType = writeType }; Assert.Equal(writeType, characteristic.WriteType); }
public async Task Write_WriteType(CharacteristicWriteType expectedWriteType, CharacteristicWriteType currentWriteType, CharacteristicPropertyType currentProperties) { var characteristic = new CharacteristicMock { MockPropterties = currentProperties, WriteType = currentWriteType }; await characteristic.WriteAsync(new byte[0]); var writtenType = characteristic.WriteHistory.First().WriteType; Assert.Equal(expectedWriteType, writtenType); }
public void Init() { dataChar = new CharacteristicMock(); dataChar.ID = new Guid(0xaa01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); switchChar = new CharacteristicMock(); switchChar.ID = new Guid(0xaa02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); periodChar = new CharacteristicMock(); periodChar.ID = new Guid(0xaa03, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); service = new ServiceMock(); service.Characteristics = new List<ICharacteristic>() { dataChar, switchChar, periodChar }; }
public void WriteType_initial_value() { var characteristic = new CharacteristicMock(); Assert.Equal(CharacteristicWriteType.Default, characteristic.WriteType); }