public void GetAll_IncludeTrashed_IncludesTrashedNodes() { //arrange var sectionNodeDbSet = new InMemoryDbSet <SectionNode> { new SectionNode { Id = 1, InTrash = true }, new SectionNode { Id = 2, InTrash = true }, new SectionNode { Id = 3, InTrash = false }, new SectionNode { Id = 4, InTrash = false } }; _dbContextMock.Setup(x => x.GetDbSet <SectionNode>()).Returns(sectionNodeDbSet); //act var sectionNodes = _sectionNodeService.GetAll(true); //assert sectionNodes.Count().Should().Equals(sectionNodeDbSet.Count()); }
public void AddsNewPoll() { Guid pollId = new Guid("00DB2F1B-C4F5-44D3-960C-386CEB9690C4"); var existingPoll = new Poll() { CreatorIdentity = UserId1, UUID = pollId }; var dbPolls = new InMemoryDbSet <Poll>(clearDownExistingData: true) { existingPoll }; IContextFactory mockContextFactory = CreateContextFactory(dbPolls); DashboardController controller = CreateDashboardController(mockContextFactory); controller.User = CreateAuthenticatedUser(UserId1); var request = new CopyPollRequestModel() { UUIDToCopy = pollId }; controller.Copy(request); Assert.AreEqual(2, dbPolls.Count()); }
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"); }
public void AddManufacturer() { // Arrange var stubManufacturers = new InMemoryDbSet<Manufacturer>(); var manufacturer = new Manufacturer() { Name = "Dummy" }; stubEntities.Manufacturers = stubManufacturers; // Act var sut = new EquipmentRepository(stubEntities, stubLogger); sut.AddManufacturer(manufacturer); // Assert Assert.AreEqual(1, stubManufacturers.Count(), "Manufacturers count incorrect"); }
public void AddBoard() { // Arrange var stubBoards = new InMemoryDbSet<Board>(); var board = new Board() { Model = new BoardModel { Name = "Dummy" }, Volume = 1 }; stubEntities.Boards = stubBoards; // Act var sut = new EquipmentRepository(stubEntities, stubLogger); sut.AddBoard(board); // Assert Assert.AreEqual(1, stubBoards.Count(), "Boards count incorrect"); }
public void Create_adds_an_item_to_db() { _sut.Create("Hans", "Hanson", "*****@*****.**"); Assert.That(_inMemoryDbSet.Count(), Is.EqualTo(4), "Create should add an item to DB"); }