Beispiel #1
0
        public IActionResult Update(Category category)
        {
            FakeDataHelper.SetCategory(category);
            var newCategory = FakeDataHelper.GetCategory(category.UID);

            return(View(viewPath + "Edit", newCategory));
        }
        public IActionResult Update(Material material)
        {
            FakeDataHelper.SetMaterial(material);
            var newMaterial = FakeDataHelper.GetMaterial(material.UID);

            return(View(viewPath + "Edit", newMaterial));
        }
        public IActionResult Index()
        {
            var categoryUids = materials.Select(m => m.CategoryUid).Distinct().ToList();
            Dictionary <Guid, string> categoryMap = FakeDataHelper.GetCategoryMap(categoryUids);

            return(View(index, (materials, categoryMap)));
        }
Beispiel #4
0
        public IActionResult Activate(Guid uid)
        {
            var category = FakeDataHelper.GetCategory(uid);

            category.Activation = true;
            FakeDataHelper.SetCategory(category);
            return(RedirectToAction("Index"));
        }
Beispiel #5
0
        public void Test()
        {
            var testResultMessage = FakeDataHelper.GetPassed_Failed_Ignored_Message();

            var parser = new TestDetailParser();

            var list = parser.CreateTestDetails(testResultMessage);

            Assert.Pass();
        }
Beispiel #6
0
        /// <summary>
        /// Fills the organizations, products and activity objects with data for the specified configuration
        /// </summary>
        /// <param name="conf"></param>
        public void GenerateFakeData(int numberOfFakeEntities)
        {
            var watch = System.Diagnostics.Stopwatch.StartNew();

            organizations = FakeDataHelper.GenerateOrganizations(numberOfFakeEntities);
            products      = FakeDataHelper.GenerateProducts(numberOfFakeEntities);
            activities    = FakeDataHelper.GenerateActivities(numberOfFakeEntities);
            locations     = FakeDataHelper.GenerateLocations(numberOfFakeEntities);
            watch.Stop();
            Console.WriteLine("Took " + watch.ElapsedMilliseconds + "ms to generate " + products.Count + " products of" + " fake data to insert into database");
        }
 public HttpStatusCode SetLayouts([FromQuery] string location, [FromBody] List <Core.Layout> layouts)
 {
     try
     {
         FakeDataHelper.SetLayouts(location, layouts);
         return(HttpStatusCode.OK);
     }
     catch (Exception ex)
     {
         // 記得寫LOG
         return(HttpStatusCode.InternalServerError);
     }
 }
Beispiel #8
0
        public void Should_Get_Test_Result_For_Failed_Ignored_Message()
        {
            var testResultMessage = FakeDataHelper.GetFailed_Ignored_Message();

            var messageParser = new MessageParser(new TestSummaryParser(), new TestDetailParser());

            var testResult = messageParser.GetTestResult(testResultMessage);

            var expectedResult = new TestSummary
            {
                TotalNumberOfTests   = 2,
                ProjectName          = "TestProjectUsedByAutoTestRunner.dll",
                NumberOfFailedTests  = 1,
                NumberOfIgnoredTests = 1,
                NumberOfPassedTests  = null,
                TimeTakenInSecond    = 1.7281m
            };

            testResult.Should().BeEquivalentTo(expectedResult);
        }
        public static void Initialise(IServiceProvider serviceProvider)
        {
            using (var context = new NoteTakerContext(serviceProvider.GetRequiredService <DbContextOptions <NoteTakerContext> >(), serviceProvider.GetRequiredService <IHttpContextAccessor>()))
            {
                if (context.Users.Any())
                {
                    return;
                }

                if (!context.Notes.Any())
                {
                    // password is apples
                    var user = new User("CallumBreen", "Callum", "Breen", "$2b$10$m59R6F0ubBmQKMxksCizJ.zdToQ5wCLdwTM3S1HA5GyqjwhmC5fri");

                    context.Users.Add(user);

                    var notes = FakeDataHelper.GetNotes(user, 200).ToList();

                    context.Notes.AddRange(notes);

                    context.SaveChanges();
                }
            }
        }
 public IActionResult Add(Material material)
 {
     FakeDataHelper.SetMaterial(material);
     return(RedirectToAction("Index"));
 }
Beispiel #11
0
 public IActionResult Add(Category category)
 {
     FakeDataHelper.SetCategory(category);
     return(RedirectToAction("Index"));
 }
Beispiel #12
0
 public RedirectToRouteResult CreateFakeEnterprise(bool modified)
 {
     FakeDataHelper.CreateFakeEnterprise(Db, modified);
     return(RedirectToAction("Index"));
 }
 public List <Core.Layout> GetLayouts(string location)
 {
     return(FakeDataHelper.GetLayouts(location));
 }