public Specification when_updating_status_with_invalid_model() { string statusText = new string('*', 141); var statusViewModel = new StatusViewModel { Status = statusText }; ISessionAdapter session = sessionFactory(); var testDbContext = new TestDbContext(); Container container = containerFactory(testDbContext); int maxId = testDbContext.Statuses.Max(_ => _.Key); return(new QuerySpecification <TwitterController, ViewResult> { On = () => { session.SetTwitterAccessToken(new OAuthToken("", "")); return GetTwitterController(container, session); }, When = ctrl => ctrl.UpdateStatus(statusViewModel) as ViewResult, Expect = { routeResult => routeResult.ViewName == "Send", }, }); }
public Specification when_updating_status_with_access_token() { const string statusText = "some test status"; var statusViewModel = new StatusViewModel { Status = statusText }; ISessionAdapter session = sessionFactory(); var testDbContext = new TestDbContext(); Container container = containerFactory(testDbContext); var mockTwitterProvider = MockTwitterProvider(statusText); container.TwitterServiceFactory = () => mockTwitterProvider.Object; int statusCount = testDbContext.Statuses.Count; return(new ActionSpecification <TwitterController> { On = () => { session.SetTwitterAccessToken(new OAuthToken("", "")); return GetTwitterController(container, session); }, When = ctrl => ctrl.UpdateStatus(statusViewModel), Expect = { ctrl => testDbContext.Statuses.Count == statusCount + 1, ctrl => testDbContext.Statuses.Last().Value.Text == statusText, }, }); }