예제 #1
0
 public void CompositeId_GetHashCode_IsBasedOnAllComponents()
 {
     var id = new RemoteMembershipId
     {
         LoginProvider = "loginProvider",
         ProviderKey = "providerKey",
     };
     id.GetHashCode().ShouldEqual(id.LoginProvider.GetHashCode() ^ id.ProviderKey.GetHashCode());
 }
예제 #2
0
 public void CompositeId_GetHashCode_ReturnsZero_WhenAnyComponentIsNull(string loginProvider, string providerKey)
 {
     var id = new RemoteMembershipId
     {
         LoginProvider = loginProvider,
         ProviderKey = providerKey,
     };
     id.GetHashCode().ShouldEqual(0);
 }
예제 #3
0
 public void CompositeId_Equals_ReturnsTrue_WhenReferenceEqualsOther()
 {
     var id = new RemoteMembershipId
     {
         LoginProvider = "loginProvider",
         ProviderKey = "providerKey",
     };
     id.Equals(id).ShouldBeTrue();
     id.Equals(id as object).ShouldBeTrue();
 }
예제 #4
0
 public void CompositeId_Equals_ReturnsFalse_WhenOtherIsNull()
 {
     var id = new RemoteMembershipId
     {
         LoginProvider = "loginProvider",
         ProviderKey = "providerKey",
     };
     id.Equals(null).ShouldBeFalse();
     id.Equals(null as object).ShouldBeFalse();
 }
예제 #5
0
 protected internal ProxiedRemoteMembership(RemoteMembershipId id)
     : this(id.LoginProvider, id.ProviderKey)
 {
 }
예제 #6
0
        public void Handler_ReturnsNullUser_WhenNotFound_ByUserLoginInfo()
        {
            var loginProvider = FakeData.String();
            var providerKey = FakeData.String();
            var remoteMembershipId = new RemoteMembershipId
            {
                LoginProvider = loginProvider,
                ProviderKey = FakeData.String(),
            };
            var remoteMembership = new ProxiedRemoteMembership(remoteMembershipId);
            var user = new User();
            user.RemoteMemberships.Add(remoteMembership);
            var data = new[] { user }.AsQueryable();
            var query = new UserBy(new UserLoginInfo(loginProvider, providerKey));
            var dbSet = new Mock<DbSet<User>>(MockBehavior.Strict).SetupDataAsync(data);
            var entities = new Mock<IReadEntities>(MockBehavior.Strict);
            var entitySet = new EntitySet<User>(dbSet.Object, entities.Object);
            entities.Setup(x => x.Query<User>()).Returns(entitySet);
            var handler = new HandleUserByQuery(entities.Object);

            var result = handler.Handle(query).Result;

            result.ShouldBeNull();
            entities.Verify(x => x.Query<User>(), Times.Once);
        }
예제 #7
0
 public void CompositeId_Equals_ReturnsFalse_WhenAnyComponentIsNull(string loginProvider1, string providerKey1, string loginProvider2, string providerKey2)
 {
     var id1 = new RemoteMembershipId
     {
         LoginProvider = loginProvider1,
         ProviderKey = providerKey1,
     };
     var id2 = new RemoteMembershipId
     {
         LoginProvider = loginProvider2,
         ProviderKey = providerKey2,
     };
     id1.Equals(id2).ShouldBeFalse();
     id1.Equals(id2 as object).ShouldBeFalse();
     id2.Equals(id1).ShouldBeFalse();
     id2.Equals(id1 as object).ShouldBeFalse();
 }
예제 #8
0
 protected internal ProxiedRemoteMembership(RemoteMembershipId id)
     : this(id.LoginProvider, id.ProviderKey)
 {
 }