Пример #1
0
 public void ToDocument_RentalWithId()
 {
     var rental = new Rental();
     rental.Id = ObjectId.GenerateNewId().ToString();
     var document = rental.ToBsonDocument();
     Expect(document["_id"].BsonType, Is.EqualTo(BsonType.ObjectId));
 }
Пример #2
0
        public void ToDocument_RentalWithPrice()
        {
            var rental = new Rental();
            rental.Price = 1;

            var document = rental.ToBsonDocument();
            Expect(document["Price"].BsonType, Is.EqualTo(BsonType.Double));
        }
 public void ToDocument_RentalWithAnId_IdIsRepresentedAsAnObjectId()
 {
     var rental = new Rental
     {
         Id = ObjectId.GenerateNewId().ToString()
     };
     var document = rental.ToBsonDocument();
     Expect(document["_id"].BsonType, Is.EqualTo(BsonType.ObjectId));
 }
Пример #4
0
        public void ToDocument_RentalWithPrice_PriceRepresentedAsDouble()
        {
            // Arrange
            var rental = new Rental();
            rental.Price = 1;

            // Act
            var document = rental.ToBsonDocument();

            // Assert
            Assert.AreEqual(document["Price"].BsonType, BsonType.Double);
        }
Пример #5
0
        public void ToDocument_RentalWithAnId_IdIsRepresentedAsAnObjectId()
        {
            // Arrange
            var rental = new Rental();
            rental.Id = ObjectId.GenerateNewId().ToString();

            // Act
            var document = rental.ToBsonDocument();

            // Assert
            Assert.AreEqual(document["_id"].BsonType, BsonType.ObjectId);
        }
Пример #6
0
 public async Task<ActionResult> Post(PostRental postRental)
 {
     var rental = new Rental(postRental);
     await Context.Rentals.InsertOneAsync(rental);
     return RedirectToAction("Index");
 }
 // METHOD_SCENARIO_EXPECTATION
 public void ToDocument_RentalWithPrice_PriceRepresentedAsDouble()
 {
     var rental = new Rental{Price = 1};
     var document = rental.ToBsonDocument();
     Expect(document["Price"].BsonType, Is.EqualTo(BsonType.Double));
 }
Пример #8
0
 public ActionResult Post(PostRental postRental)
 {
     var rental = new Rental(postRental);
     Context.Rentals.Insert(rental);
     return RedirectToAction("Index");
 }
Пример #9
0
        public void SetRentalImageId(Rental rental, string imageId)
        {
            UpdateDefinition <Rental> updateDefinition = Builders <Rental> .Update.Set(r => r.ImageId, imageId);

            _repo.UpdateProperty(rental.Id, updateDefinition);
        }
Пример #10
0
 public ReplaceOneResult UpdateRental(Rental rental)
 {
     return(_repo.Update(rental));
 }
Пример #11
0
 public void AddRental(Rental rental)
 {
     _repo.AddRental(rental);
 }
Пример #12
0
 public ReplaceOneResult Update(Rental rental)
 {
     return(_context.Rentals.ReplaceOne(x => x.Id == rental.Id, rental));
 }
Пример #13
0
 public void AddRental(Rental rental)
 {
     _context.Rentals.InsertOne(rental);
 }