public void SaveReading(ReadingInfo readingInfo)
 {
     Entities entities = new Entities();
     entities.Readings.Add(new Readings
     {
         Tag = readingInfo.Tag,
         Reader = readingInfo.Reader,
         ReadingDateTIme = readingInfo.ReadingDateTime
     });
     entities.SaveChanges();
 }
        private ReadingInfo GetReadingInfo(string weft)
        {
            var readingInfo = new ReadingInfo
            {
                Reader = GetReader(weft),
                Tag = GetTag(weft),
                ReadingDateTime = DateTime.Now
            };

            return readingInfo;
        }
 public void SaveReading(ReadingInfo readingInfo)
 {
     IMongoCollection<BsonDocument> collection = _db.GetCollection<BsonDocument>("readings");
     BsonDocument document = new BsonDocument
     {
         { "reader", readingInfo.Reader },
         { "tag", readingInfo.Tag },
         { "date", ConvertDateToJsDate(readingInfo.ReadingDateTime) }
     };
     collection.InsertOne(document);
 }
Example #4
0
        public void SaveInfomation()
        {
            //Arrange
            ReadingInfo readingInfo = new ReadingInfo();
            dataAccessMock.Setup(d => d.SaveReading(It.IsAny<ReadingInfo>()));

            //Act
            StorageStatus result = storage.SaveReading(readingInfo);

            //Assert
            Assert.AreEqual(StorageStatus.Saved, result);
            dataAccessMock.VerifyAll();
        }
Example #5
0
 public StorageStatus SaveReading(ReadingInfo information)
 {
     _dataAccess.SaveReading(information);
     return StorageStatus.Saved;
 }