示例#1
0
        public void ToDoListItem_Checked_Markup()
        {
            // Arrange
            var cut = RenderComponent <ToDoListItem>(
                ("ViewModel", ToDoListTestModels.ToDoListItemCheckedModel())
                );

            // Assert
            cut.MarkupMatches(TestComponentMarkupConstants.ToDoListItem_Checked);
        }
示例#2
0
        public void ToDoListItem_Label_Verify()
        {
            // Arrange
            var ToDoLabelText = "Take Out Garbage";
            var cut           = RenderComponent <ToDoListItem>(
                ("ViewModel", ToDoListTestModels.ToDoListItemCheckedModel())
                );

            // Act
            var renderedText = cut.Find("span.to-do-name").TextContent;

            // Assert
            Assert.Equal(ToDoLabelText, renderedText);
        }
示例#3
0
        public void ToDoListItem_Initial_Checked_ToDoStatusChangedEvent()
        {
            // Arrange
            var expected = new ToDoStatusChangedEvent(1, false);
            ToDoStatusChangedEvent result = null;
            var cut = RenderComponent <ToDoListItem>(
                ("ViewModel", ToDoListTestModels.ToDoListItemCheckedModel()),
                ComponentParameterFactory.EventCallback("OnComponentEvent", (evt) => result = (ToDoStatusChangedEvent)evt)
                );

            // Act
            cut.Find(".checkbox span").Click();


            // Assert
            Assert.Equal(expected, result);
        }
示例#4
0
        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);
        }