public void CallTest()
        {
            //Arrange
            var domainStatUserRegistration1 = new DomainStatUserRegistration() { IdentityProvider = IdentityType.Twitter.ToString() };
            var domainStatUserRegistration2 = new DomainStatUserRegistration() { IdentityProvider = "IdentityProvider" };
            var domainStatUserRegistration3 = new DomainStatUserRegistration();

            var domainReport = new DomainReport();

            var statUserRegistrationFilter = new Mock<IStatUserRegistrationFilter>();

            var twitterRegistrationsFilter = new TwitterRegistrationsFilter();
            twitterRegistrationsFilter.Set(statUserRegistrationFilter.Object);

            //Act
            twitterRegistrationsFilter.Call(domainStatUserRegistration1, domainReport);
            twitterRegistrationsFilter.Call(domainStatUserRegistration2, domainReport);
            twitterRegistrationsFilter.Call(domainStatUserRegistration3, domainReport);

            //Assert
            Assert.AreEqual(1, domainReport.TwitterRegistrations);
            statUserRegistrationFilter.Verify(m => m.Call(domainStatUserRegistration1, domainReport), Times.Once());
            statUserRegistrationFilter.Verify(m => m.Call(domainStatUserRegistration2, domainReport), Times.Once());
            statUserRegistrationFilter.Verify(m => m.Call(domainStatUserRegistration3, domainReport), Times.Once());
        }
예제 #2
0
        public void CallTest()
        {
            //Arrange
            var domainStatUserRegistration1 = new DomainStatUserRegistration()
            {
                IdentityProvider = IdentityType.Twitter.ToString()
            };
            var domainStatUserRegistration2 = new DomainStatUserRegistration()
            {
                IdentityProvider = "IdentityProvider"
            };
            var domainStatUserRegistration3 = new DomainStatUserRegistration();

            var domainReport = new DomainReport();

            var statUserRegistrationFilter = new Mock <IStatUserRegistrationFilter>();

            var twitterRegistrationsFilter = new TwitterRegistrationsFilter();

            twitterRegistrationsFilter.Set(statUserRegistrationFilter.Object);

            //Act
            twitterRegistrationsFilter.Call(domainStatUserRegistration1, domainReport);
            twitterRegistrationsFilter.Call(domainStatUserRegistration2, domainReport);
            twitterRegistrationsFilter.Call(domainStatUserRegistration3, domainReport);

            //Assert
            Assert.AreEqual(1, domainReport.TwitterRegistrations);
            statUserRegistrationFilter.Verify(m => m.Call(domainStatUserRegistration1, domainReport), Times.Once());
            statUserRegistrationFilter.Verify(m => m.Call(domainStatUserRegistration2, domainReport), Times.Once());
            statUserRegistrationFilter.Verify(m => m.Call(domainStatUserRegistration3, domainReport), Times.Once());
        }
        public void CallWhenNotSetFelterTest()
        {
            //Arrange
            var domainStatUserRegistration = new DomainStatUserRegistration() { IdentityProvider = IdentityType.Twitter.ToString() };
            var domainReport = new DomainReport();

            var twitterRegistrationsFilter = new TwitterRegistrationsFilter();

            //Act
            twitterRegistrationsFilter.Call(domainStatUserRegistration, domainReport);
            twitterRegistrationsFilter.Call(domainStatUserRegistration, domainReport);

            //Assert
            Assert.AreEqual(2, domainReport.TwitterRegistrations);
        }
예제 #4
0
        public void CallWhenNotSetFelterTest()
        {
            //Arrange
            var domainStatUserRegistration = new DomainStatUserRegistration()
            {
                IdentityProvider = IdentityType.Twitter.ToString()
            };
            var domainReport = new DomainReport();

            var twitterRegistrationsFilter = new TwitterRegistrationsFilter();

            //Act
            twitterRegistrationsFilter.Call(domainStatUserRegistration, domainReport);
            twitterRegistrationsFilter.Call(domainStatUserRegistration, domainReport);

            //Assert
            Assert.AreEqual(2, domainReport.TwitterRegistrations);
        }