public void TestCreateCandidate() { CreateCandidateAction action = new CreateCandidateAction(); TestCandidate candidate = new TestCandidate(); candidate.Name = "Chethan"; TestContact contact = new TestContact(); contact.PhoneNumber = "2500281123"; Relation.Set(candidate, contact); action.Entity = candidate; MockAuthorizationProvider authorizationProvider = GetMockAuthorizationProvider(); if (authorizationProvider != null) { authorizationProvider.Allow("Can_CreateCandidate"); } action.Execute(); candidate = action.Entity; Assert.AreEqual(Fetch(candidate).Name, "Chethan"); Assert.AreEqual(Relation.Get <TestCandidate, TestContact>(candidate).PhoneNumber, "2500281123"); }
private static MockAuthorizationProvider GetMockAuthorizationProvider() { MockAuthorizationProvider authorizationProvider = ObjectBuilder.Get <IAuthorizationProvider>() as MockAuthorizationProvider; return(authorizationProvider); }