Пример #1
0
        public void Returns_Valid_Temperatures_Object()
        {
            MongoServer mongoServerMock = MockRepository.GeneratePartialMock<MongoServer>(new MongoServerSettings());
            MongoDatabase mongoDatabaseMock = MockRepository.GeneratePartialMock<MongoDatabase>(mongoServerMock, "inferno", new MongoDatabaseSettings());
            mongoServerMock.Stub(ms => ms.GetDatabase("inferno")).Return(mongoDatabaseMock);
            mongoDatabaseMock.Stub(mdb => mdb.GetCollection("temperatures")).Return(null);
            List<BsonDocument> collection = GetCollectionToReturn();

            InfernoMongoStub target = new InfernoMongoStub("cstr", mongoServerMock, collection);

            foreach (var r in target.GetRows(1))
            {
                Assert.IsInstanceOf(typeof(Temperatures), r);
                Assert.AreEqual("10.0", r.Buffer);
                Assert.AreEqual("10.1", r.BusFeed);
                Assert.AreEqual("10.2", r.BusReturn);
                Assert.AreEqual("10.3", r.FloorFeed);
                Assert.AreEqual("10.4", r.FloorReturn);
                Assert.AreEqual("10.5", r.HeaterFeed);
                Assert.AreEqual("10.6", r.HeaterReturn);
                Assert.AreEqual("10.7", r.Outside);
                Assert.AreEqual("10.8", r.SystemFeed);
                Assert.AreEqual("10.9", r.SystemReturn);
                Assert.AreEqual(new DateTime(2014, 9, 17), r.UpdatedAt);
                Assert.AreEqual("11.1", r.WaterFeed);
                Assert.AreEqual("11.2", r.WaterReturn);

                break;
            }
        }
Пример #2
0
        public void Uses_Temperatures_Collection_Of_Inferno_Database()
        {
            MongoServer mongoServerMock = MockRepository.GeneratePartialMock<MongoServer>(new MongoServerSettings());
            MongoDatabase mongoDatabaseMock = MockRepository.GeneratePartialMock<MongoDatabase>(mongoServerMock, "inferno", new MongoDatabaseSettings());
            mongoServerMock.Expect(ms => ms.GetDatabase("inferno")).Return(mongoDatabaseMock);
            mongoDatabaseMock.Expect(mdb => mdb.GetCollection("temperatures")).Return(null);

            InfernoMongoStub target = new InfernoMongoStub("cstr", mongoServerMock, new List<BsonDocument>());
            foreach(var r in target.GetRows(1))
            {
                break;
            }
            
            mongoServerMock.VerifyAllExpectations();
        }