public void GetFakeAuthorization_Coverage_NotFail_Test()
        {
            IRegisteredUserRepository eventDefinitionService = new StubIRegisteredUserRepository();
            IFacebookService facebookService = new StubIFacebookService();
            var target = new AuthenticationController(eventDefinitionService, facebookService);

            MyEvents.Api.Authentication.AuthenticationResponse response = target.GetFakeAuthorization();
            Assert.IsNotNull(response);
            Assert.IsNotNull(response.Token);
        }
        public void LogOn_TokenException_Test()
        {
            IRegisteredUserRepository eventDefinitionService = new StubIRegisteredUserRepository();
            IFacebookService facebookService = new StubIFacebookService();
            var target = new AuthenticationController(eventDefinitionService, facebookService);

            target.LogOn(string.Empty);
        }
        public void LogOn_Logged_Test()
        {
            string token = "mytoken";

            IRegisteredUserRepository eventDefinitionService = new StubIRegisteredUserRepository()
            {
                AddRegisteredUser = (user) =>
                    {
                        Assert.AreEqual(user.FacebookId, "facebookId");
                        return 10;
                    }
            };
            IFacebookService facebookService = new StubIFacebookService()
            {
                GetUserInformationString = (facebookToken) =>
                    {
                        return new Model.RegisteredUser() { FacebookId = "facebookId" };
                    }
            };
            var target = new AuthenticationController(eventDefinitionService, facebookService);

            MyEvents.Api.Authentication.AuthenticationResponse response = target.LogOn(token);

            Assert.IsNotNull(response);
            Assert.IsNotNull(response.Token);
        }
 public void EventDefinitionController_Contructor_NotFail_Test()
 {
     IRegisteredUserRepository eventDefinitionService = new StubIRegisteredUserRepository();
     IFacebookService facebookService = new StubIFacebookService();
     var target = new AuthenticationController(eventDefinitionService, facebookService);
 }
 public void EventDefinitionController_Contructor_IRegisteredUserRepositoryIsNull_Test()
 {
     IFacebookService facebookService = new StubIFacebookService();
     var target = new AuthenticationController(null, facebookService);
 }
 public void EventDefinitionController_Contructor_IFacebookServiceIsNull_Test()
 {
     IRegisteredUserRepository eventDefinitionService = new StubIRegisteredUserRepository();
     var target = new AuthenticationController(eventDefinitionService, null);
 }
        public void LogOn_TokenNotValid_Test()
        {
            string token = "mytoken";

            IRegisteredUserRepository eventDefinitionService = new StubIRegisteredUserRepository()
            {
                GetString = (facebookId) =>
                {
                    Assert.Fail();
                    return null;
                }
            };
            IFacebookService facebookService = new StubIFacebookService()
            {
                GetUserInformationString = (facebookToken) =>
                {
                    return null;
                }
            };
            var target = new AuthenticationController(eventDefinitionService, facebookService);

            MyEvents.Api.Authentication.AuthenticationResponse response = target.LogOn(token);

            Assert.IsNull(response);
        }