public SetData ( [ formatId, [ value ) : void | ||
formatId | [ | |
value | [ | |
return | void |
public void Contains_ReturnsTrueIfFormatIsAvailable() { DataPackage dataPackage = new DataPackage(); dataPackage.SetData("Format A", "Some data"); dataPackage.SetData("Format B", "Some data"); SharePackageView sharePackage = new SharePackageView(dataPackage.GetView()); Assert.True(sharePackage.Contains("Format A")); }
public void AvailableFormats_ReturnsValuesFromDataPackageView() { DataPackage dataPackage = new DataPackage(); dataPackage.SetData("Format A", "Some data"); dataPackage.SetData("Format B", "Some data"); SharePackageView sharePackage = new SharePackageView(dataPackage.GetView()); Assert.Equal(2, sharePackage.AvailableFormats.Count); Assert.Contains("Format A", sharePackage.AvailableFormats.ToList()); Assert.Contains("Format B", sharePackage.AvailableFormats.ToList()); }
public void setString(string text) { RunOnDispatcher(() => { if (text == null) { DataTransfer.Clipboard.Clear(); } else { var package = new DataTransfer.DataPackage(); package.SetData(DataTransfer.StandardDataFormats.Text, text); DataTransfer.Clipboard.SetContent(package); } }); }
public void setString(string text) { RunOnDispatcher(() => { if (text == null) { _clipboard.Clear(); } else { var package = new DataTransfer.DataPackage(); package.SetData(DataTransfer.StandardDataFormats.Text, text); _clipboard.SetContent(package); } }); }
public async void GetDataAsync_ThrowsException_IfFormatIdIsEmpty() { DataPackage dataPackage = new DataPackage(); dataPackage.SetData("Format A", "Some data"); dataPackage.SetData("Format B", "Some data"); SharePackageView sharePackage = new SharePackageView(dataPackage.GetView()); var e = await Assert.ThrowsAsync<ArgumentException>(() => sharePackage.GetDataAsync<string>("")); Assert.Equal("The argument cannot be null or an empty string.\r\nParameter name: formatId", e.Message); Assert.Equal("formatId", e.ParamName); }
public async Task GetDataAsync_GetsDataFromDataPackage() { DataPackage dataPackage = new DataPackage(); dataPackage.SetData("Test Format", "Test Value"); SharePackageView sharePackageView = new SharePackageView(dataPackage.GetView()); string data = await sharePackageView.GetDataAsync<string>("Test Format"); Assert.Equal("Test Value", data); }
public void Contains_ThrowsException_IfFormatIdIsNull() { DataPackage dataPackage = new DataPackage(); dataPackage.SetData("Format A", "Some data"); dataPackage.SetData("Format B", "Some data"); SharePackageView sharePackage = new SharePackageView(dataPackage.GetView()); var e = Assert.Throws<ArgumentException>(() => sharePackage.Contains(null)); Assert.Equal("The argument cannot be null or an empty string.\r\nParameter name: formatId", e.Message); Assert.Equal("formatId", e.ParamName); }