コード例 #1
0
        public void AddSail()
        {
            // Arrange
            var stubSails = new InMemoryDbSet<Sail>();
            var sail = new Sail() { Model = new SailModel { Name = "Dummy" }, Size = 4.7 };
            stubEntities.Sails = stubSails;

            // Act
            var sut = new EquipmentRepository(stubEntities, stubLogger);
            sut.AddSail(sail);

            // Assert
            Assert.AreEqual(1, stubSails.Count(), "Sails count incorrect");
        }
コード例 #2
0
        public void AddSail()
        {
            // Arrange
            int expected = _context.Sails.Count() + 1;
            var sail = new Sail() { Size = 4.7, Model = new SailModel() { Name = "Dummy", Manufacturer = _context.Manufacturers.Single(m => m.Name == "Tushingham") } };
            var sut = new EquipmentRepository(_context, _stubLogger);

            // Act
            sut.AddSail(sail);
            _context.Save();

            // Assert
            Assert.AreEqual(expected, _context.Sails.Count(), "Sails count incorrect");
        }
コード例 #3
0
 public Sail AddSail(Sail sail)
 {
     return Add(_context.Sails, sail, s => String.Compare(s.Model.Name, sail.Model.Name, true) == 0 && s.Size == sail.Size);
 }