コード例 #1
0
        public async Task GetAllTheRoutineCorrectly(int day)
        {
            //Arrange
            var context = await FakeData.InitializeContextAsync(true);

            Guid userId = new("72cd9667-8bcd-45c6-bc57-befa1de5422f");

            UnitOfWork = new(context);


            List <ExerciseToDoDto> exercisesExpected = new()
            {
                new ExerciseToDoDto()
                {
                    Id = new Guid("6d333d08-ca22-4865-a998-1f4fd8477970"), Name = "Cable Curl", ImageUrl = "https://www.mensjournal.com/wp-content/uploads/mf/three-way-finisher-chest-main.jpg?w=700&quality=86&strip=all"
                },
                new ExerciseToDoDto()
                {
                    Id = new Guid("152ba755-91ee-4dce-a30b-dc33550ca5ee"), Name = "Cable Hammer Curl", ImageUrl = "https://i3.ytimg.com/vi/Xm05VEYT09Y/hqdefault.jpg"
                },
                new ExerciseToDoDto()
                {
                    Id = new Guid("471c6e24-ece1-4fcd-9eab-e6ca0e8bd33c"), Name = "3-Way Finisher", ImageUrl = "https://www.mensjournal.com/wp-content/uploads/mf/three-way-finisher-chest-main.jpg?w=700&quality=86&strip=all"
                },
                new ExerciseToDoDto()
                {
                    Id = new Guid("fa37f4cb-54e9-44ed-9555-1400c93de5ae"), Name = "Barbell Bench Press", ImageUrl = "https://www.mensjournal.com/wp-content/uploads/mf/_main2_benchpress.jpg?w=700&quality=86&strip=all"
                }
            };

            //Act and Assert

            await UnitOfWork.SetsDetails.DeleteOldDetailsAsync();

            await UnitOfWork.CompleteAsync();

            int  exercise1RepetitionsLeft = 0;
            Guid lastExercise             = Guid.Empty;
            int  index = -1;

            for (int i = 0; i < 15; i++)
            {
                var result = await UnitOfWork.Routines.GetExerciseToDoFromRoutineAsync(userId, day);

                if ((lastExercise == Guid.Empty) || (lastExercise != result.Id))
                {
                    lastExercise             = result.Id;
                    exercise1RepetitionsLeft = result.SetsLeft;
                    index++;
                }

                Assert.Equal(exercisesExpected[index].Id, result.Id);
                Assert.Equal(exercisesExpected[index].Name, result.Name);
                Assert.Equal(exercisesExpected[index].ImageUrl, result.ImageUrl);
                Assert.Equal(exercise1RepetitionsLeft, result.SetsLeft);

                var e = await UnitOfWork.Routines.GetByIdAsync(result.Id);

                if (e.Exercise.SetDetail is not null)
                {
                    e.Exercise.SetDetail.SetsCompleted++;
                }

                if (e.Exercise.SetDetail is null)
                {
                    SetDetail sd = new() { Date = DateTime.UtcNow, SetsCompleted = 1 };
                    await UnitOfWork.SetsDetails.CreateAsync(sd);

                    e.Exercise.SetDetail = sd;
                }

                await UnitOfWork.CompleteAsync();

                exercise1RepetitionsLeft--;
            }
        }
コード例 #2
0
 public void CreatingDataToDbSetWontThrowException()
 {
     var fakeDbContext = new FakeDbContext();
     var fakeData = new FakeData(fakeDbContext);
 }
コード例 #3
0
 public void EnterSortName()
 {
     this.WaitForElementToBeVisible(sortNameLocator).SendKeys(FakeData.RandomFirstName());
 }
コード例 #4
0
 public void EnterEmail()
 {
     this.WaitForElementToBeVisible(emailLocator).SendKeys(FakeData.RandomEmailId());
 }
コード例 #5
0
 public void EnterUserName()
 {
     this.WaitForElementToBeVisible(userNameLocator).SendKeys(FakeData.RandomUserName());
 }
コード例 #6
0
 public void EnterDisplayName()
 {
     this.WaitForElementToBeVisible(displayNameLocator).SendKeys(FakeData.RandomFullName());
 }
コード例 #7
0
 public static Employee Create()
 {
     return(new Employee(Guid.NewGuid(), FakeData.Alpha(10), FakeData.Alpha(10)));
 }
コード例 #8
0
 public void EditFileName_on_DocumentViewer()
 {
     SelectAndDeleteCompleteText(driver.FindElement(By.XPath("//div[@class='form-group']/input")));
     this.WaitForElementToBeVisible(By.XPath("//div[@class='form-group']/input")).Click();
     this.WaitForElementToBeVisible(By.XPath("//div[@class='form-group']/input")).SendKeys(FakeData.Description() + ".doc");
     this.WaitForElementToBePresent(inlineSubmitLocator).Click();
 }
コード例 #9
0
 public void EditDescription()
 {
     SelectAndDeleteCompleteText(driver.FindElement(By.XPath("//div[@class='form-group']/textarea")));
     this.WaitForElementToBeVisible(By.XPath("//div[@class='form-group has-feedback has-error']/textarea")).Click();
     this.WaitForElementToBeVisible(By.XPath("//div[@class='form-group has-feedback has-error']/textarea")).SendKeys(FakeData.Description() + ".pdf");
     this.WaitForElementToBePresent(inlineSubmitLocator).Click();
 }
コード例 #10
0
 public InvoiceServiceTest()
 {
     _sessionsRepository        = new SessionsRepositoryFake(FakeData.GetSeedSessios());
     _parkingFacilityRepository = new ParkingFacilityRepositoryFake(FakeData.GetSeedServiceProfiles());
     _customerRepository        = new CustomerRepositoryFake(FakeData.GetSeedCustomers());
 }
コード例 #11
0
 public Task <TodoItem[]> GetOpenTodosAsync()
 {
     return(Task.FromResult(FakeData.GetTodos()));
 }