コード例 #1
0
        public void CreateStoryShouldAddNewStory()
        {
            // Arrange
            var repository = new StoryRepository();
            var expected = new Story
            {
                Name = "Story Test",
                ProjectName = "StoryMapper"
            };

            // Act
            var createdActual = repository.Create(expected);
            var obtainedActual = repository.Single(story => story.Name == expected.Name && story.ProjectName == expected.ProjectName);

            // Assert
            Assert.IsNotNull(createdActual);
            Assert.IsNotNull(obtainedActual);
            Assert.AreEqual(expected.Name, createdActual.Name);
            Assert.AreEqual(expected.Name, obtainedActual.Name);
            Assert.AreEqual(expected.ProjectName, createdActual.ProjectName);
            Assert.AreEqual(expected.ProjectName, obtainedActual.ProjectName);
        }
コード例 #2
0
        public void UpdateStoryShouldModifyValues()
        {
            // Arrange
            var dataList = this.GetMockDataList();
            var repository = new StoryRepository(dataList);
            var expected = dataList[0];
            expected.Name = "Updated Name";
            expected.ProjectName = "Updated Project";

            // Act
            var updatedActual = repository.Update(expected);
            var obtainedActual = repository.Single(story => story.Name == expected.Name && story.ProjectName == expected.ProjectName);

            // Assert
            Assert.IsNotNull(updatedActual);
            Assert.IsNotNull(obtainedActual);
            Assert.AreEqual(expected.Name, updatedActual.Name);
            Assert.AreEqual(expected.Name, obtainedActual.Name);
            Assert.AreEqual(expected.ProjectName, updatedActual.ProjectName);
            Assert.AreEqual(expected.ProjectName, obtainedActual.ProjectName);
        }
コード例 #3
0
        public void GetSingleShouldReturnSingleStory()
        {
            // Arrange
            var dataList = this.GetMockDataMultiProjectList();
            var expectedStoryName = "Test Story 1";
            var expectedProjectName = "StoryMapper";
            StoryRepository repository;

            // Act
            repository = new StoryRepository(dataList);
            var actual = repository.Single(story => story.Name == expectedStoryName && story.ProjectName == expectedProjectName);

            // Assert
            Assert.IsNotNull(actual);
            Assert.AreEqual(expectedStoryName, actual.Name);
            Assert.AreEqual(expectedProjectName, actual.ProjectName);
        }