Beispiel #1
0
        public void ArtistDelete_NonExistingEntity()
        {
            // Arrange
            var mockEntities = new List <Artist>()
            {
                new Artist()
                {
                    Id = 1, Name = "Entity1"
                },
                new Artist()
                {
                    Id = 2, Name = "Entity2"
                },
                new Artist()
                {
                    Id = 3, Name = "Entity3"
                }
            };

            ArtistService artistServiceUnderTest = ArtistServiceMockedContext.GetArtistServiceUnderTest(mockEntities);
            int           entityIdToBeDeleted    = 4;

            // Assert
            Assert.That(() => artistServiceUnderTest.Delete(entityIdToBeDeleted), Throws.Exception);
        }
Beispiel #2
0
        public void ArtistCreate_ExistingName()
        {
            // Arrange
            var mockEntities = new List <Artist>()
            {
                new Artist()
                {
                    Id = 1, Name = "Entity1"
                },
                new Artist()
                {
                    Id = 2, Name = "Entity2"
                },
                new Artist()
                {
                    Id = 3, Name = "Entity3"
                }
            };

            ArtistService artistServiceUnderTest = ArtistServiceMockedContext.GetArtistServiceUnderTest(mockEntities);
            ArtistModel   model = new ArtistModel()
            {
                Name = "Entity1"
            };

            // Act
            bool result = artistServiceUnderTest.Create(model);

            // Assert
            Assert.AreEqual(result, false);
        }