public void DeleteWithNoQueryResultsThrowsNoError() { var context = new XrmFakedContext(); var orgService = context.GetOrganizationService(); Assert.DoesNotThrow( () => SampleAccountQueryExpression.DeleteSingleRecord(orgService)); }
public void IfNoResultsAreFoundReturnsNull() { var context = new XrmFakedContext(); var orgService = context.GetOrganizationService(); var retrievedAccount = (Account)SampleAccountQueryExpression.RetrieveSingleRecord(orgService); Assert.IsNull(retrievedAccount); }
public void QueryExpressionEntityCollectionExtensionMethod() { var context = new XrmFakedContext(); var orgService = context.GetOrganizationService(); context.Initialize(new List <Entity>() { TestAccount1, TestAccount1Duplicate }); var retrievedAccounts = SampleAccountQueryExpression.RetrieveMultiple(orgService); Assert.AreEqual(2, retrievedAccounts.Entities.Count); }
public void QueryExpressionSingleRecordExtensionMethod() { var context = new XrmFakedContext(); var orgService = context.GetOrganizationService(); context.Initialize(new List <Entity>() { TestAccount1 }); var retrievedAccount = (Account)SampleAccountQueryExpression.RetrieveSingleRecord(orgService); Assert.AreEqual(TestAccount1.Id, retrievedAccount.Id); Assert.AreEqual(TestAccount1.Name, retrievedAccount.Name); }
public void DeleteSingleRecordTest() { var context = new XrmFakedContext(); var orgService = context.GetOrganizationService(); context.Initialize(new List <Entity>() { TestAccount1 }); var preAccounts = (from a in context.CreateQuery <Account>() select a).ToList(); Assert.AreEqual(1, preAccounts.Count); Assert.DoesNotThrow( () => SampleAccountQueryExpression.DeleteSingleRecord(orgService)); var postAccounts = (from a in context.CreateQuery <Account>() select a).ToList(); Assert.AreEqual(0, postAccounts.Count); }