本文整理汇总了C#中Microsoft.WindowsAzure.MobileServices.Test.LongIdType类的典型用法代码示例。如果您正苦于以下问题:C# LongIdType类的具体用法?C# LongIdType怎么用?C# LongIdType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LongIdType类属于Microsoft.WindowsAzure.MobileServices.Test命名空间,在下文中一共展示了LongIdType类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: DeleteAsyncWithIntIdTypeAndInvalidIntIdParameter
public async Task DeleteAsyncWithIntIdTypeAndInvalidIntIdParameter()
{
long[] testIdData = IdTestData.InvalidIntIds;
foreach (long testId in testIdData)
{
TestHttpHandler hijack = new TestHttpHandler();
hijack.SetResponseContent("{\"id\":\"" + testId + "\",\"String\":\"Hey\"}");
IMobileServiceClient service = new MobileServiceClient("http://www.test.com", "secret...", hijack);
IMobileServiceTable<LongIdType> table = service.GetTable<LongIdType>();
Exception exception = null;
try
{
LongIdType item = new LongIdType() { Id = testId, String = "what?" };
await table.DeleteAsync(item);
}
catch (Exception e)
{
exception = e;
}
Assert.IsNotNull(exception);
Assert.IsTrue(exception.Message.Contains(" is not a positive integer value") ||
exception.Message.Contains("for member id is outside the valid range for numeric columns"));
}
}
开发者ID:rfaisal,项目名称:azure-mobile-services,代码行数:27,代码来源:MobileServiceTable.Generic.Test.cs
示例2: DeleteAsyncWithIntIdTypeAndIntIdItem
public async Task DeleteAsyncWithIntIdTypeAndIntIdItem()
{
long[] testIdData = IdTestData.ValidIntIds
.Where(id => id != long.MaxValue) // Max value fails for serialization reasons; not because of id constraints
.ToArray();
foreach (long testId in testIdData)
{
TestHttpHandler hijack = new TestHttpHandler();
hijack.SetResponseContent("{\"id\":" + testId + ",\"String\":\"Hey\"}");
IMobileServiceClient service = new MobileServiceClient("http://www.test.com", "secret...", hijack);
IMobileServiceTable<LongIdType> table = service.GetTable<LongIdType>();
LongIdType item = new LongIdType() { Id = testId, String = "what?" };
await table.DeleteAsync(item);
Assert.AreEqual(0L, item.Id);
Assert.AreEqual("what?", item.String);
}
}
开发者ID:rfaisal,项目名称:azure-mobile-services,代码行数:20,代码来源:MobileServiceTable.Generic.Test.cs
示例3: DeleteAsyncWithIntIdTypeAndZeroIdItem
public async Task DeleteAsyncWithIntIdTypeAndZeroIdItem()
{
TestHttpHandler hijack = new TestHttpHandler();
hijack.SetResponseContent("{\"id\":10,\"String\":\"Hey\"}");
IMobileServiceClient service = new MobileServiceClient("http://www.test.com", "secret...", hijack);
IMobileServiceTable<LongIdType> table = service.GetTable<LongIdType>();
Exception exception = null;
try
{
LongIdType item = new LongIdType() { Id = 0, String = "what?" };
await table.DeleteAsync(item);
}
catch (Exception e)
{
exception = e;
}
Assert.IsNotNull(exception);
Assert.IsTrue(exception.Message.Contains("Expected id member not found."));
}
开发者ID:rfaisal,项目名称:azure-mobile-services,代码行数:21,代码来源:MobileServiceTable.Generic.Test.cs
示例4: UpdateAsyncWithIntIdTypeAndNoIdResponseContent
public async Task UpdateAsyncWithIntIdTypeAndNoIdResponseContent()
{
TestHttpHandler hijack = new TestHttpHandler();
hijack.SetResponseContent("{\"String\":\"Hey\"}");
IMobileServiceClient service = new MobileServiceClient("http://www.test.com", "secret...", hijack);
IMobileServiceTable<LongIdType> table = service.GetTable<LongIdType>();
LongIdType item = new LongIdType() { Id = 12, String = "what?" };
await table.UpdateAsync(item);
Assert.AreEqual(12L, item.Id);
Assert.AreEqual("Hey", item.String);
}
开发者ID:rfaisal,项目名称:azure-mobile-services,代码行数:14,代码来源:MobileServiceTable.Generic.Test.cs
示例5: UpdateAsyncWithIntIdTypeAndStringIdResponseContent
public async Task UpdateAsyncWithIntIdTypeAndStringIdResponseContent()
{
TestHttpHandler hijack = new TestHttpHandler();
hijack.SetResponseContent("{\"id\":\"an id\",\"String\":\"Hey\"}");
IMobileServiceClient service = new MobileServiceClient("http://www.test.com", "secret...", hijack);
IMobileServiceTable<LongIdType> table = service.GetTable<LongIdType>();
Exception exception = null;
try
{
LongIdType item = new LongIdType() { Id = 12, String = "what?" };
await table.UpdateAsync(item);
}
catch (Exception e)
{
exception = e;
}
Assert.IsNotNull(exception);
Assert.IsTrue(exception.Message.Contains("Error converting value"));
}
开发者ID:rfaisal,项目名称:azure-mobile-services,代码行数:22,代码来源:MobileServiceTable.Generic.Test.cs
示例6: UpdateAsyncWithIntIdTypeAndIntIdResponseContent
public async Task UpdateAsyncWithIntIdTypeAndIntIdResponseContent()
{
long[] testIdData = IdTestData.ValidIntIds.Concat(
IdTestData.InvalidIntIds).ToArray();
foreach (long testId in testIdData)
{
TestHttpHandler hijack = new TestHttpHandler();
hijack.SetResponseContent("{\"id\":" + testId + ",\"String\":\"Hey\"}");
IMobileServiceClient service = new MobileServiceClient("http://www.test.com", "secret...", hijack);
IMobileServiceTable<LongIdType> table = service.GetTable<LongIdType>();
LongIdType item = new LongIdType() { Id = 12, String = "what?" };
await table.UpdateAsync(item);
Assert.AreEqual(testId, item.Id);
Assert.AreEqual("Hey", item.String);
}
}
开发者ID:rfaisal,项目名称:azure-mobile-services,代码行数:20,代码来源:MobileServiceTable.Generic.Test.cs
示例7: UpdateAsyncWithIntIdTypeParseableIdResponseContent
public async Task UpdateAsyncWithIntIdTypeParseableIdResponseContent()
{
object[] testIdData = IdTestData.NonStringNonIntValidJsonIds;
foreach (object testId in testIdData)
{
TestHttpHandler hijack = new TestHttpHandler();
hijack.SetResponseContent("{\"id\":" + testId.ToString().ToLower() + ",\"String\":\"Hey\"}");
IMobileServiceClient service = new MobileServiceClient("http://www.test.com", "secret...", hijack);
IMobileServiceTable<LongIdType> table = service.GetTable<LongIdType>();
LongIdType item = new LongIdType() { Id = 12, String = "what?" };
await table.UpdateAsync(item);
long expectedId = Convert.ToInt64(testId);
if (expectedId == 0L)
{
expectedId = 12;
}
Assert.AreEqual(expectedId, item.Id);
Assert.AreEqual("Hey", item.String);
}
}
开发者ID:rfaisal,项目名称:azure-mobile-services,代码行数:25,代码来源:MobileServiceTable.Generic.Test.cs
示例8: RefreshAsyncWithIntIdTypeAndIntIdItem
public async Task RefreshAsyncWithIntIdTypeAndIntIdItem()
{
long[] testIdData = IdTestData.ValidIntIds;
foreach (long testId in testIdData)
{
TestHttpHandler hijack = new TestHttpHandler();
hijack.SetResponseContent("[{\"id\":" + testId + ",\"String\":\"Hey\"}]");
IMobileServiceClient service = new MobileServiceClient("http://www.test.com", "secret...", hijack);
IMobileServiceTable<LongIdType> table = service.GetTable<LongIdType>();
LongIdType item = new LongIdType() { Id = testId, String = "what?" };
await table.RefreshAsync(item);
Uri expectedUri = new Uri(string.Format("http://www.test.com/tables/LongIdType?$filter=(id eq {0}L)", testId));
Assert.AreEqual(testId, item.Id);
Assert.AreEqual("Hey", item.String);
Assert.AreEqual(hijack.Request.RequestUri.AbsoluteUri, expectedUri.AbsoluteUri);
}
}
开发者ID:rfaisal,项目名称:azure-mobile-services,代码行数:22,代码来源:MobileServiceTable.Generic.Test.cs
示例9: RefreshAsyncWithIntIdTypeAndZeroIdItem
public async Task RefreshAsyncWithIntIdTypeAndZeroIdItem()
{
TestHttpHandler hijack = new TestHttpHandler();
IMobileServiceClient service = new MobileServiceClient("http://www.test.com", "secret...", hijack);
IMobileServiceTable<LongIdType> table = service.GetTable<LongIdType>();
LongIdType item = new LongIdType() { Id = 0, String = "what?" };
await table.RefreshAsync(item);
Assert.AreEqual(0L, item.Id);
Assert.AreEqual("what?", item.String);
}
开发者ID:rfaisal,项目名称:azure-mobile-services,代码行数:12,代码来源:MobileServiceTable.Generic.Test.cs
示例10: UpdateAsyncWithIntIdTypeAndNullIdResponseContent
public async Task UpdateAsyncWithIntIdTypeAndNullIdResponseContent()
{
TestHttpHandler hijack = new TestHttpHandler();
hijack.SetResponseContent("{\"id\":null,\"String\":\"Hey\"}");
IMobileServiceClient service = new MobileServiceClient(MobileAppUriValidator.DummyMobileApp, hijack);
IMobileServiceTable<LongIdType> table = service.GetTable<LongIdType>();
LongIdType item = new LongIdType() { Id = 12, String = "what?" };
await table.UpdateAsync(item);
Assert.AreEqual(12L, item.Id);
Assert.AreEqual("Hey", item.String);
}
开发者ID:brettsam,项目名称:azure-mobile-apps-net-client,代码行数:14,代码来源:MobileServiceTable.Generic.Test.cs
示例11: RefreshAsyncWithIntIdTypeAndStringIdResponseContent
public async Task RefreshAsyncWithIntIdTypeAndStringIdResponseContent()
{
string[] testIdData = IdTestData.ValidStringIds.Concat(
IdTestData.EmptyStringIds).ToArray();
foreach (string testId in testIdData)
{
TestHttpHandler hijack = new TestHttpHandler();
hijack.SetResponseContent("{\"id\":\"" + testId + "\",\"String\":\"Hey\"}");
IMobileServiceClient service = new MobileServiceClient("http://www.test.com", "secret...", hijack);
IMobileServiceTable<LongIdType> table = service.GetTable<LongIdType>();
Exception exception = null;
try
{
LongIdType item = new LongIdType() { Id = 3, String = "what?" };
await table.RefreshAsync(item);
}
catch (Exception e)
{
exception = e;
}
Assert.IsNotNull(exception);
Assert.IsTrue(exception.Message.Contains("Error converting value"));
}
}
开发者ID:rfaisal,项目名称:azure-mobile-services,代码行数:28,代码来源:MobileServiceTable.Generic.Test.cs
示例12: InsertAsyncWithIntIdTypeAndIntIdItem
public async Task InsertAsyncWithIntIdTypeAndIntIdItem()
{
long[] testIdData = IdTestData.ValidIntIds;
foreach (long testId in testIdData)
{
TestHttpHandler hijack = new TestHttpHandler();
hijack.SetResponseContent("{\"id\":" + testId + ",\"String\":\"Hey\"}");
IMobileServiceClient service = new MobileServiceClient(MobileAppUriValidator.DummyMobileApp, hijack);
IMobileServiceTable<LongIdType> table = service.GetTable<LongIdType>();
Exception exception = null;
try
{
LongIdType item = new LongIdType() { Id = testId, String = "what?" };
await table.InsertAsync(item);
}
catch (Exception e)
{
exception = e;
}
Assert.IsNotNull(exception);
Assert.IsTrue(exception.Message.Contains("Cannot insert if the id member is already set.") ||
exception.Message.Contains("for member id is outside the valid range for numeric columns"));
}
}
开发者ID:brettsam,项目名称:azure-mobile-apps-net-client,代码行数:28,代码来源:MobileServiceTable.Generic.Test.cs
示例13: InsertAsyncWithIntIdTypeAndStringIdResponseContent
public async Task InsertAsyncWithIntIdTypeAndStringIdResponseContent()
{
TestHttpHandler hijack = new TestHttpHandler();
hijack.SetResponseContent("{\"id\":\"an id\",\"String\":\"Hey\"}");
IMobileServiceClient service = new MobileServiceClient(MobileAppUriValidator.DummyMobileApp, hijack);
IMobileServiceTable<LongIdType> table = service.GetTable<LongIdType>();
Exception exception = null;
try
{
LongIdType item = new LongIdType() { String = "what?" };
await table.InsertAsync(item);
}
catch (Exception e)
{
exception = e;
}
Assert.IsNotNull(exception);
Assert.IsTrue(exception.Message.Contains("Error converting value"));
}
开发者ID:brettsam,项目名称:azure-mobile-apps-net-client,代码行数:22,代码来源:MobileServiceTable.Generic.Test.cs
示例14: InsertAsyncWithIntIdTypeParseableIdResponseContent
public async Task InsertAsyncWithIntIdTypeParseableIdResponseContent()
{
object[] testIdData = IdTestData.NonStringNonIntValidJsonIds;
foreach (object testId in testIdData)
{
TestHttpHandler hijack = new TestHttpHandler();
hijack.SetResponseContent("{\"id\":" + testId.ToString().ToLower() + ",\"String\":\"Hey\"}");
IMobileServiceClient service = new MobileServiceClient(MobileAppUriValidator.DummyMobileApp, hijack);
IMobileServiceTable<LongIdType> table = service.GetTable<LongIdType>();
LongIdType item = new LongIdType() { String = "what?" };
await table.InsertAsync(item);
long expectedId = Convert.ToInt64(testId);
Assert.AreEqual(expectedId, item.Id);
Assert.AreEqual("Hey", item.String);
}
}
开发者ID:brettsam,项目名称:azure-mobile-apps-net-client,代码行数:20,代码来源:MobileServiceTable.Generic.Test.cs
示例15: RefreshAsyncWithIntIdTypeAndInvalidIntIdParameter
public async Task RefreshAsyncWithIntIdTypeAndInvalidIntIdParameter()
{
long[] testIdData = IdTestData.InvalidIntIds;
foreach (long testId in testIdData)
{
TestHttpHandler hijack = new TestHttpHandler();
hijack.SetResponseContent("{\"id\":\"" + testId + "\",\"String\":\"Hey\"}");
IMobileServiceClient service = new MobileServiceClient(MobileAppUriValidator.DummyMobileApp, hijack);
IMobileServiceTable<LongIdType> table = service.GetTable<LongIdType>();
Exception exception = null;
try
{
LongIdType item = new LongIdType() { Id = testId, String = "what?" };
await table.RefreshAsync(item);
}
catch (Exception e)
{
exception = e;
}
Assert.IsNotNull(exception);
Assert.IsTrue(exception.Message.Contains(" is not a positive integer value"));
}
}
开发者ID:brettsam,项目名称:azure-mobile-apps-net-client,代码行数:26,代码来源:MobileServiceTable.Generic.Test.cs
示例16: RefreshAsyncWithIntIdTypeAndZeroIdItem
public async Task RefreshAsyncWithIntIdTypeAndZeroIdItem()
{
TestHttpHandler hijack = new TestHttpHandler();
IMobileServiceClient service = new MobileServiceClient(MobileAppUriValidator.DummyMobileApp, hijack);
IMobileServiceTable<LongIdType> table = service.GetTable<LongIdType>();
LongIdType item = new LongIdType() { Id = 0, String = "what?" };
await table.RefreshAsync(item);
Assert.AreEqual(0L, item.Id);
Assert.AreEqual("what?", item.String);
}
开发者ID:brettsam,项目名称:azure-mobile-apps-net-client,代码行数:12,代码来源:MobileServiceTable.Generic.Test.cs
注:本文中的Microsoft.WindowsAzure.MobileServices.Test.LongIdType类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论