public void ToDoList_ToDoListItem_ChildCount_Verify() { // Arrange var cut = RenderComponent <ToDoListCard>( ("ViewModel", ToDoListTestModels.DefaultToDoListModel()) ); // Act var listItems = cut.FindComponents <ToDoListItem>(); // Assert Assert.Equal(3, listItems.Count); }
public void ToDoList_ToDoListItem_Markup() { // Arrange var cut = RenderComponent <ToDoListCard>( ("ViewModel", ToDoListTestModels.DefaultToDoListModel()) ); // Act var item = cut.FindComponents <ToDoListItem>()[0]; // Assert item.MarkupMatches(TestComponentMarkupConstants.ToDoListItem_Unchecked); }
public static async Task Main(string[] args) { var builder = WebAssemblyHostBuilder.CreateDefault(args); var sourceBasePath = builder.Configuration.GetSection("sourceSamplesSettings").GetValue <string>("sourceBasePath"); builder.AddCarltonTestBed(builder => { //Base Components builder.AddComponent <Card>($"{BASE_COMPONENTS}/Cards/Card", CardTestStates.DefaultState()); builder.AddComponent <ListCard <string> >($"{BASE_COMPONENTS}/Cards/ListCard", CardTestStates.DefaultListState()); builder.AddComponent <Header>($"{BASE_COMPONENTS}/Header"); builder.AddComponent <Logo>($"{BASE_COMPONENTS}/Logo"); builder.AddComponent <HamburgerCollapser>($"{BASE_COMPONENTS}/HamburgerCollapser"); builder.AddComponent <UserProfile>($"{BASE_COMPONENTS}/UserProfile"); builder.AddComponent <Checkbox>($"{BASE_COMPONENTS}/checkbox/Checked", CheckboxTestStates.CheckedState()); builder.AddComponent <Checkbox>($"{BASE_COMPONENTS}/checkbox/Unchecked", CheckboxTestStates.UncheckedState()); builder.AddComponent <Select>($"{BASE_COMPONENTS}/Select/Default", SelectTestStates.Default()); builder.AddComponent <ResizablePanel>($"{BASE_COMPONENTS}/ResizablePanel/Default"); builder.AddComponent <Select>($"{BASE_COMPONENTS}/Select/Default", SelectTestStates.Default()); //ToDos builder.AddCarltonComponent <ToDoListItem>("ToDos/ListItem/Checked", ToDoListTestModels.ToDoListItemCheckedModel()); builder.AddCarltonComponent <ToDoListItem>("ToDos/ListItem/Unchecked", ToDoListTestModels.ToDoListItemUncheckedModel()); builder.AddCarltonComponent <ToDoListCard>("ToDos/ListCard/Default", ToDoListTestModels.DefaultToDoListModel()); //ApartmentStatus builder.AddCarltonComponent <ApartmentStatusListItem>("ApartmentStatus/ListItem/Completed", ApartmentStatusTestModels.CompletedStatusModel()); builder.AddCarltonComponent <ApartmentStatusListItem>("ApartmentStatus/ListItem/Incomplete", ApartmentStatusTestModels.InCompleteStatusModel()); builder.AddCarltonComponent <ApartmentStatusListCard>("ApartmentStatus/ListCard/Default", ApartmentStatusTestModels.DefaultApartmentStatusModel()); //DinnerGuests builder.AddCarltonComponent <DinnerGuestsSelfStatus>("DinnerGuests/SelfStatus/HomeForDinner", DinnerGuestsTestModels.DinnerGuestsSelfHomeModel()); builder.AddCarltonComponent <DinnerGuestsSelfStatus>("DinnerGuests/SelfStatus/NotHomeForDinner", DinnerGuestsTestModels.DinnerGuestsSelfNotHomeModel()); builder.AddCarltonComponent <DinnerGuestsListItem>("DinnerGuests/ListItem/HomeForDinner", DinnerGuestsTestModels.DinnerGuestHomeModel()); builder.AddCarltonComponent <DinnerGuestsListItem>("DinnerGuests/ListItem/NotHomeForDinner", DinnerGuestsTestModels.DinnerGuestNotHomeModel()); builder.AddCarltonComponent <DinnerGuestsListCard>("DinnerGuests/ListCard", DinnerGuestsTestModels.DefaultHomeForDinnerModel()); //Groceries builder.AddCarltonComponent <GroceriesListItem>("Groceries/ListItems/Low", GroceriesTestModels.GroceriesLowListItemModel()); builder.AddCarltonComponent <GroceriesListItem>("Groceries/ListItems/Medium", GroceriesTestModels.GroceriesMediumListItemModel()); builder.AddCarltonComponent <GroceriesListItem>("Groceries/ListItems/High", GroceriesTestModels.GroceriesHighListItemModel()); builder.AddCarltonComponent <GroceriesListCard>("Groceries/ListCard/Default", GroceriesTestModels.DefaultGroceriesListModel()); //Feed builder.AddCarltonComponent <FeedListItem>("Feed/ListItem", FeedListTestModels.DefaultFeedListItemModel()); builder.AddCarltonComponent <FeedListCard>("Feed/ListCard", FeedListTestModels.DefaultFeedItemListModel()); //CountCards builder.AddCarltonComponent <ToDosCountCard>("CountCards/ToDos/Default", DashboardAggregationsTestModels.DefaultDashboardAggregationModel()); builder.AddCarltonComponent <ApartmentStatusCountCard>("CountCards/ApartmentStatus/Default", DashboardAggregationsTestModels.DefaultDashboardAggregationModel()); builder.AddCarltonComponent <DinnerGuestsCountCard>("CountCards/DinnerGuesets/Default", DashboardAggregationsTestModels.DefaultDashboardAggregationModel()); builder.AddCarltonComponent <GroceriesCountCard>("CountCards/Groceries/Default", DashboardAggregationsTestModels.DefaultDashboardAggregationModel()); }, sourceBasePath, typeof(Carlton.TestBed.Pages.TestBed).Assembly); builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); builder.RootComponents.Add <App>("app"); await builder.Build().RunAsync().ConfigureAwait(true); }