Inheritance: System.Entity
Beispiel #1
0
        public static Project GetExample()
        {
            var user = new User(Guid.NewGuid(), "name", "email", new EncryptedPassword("password"));
            var project = new Project(Guid.NewGuid(), "Test Project", user);
            Guid storyId = Guid.NewGuid();
            project.AddStory(user.Id, storyId, "User get projects");
            Guid scenarioId = Guid.NewGuid();
            project.AddScenario(user.Id, scenarioId, storyId, "Happy Path");
            Guid givenId = Guid.NewGuid();
            project.AddGivenCriterion(user.Id, scenarioId, givenId, "an authorized user", ScenarioRunsIn.Api);
            project.AddApiPostStep(user.Id, givenId, Guid.NewGuid(), Host, "login",
                new Dictionary<string, object> { { "email", "*****@*****.**" }, { "password", "password" } }, "login", new List<HttpRequestOption>());

            Guid whenId = Guid.NewGuid();
            project.AddWhenCriterion(user.Id, scenarioId, whenId, "requesting a list of project", ScenarioRunsIn.Api);
            project.AddApiGetStep(user.Id, whenId, Guid.NewGuid(), Host, "api/projects/MyAdministratorProjects", "projects",
                new List<HttpRequestOption>
                {
                    new HttpHeader(Guid.NewGuid(), "Authorization", "Bearer {login.token}")
                });

            Guid thenId = Guid.NewGuid();
            project.AddThenCriterion(user.Id, scenarioId, thenId, "should have a list of projects", ScenarioRunsIn.Api);
            project.AddJavascriptAssert(user.Id, Guid.NewGuid(), thenId, "projects[0].name=='Byron3'");

            return project;
        }
        public UserLoginSession Create(User executor)
        {
            DateTime dateTime = _tokenExpirationProvider.GetExpiration(_timeProvider.Now());
            Guid token = _identityGenerator.Generate();

            var userSession = new UserLoginSession(token, executor, dateTime);

            _writeableRepository.Create(userSession);

            return userSession;
        }
 public IEnumerable<Project> GetForUser(User user)
 {
     return _readOnlyRepository.Query<Collaborator>(x => x.UserId == user.Id).Select(x => x.Project);
 }
 public UserLoginSession(Guid token, User user, DateTime expires)
 {
     Id = token;
     User = user;
     Expires = expires;
 }