Beispiel #1
0
        public async Task <ObjectResponse> CreateWidgetAsync(CreateWidgetDto input)
        {
            ObjectResponse reponse = new ObjectResponse();

            try
            {
                await _widgetManager.CreateWidget(
                    input.Name,
                    input.Owner,
                    input.Logo,
                    input.WelcomeMessage,
                    input.PrimaryColor,
                    input.TeamIntro,
                    input.BackgroundColor,
                    input.ObjectConfigs
                    );

                reponse.message = "Ok";
                return(reponse);
            }
            catch (Exception ex)
            {
                var er = ex.Message;
                reponse.error.Add(er);
                return(reponse);
            }
        }
        public void CreateAndLoad([Values(1, 10, 100)] int n)
        {
            List <WidgetCreateRequest> requests = new List <WidgetCreateRequest>();

            for (int i = 0; i < n; i++)
            {
                WidgetCreateRequest request = new WidgetCreateRequest()
                {
                    S1 = Gnosis.Testing.Utility.GetRandomPhrase()
                };
                Debug.Print(request.S1);

                requests.Add(request);
                manager.CreateWidget(request);
            }

            List <Widget> widgets = manager.LoadWidgets <Widget>(requests.Select(x => x.Id)).ToList();

            Assert.AreEqual(n, widgets.Count());

            for (int i = 0; i < n; i++)
            {
                Assert.AreEqual(requests[i].Id, widgets[i].Id);
                Assert.AreEqual(requests[i].S1, widgets[i].S1);
            }
        }