public void WillGetTheCurrentUserUsingTheRequestIdentityName() { var controller = new TestableUsersController(); controller.StubIdentity.Setup(stub => stub.Name).Returns("theUsername"); controller.Account(); controller.StubUserByUsernameQry.Verify(stub => stub.Execute("theUsername", true)); }
public void WillReturnTheAccountViewModelWithTheUserApiKey() { var stubApiKey = Guid.NewGuid(); var controller = new TestableUsersController(); controller.MockUserService .Setup(s => s.FindByUsername(It.IsAny<string>())) .Returns(new User { Key = 42, ApiKey = stubApiKey }); // act var model = ((ViewResult)controller.Account()).Model as AccountViewModel; // verify Assert.Equal(stubApiKey.ToString(), model.ApiKey); }
public void WillGetCuratedFeedsManagedByTheCurrentUser() { var controller = new TestableUsersController(); controller.MockUserService .Setup(s => s.FindByUsername(It.IsAny<string>())) .Returns(new User { Key = 42 }); // act controller.Account(); // verify controller.MockCuratedFeedService .Verify(query => query.GetFeedsForManager(42)); }
public void WillReturnTheAccountViewModelWithTheCuratedFeeds() { var controller = new TestableUsersController(); controller.StubCuratedFeedsByManagerQry .Setup(stub => stub.Execute(It.IsAny <int>())) .Returns(new[] { new CuratedFeed { Name = "theCuratedFeed" } }); var model = ((ViewResult)controller.Account()).Model as AccountViewModel; Assert.Equal("theCuratedFeed", model.CuratedFeeds.First()); }
public void WillGetCuratedFeedsManagedByTheCurrentUser() { var controller = new TestableUsersController(); controller.StubUserByUsernameQry .Setup(stub => stub.Execute(It.IsAny <string>(), It.IsAny <bool>())) .Returns(new User { Key = 42 }); controller.Account(); controller.StubCuratedFeedsByManagerQry.Verify(stub => stub.Execute(42)); }
public void WillReturnTheAccountViewModelWithTheUserApiKey() { var controller = new TestableUsersController(); var stubApiKey = Guid.NewGuid(); controller.StubUserByUsernameQry .Setup(stub => stub.Execute(It.IsAny <string>(), It.IsAny <bool>())) .Returns(new User { Key = 42, ApiKey = stubApiKey }); var model = ((ViewResult)controller.Account()).Model as AccountViewModel; Assert.Equal(stubApiKey.ToString(), model.ApiKey); }
public void WillReturnTheAccountViewModelWithTheCuratedFeeds() { var controller = new TestableUsersController(); controller.MockUserService .Setup(s => s.FindByUsername(It.IsAny<string>())) .Returns(new User { Key = 42 }); controller.MockCuratedFeedService .Setup(stub => stub.GetFeedsForManager(It.IsAny<int>())) .Returns(new[] { new CuratedFeed { Name = "theCuratedFeed" } }); // act var model = ((ViewResult)controller.Account()).Model as AccountViewModel; // verify Assert.Equal("theCuratedFeed", model.CuratedFeeds.First()); }
public void WillReturnTheAccountViewModelWithTheUserApiKey() { var stubApiKey = Guid.NewGuid(); var controller = new TestableUsersController(); controller.MockUserService .Setup(s => s.FindByUsername(It.IsAny <string>())) .Returns(new User { Key = 42, ApiKey = stubApiKey }); // act var model = ((ViewResult)controller.Account()).Model as AccountViewModel; // verify Assert.Equal(stubApiKey.ToString(), model.ApiKey); }
public void WillGetCuratedFeedsManagedByTheCurrentUser() { var controller = new TestableUsersController(); controller.MockUserService .Setup(s => s.FindByUsername(It.IsAny <string>())) .Returns(new User { Key = 42 }); // act controller.Account(); // verify controller.MockFeedsQuery .Verify(query => query.Execute(42)); }
public void WillGetTheCurrentUserUsingTheRequestIdentityName() { var controller = new TestableUsersController(); controller.MockCurrentIdentity .Setup(stub => stub.Name) .Returns("theUsername"); controller.MockUserService .Setup(s => s.FindByUsername(It.IsAny<string>())) .Returns(new User { Key = 42 }); //act controller.Account(); // verify controller.MockUserService .Verify(stub => stub.FindByUsername("theUsername")); }
public void WillGetTheCurrentUserUsingTheRequestIdentityName() { var controller = new TestableUsersController(); controller.MockCurrentIdentity .Setup(stub => stub.Name) .Returns("theUsername"); controller.MockUserService .Setup(s => s.FindByUsername(It.IsAny <string>())) .Returns(new User { Key = 42 }); //act controller.Account(); // verify controller.MockUserService .Verify(stub => stub.FindByUsername("theUsername")); }
public void WillReturnTheAccountViewModelWithTheCuratedFeeds() { var controller = new TestableUsersController(); controller.MockUserService .Setup(s => s.FindByUsername(It.IsAny <string>())) .Returns(new User { Key = 42 }); controller.MockFeedsQuery .Setup(stub => stub.Execute(It.IsAny <int>())) .Returns(new[] { new CuratedFeed { Name = "theCuratedFeed" } }); // act var model = ((ViewResult)controller.Account()).Model as AccountViewModel; // verify Assert.Equal("theCuratedFeed", model.CuratedFeeds.First()); }