public void Build_SettingTabShouldReturnModifyRouteAndCallTheRightRouteIfSettingIsPresent() { //Arrange var customJewel = new CustomJewelPersistenceBase(); var diamondRepository = new FakeDiamondRepository(mapper); var webHelpers = MockRepository.GenerateMock <IWebHelpers>(); var jewelRepository = new FakeJewelRepository(new FakeSettingManager()); customJewel.DiamondID = FIRST_DIAMOND_IN_REP; customJewel.SettingID = SETTING_ID; webHelpers.Expect( x => x.RouteUrl(Arg <string> .Is.Equal("ChooseSetting"), Arg <RouteValueDictionary> .Is.Anything)). Return("/JewelDesign/DiamondSearch").Repeat.Any(); var builder = new TabsForJewelDesignNavigationBuilder(customJewel, diamondRepository, jewelRepository, webHelpers); //Act var tabs = builder.Build(); //Assert tabs[1].ModifyRoute.Should().Be("/JewelDesign/DiamondSearch"); webHelpers.VerifyAllExpectations(); }
public void Build_SettingabShouldReturnViewRouteAndCallTheRightRouteIfSettingIsPresent() { //Arrange var customJewel = new CustomJewelPersistenceBase(); var diamondRepository = new FakeDiamondRepository(mapper); var webHelpers = MockRepository.GenerateMock <IWebHelpers>(); var jewelRepository = new FakeJewelRepository(new FakeSettingManager()); customJewel.DiamondID = FIRST_DIAMOND_IN_REP; customJewel.SettingID = SETTING_ID; webHelpers.Expect( x => x.RouteUrl(Arg <string> .Is.Equal("Setting"), Arg <RouteValueDictionary> .Matches(d => (int)d["DiamondID"] == customJewel.DiamondID && (int)d["SettingID"] == customJewel.SettingID))).Return( "/jewelryitem/view/uri").Repeat.Any(); var builder = new TabsForJewelDesignNavigationBuilder(customJewel, diamondRepository, jewelRepository, webHelpers); //Act var tabs = builder.Build(); //Assert webHelpers.VerifyAllExpectations(); tabs[1].ViewRoute.Should().Be("/jewelryitem/view/uri"); }
private TabsForJewelDesignNavigationBuilder CreateDefaultTabsForJewelDesignBuilder() { var diamondRepository = new FakeDiamondRepository(mapper); var customJewel = new CustomJewelPersistenceBase(); var webHelpers = MockRepository.GenerateStub <IWebHelpers>(); var jewelRepository = new FakeJewelRepository(new FakeSettingManager()); var builder = new TabsForJewelDesignNavigationBuilder(customJewel, diamondRepository, jewelRepository, webHelpers); return(builder); }
private TabsForJewelDesignNavigationBuilder CreateWithDiamondIDTabsForJewelDesignBuilder() { var customJewel = new CustomJewelPersistenceBase(); var diamondRepository = new FakeDiamondRepository(mapper); var webHelpers = MockRepository.GenerateStub <IWebHelpers>(); var jewelRepository = new FakeJewelRepository(new FakeSettingManager()); webHelpers.Stub(x => x.RouteUrl(Arg <string> .Is.Anything, Arg <RouteValueDictionary> .Is.Anything)).Return( "not important for this test"); customJewel.DiamondID = FIRST_DIAMOND_IN_REP; var builder = new TabsForJewelDesignNavigationBuilder(customJewel, diamondRepository, jewelRepository, webHelpers); return(builder); }