public CityManagementTests()
 {
     _city = new City
     {
         Name = UniqueUtils.MakeUnique("Karaganda")
     };
 }
        public async Task InitializeAsync()
        {
            _user = new User
            {
                FirstName = "Alexey",
                LastName  = "Gaiist",
                IsBlocked = false,
                Password  = "******",
                Role      = Role.HR,
                Username  = UniqueUtils.MakeUnique("akirinyuk")
            };

            _city = new City
            {
                Name = UniqueUtils.MakeUnique("Karaganda")
            };

            _city.Id = (await Bus.Request(new CreateCity {
                City = _city
            })).CityId;
            _user.Id = (await Bus.Request(new AddUser {
                User = _user
            })).UserId;

            _team = new Team
            {
                Title      = UniqueUtils.MakeUnique("Alexey Kirinyuk team"),
                CityId     = _city.Id,
                TeamLeadId = _user.Id,
                IsBlocked  = false
            };
        }
Example #3
0
        public async Task <JobPosition> CreateJobPosition()
        {
            var jobPosition = new JobPosition
            {
                Title    = UniqueUtils.MakeUnique("Junior Java Developer"),
                Template = new Template
                {
                    Description = "Please, answer on questions",
                    Questions   = new Question[]
                    {
                        new GeneralQuestion
                        {
                            Title            = "How are you?",
                            Description      = "Please, describe your filling.",
                            OrderIndex       = 0,
                            MaxAnswerSeconds = 50
                        },
                        new InputQuestion
                        {
                            Title            = "1 + 2",
                            Description      = "Please answer:",
                            OrderIndex       = 1,
                            CorrectAnswer    = "3",
                            MaxAnswerSeconds = 50
                        },
                        new SelectQuestion
                        {
                            Title       = "1 + 3",
                            Description = "Please selectамана",
                            OrderIndex  = 2,
                            Options     = new[]
                            {
                                new Option {
                                    Title = "4", IsCorrect = true
                                },
                                new Option {
                                    Title = "5", IsCorrect = false
                                },
                                new Option {
                                    Title = "4.0", IsCorrect = true
                                }
                            },
                            OneCorrectAnswer = false,
                            MaxAnswerSeconds = 50
                        }
                    }
                }
            };

            jobPosition.Id = (await _bus.Request(new CreateJobPosition {
                JobPosition = jobPosition
            }))
                             .JobPositionId;

            return(jobPosition);
        }
Example #4
0
 public UserManagementTests()
 {
     _testUser = new User
     {
         FirstName = "Alexey",
         LastName  = "Gaiist",
         IsBlocked = false,
         Password  = "******",
         Role      = Role.HR,
         Username  = UniqueUtils.MakeUnique("akirinyuk")
     };
 }
        public async Task Update()
        {
            _jobPosition.Id = (await Bus.Request(new CreateJobPosition {
                JobPosition = _jobPosition
            }))
                              .JobPositionId;
            _jobPosition.Title    = UniqueUtils.MakeUnique("New Title");
            _jobPosition.Template = new Template
            {
                Description = "Changed Description",
                Questions   = new Question[]
                {
                    new GeneralQuestion
                    {
                        Title            = "New Question",
                        Description      = "New Description",
                        OrderIndex       = 1,
                        MaxAnswerSeconds = 60
                    },
                    new InputQuestion
                    {
                        Title            = "Changed Question",
                        Description      = "Changed Description",
                        CorrectAnswer    = "Changed Answer",
                        OrderIndex       = 2,
                        MaxAnswerSeconds = 60
                    }
                }
            };

            await Bus.Request(new UpdateJobPosition { JobPosition = _jobPosition });

            var receivedJobPosition = (await Bus.Execute(new GetJobPosition {
                JobPositionId = _jobPosition.Id.Value
            }))
                                      .JobPosition;

            receivedJobPosition.Should()
            .BeEquivalentTo(_jobPosition);

            var allPositions = (await Bus.Execute(new SearchJobPositions()))
                               .Items;

            allPositions
            .Should()
            .ContainSingle(p => p.JobPositionId == _jobPosition.Id.Value);

            var position = allPositions.Single(p => p.JobPositionId == _jobPosition.Id.Value);

            position.Title.Should().Be(_jobPosition.Title);
        }
Example #6
0
        public async Task <City> CreateCity()
        {
            var city = new City
            {
                Name = UniqueUtils.MakeUnique("Novosibirsk")
            };

            city.Id = (await _bus.Request(new CreateCity {
                City = city
            }))
                      .CityId;

            return(city);
        }
 public JobPositionManagementTests()
 {
     _jobPosition = new JobPosition
     {
         Title    = UniqueUtils.MakeUnique("Junior Java Developer"),
         Template = new Template
         {
             Description = "Please, answer on questions",
             Questions   = new Question[]
             {
                 new GeneralQuestion
                 {
                     Title            = "How are you?",
                     Description      = "Please, describe your filling.",
                     OrderIndex       = 0,
                     MaxAnswerSeconds = 60
                 },
                 new InputQuestion
                 {
                     Title            = "1 + 2",
                     Description      = "Please answer:",
                     OrderIndex       = 1,
                     CorrectAnswer    = "3",
                     MaxAnswerSeconds = 60
                 },
                 new SelectQuestion
                 {
                     Title       = "1 + 3",
                     Description = "Some Description",
                     OrderIndex  = 2,
                     Options     = new[]
                     {
                         new Option {
                             Title = "4", IsCorrect = true
                         },
                         new Option {
                             Title = "5", IsCorrect = false
                         },
                         new Option {
                             Title = "4.0", IsCorrect = true
                         }
                     },
                     OneCorrectAnswer = false,
                     MaxAnswerSeconds = 60
                 }
             }
         }
     };
 }
Example #8
0
        public async Task <Team> CreateTeam(User teamLead, City city)
        {
            var team = new Team
            {
                Title      = UniqueUtils.MakeUnique("Alexey Kirinyuk team"),
                CityId     = city.Id,
                TeamLeadId = teamLead.Id,
                IsBlocked  = false
            };

            team.Id = (await _bus.Request(new CreateTeam {
                Team = team
            }))
                      .TeamId;

            return(team);
        }
        public async Task Update()
        {
            _team.Id = (await Bus.Request(new CreateTeam {
                Team = _team
            }))
                       .TeamId;

            _user = new User
            {
                FirstName = "Roman",
                LastName  = "Gusev",
                IsBlocked = false,
                Password  = "******",
                Role      = Role.TeamLead,
                Username  = UniqueUtils.MakeUnique("rgusev")
            };
            _user.Id = (await Bus.Request(new AddUser {
                User = _user
            })).UserId;

            _city = new City
            {
                Name = UniqueUtils.MakeUnique("Novosibirsk")
            };
            _city.Id = (await Bus.Request(new CreateCity {
                City = _city
            })).CityId;

            _team.Title      = UniqueUtils.MakeUnique("New Team Title");
            _team.CityId     = _city.Id;
            _team.TeamLeadId = _user.Id;
            _team.IsBlocked  = true;

            await Bus.Request(new UpdateTeam { Team = _team });

            (await Bus.Execute(new GetTeam {
                TeamId = _team.Id.Value
            }))
            .Team
            .Should()
            .BeEquivalentTo(_team);

            await AssertSearchResults();
        }
Example #10
0
        public async Task <User> CreateUser()
        {
            var user = new User
            {
                FirstName = "Alexey",
                LastName  = "Gaiist",
                IsBlocked = false,
                Password  = "******",
                Role      = Role.HR,
                Username  = UniqueUtils.MakeUnique("akirinyuk")
            };

            user.Id = (await _bus.Request(new AddUser {
                User = user
            }))
                      .UserId;

            return(user);
        }
        public async Task Update()
        {
            _city.Id = (await Bus.Request(new CreateCity {
                City = _city
            })).CityId;

            _city.Name = UniqueUtils.MakeUnique("Moskow");
            var updateCity = new UpdateCity {
                City = _city
            };
            await Bus.Request(updateCity);

            (await Bus.Execute(new GetCity {
                CityId = _city.Id
            }))
            .City
            .Should()
            .BeEquivalentTo(_city);

            await AssertHasInSearchResults();
        }
Example #12
0
        public async Task Update()
        {
            // Given There is User was created and updated
            _testUser.Id = (await Bus.Request(new AddUser {
                User = _testUser
            }))
                           .UserId;
            _testUser.FirstName = "Roman";
            _testUser.IsBlocked = true;
            _testUser.LastName  = "Antonov";
            _testUser.Password  = "******";
            _testUser.Role      = Role.TeamLead;
            _testUser.Username  = UniqueUtils.MakeUnique("rantonov");

            await Bus.Request(new UpdateUser { User = _testUser });

            // When I receive user info
            var receivedUser = (await Bus.Execute(new GetUser {
                UserId = _testUser.Id.Value
            }))
                               .User;

            // Then User data should be updated
            receivedUser.Should()
            .BeEquivalentTo(_testUser);

            // When I search Users by new Username
            var searchUsers = (await Bus.Execute(new SearchUsers {
                Username = _testUser.Username
            }))
                              .Items;

            // Then only one User was received
            searchUsers
            .Should()
            .HaveCount(1);

            AssertSearchUserItemEqualUser(searchUsers);
        }
Example #13
0
        public async Task InitializeAsync()
        {
            var teamLead = await TestApi.CreateUser();

            var city = await TestApi.CreateCity();

            var team = await TestApi.CreateTeam(teamLead, city);

            _firstQuestion = new GeneralQuestion
            {
                Title            = "How are you?",
                Description      = "Please, describe your filling.",
                OrderIndex       = 0,
                MaxAnswerSeconds = 60
            };
            _secondQuestion = new InputQuestion
            {
                Title            = "1 + 2",
                Description      = "Please answer:",
                OrderIndex       = 1,
                CorrectAnswer    = "3",
                MaxAnswerSeconds = 60
            };
            _thirdQuestion = new SelectQuestion
            {
                Title       = "1 + 3",
                Description = "Please select one of the following:",
                OrderIndex  = 2,
                Options     = new[]
                {
                    new Option {
                        Title = "4", IsCorrect = false
                    },
                    new Option {
                        Title = "5", IsCorrect = false
                    },
                    new Option {
                        Title = "4.0", IsCorrect = true
                    }
                },
                OneCorrectAnswer = true,
                MaxAnswerSeconds = 60
            };
            var jobPosition = new JobPosition
            {
                Title    = UniqueUtils.MakeUnique("Junior Java Developer"),
                Template = new Template
                {
                    Description = "Please, answer on questions",
                    Questions   = new Question[]
                    {
                        _firstQuestion,
                        _secondQuestion,
                        _thirdQuestion
                    }
                }
            };

            jobPosition.Id = (await Bus.Request(new CreateJobPosition {
                JobPosition = jobPosition
            }))
                             .JobPositionId;

            _vacancyId = (await TestApi.CreateVacancy(jobPosition, team)).Id.Value;
        }