コード例 #1
0
        private Fixture CreateFixture(Fixture fixture)
        {
            var mongoDbDatabaseName = ConfigurationManager.AppSettings["MongoDBDatabaseName"];

            var database = _mongoServer.GetDatabase(mongoDbDatabaseName);

            var collection = database.GetCollection<Fixture>("fixtures");

            var id = Guid.NewGuid().ToString();
            fixture.Id = id;
            collection.Save(fixture);

            var createdFixture = collection.FindOneById(fixture.Id);
            
            //collection.RemoveAll();

            return createdFixture;
        }
コード例 #2
0
ファイル: UserTest.cs プロジェクト: vincentzh/Orleans_Demo
        public void CreateUser()
        {
            _fixture = new Fixture();

            _role = new Role {Name = _fixture.Create<string>()};

            _roleRepository.Save(_role);
            _user = new User {Name = _fixture.Create<string>()};

            _userRepository.Save(_user);

            _userRoleLink = new UserRoleLink(_user,_role);
            _userRoleLinkRepository.Save(_userRoleLink);
               _burrow.CloseWorkSpace();
            _burrow.InitWorkSpace();

            Assert.AreEqual(_userRepository.FindByRoleId(_role.Id).ToList().First(), _user);
        }