示例#1
0
        public void DeleteEnergySourceById_Success_Test()
        {
            // Arrange
            int id = 1;

            // create mock for repository
            var mock = new Mock <IEnergySourceRepository>();

            mock.Setup(s => s.DeleteEnergySource(Moq.It.IsAny <int>())).Verifiable();

            // service
            EnergySourceService energySourceService = new EnergySourceService();

            EnergySourceService.Repository = mock.Object;

            // Act
            energySourceService.DeleteEnergySource(id);

            // Assert
            Assert.IsTrue(true);
        }
示例#2
0
        public void DeleteEnergySource_Success_Test()
        {
            // Arrange
            EnergySourceDTO dto = SampleEnergySourceDTO(1);

            dto.IsDeleted = false;

            // create mock for repository
            var mock = new Mock <IEnergySourceRepository>();

            mock.Setup(s => s.DeleteEnergySource(Moq.It.IsAny <R_EnergySource>())).Verifiable();

            // service
            EnergySourceService energySourceService = new EnergySourceService();

            EnergySourceService.Repository = mock.Object;

            // Act
            energySourceService.DeleteEnergySource(dto);

            // Assert
            Assert.IsTrue(true);
        }