Exemple #1
0
        public void GetShareIDTest()
        {
            // Arrange
            var shareRepositoryMock = Substitute.For <ISharesRepository>();

            var sut = new ShareManager(shareRepositoryMock);

            string shareType = "Umbrella";

            shareRepositoryMock
            .IsShareExist(Arg.Is <string>(shareType))
            .Returns(true);

            // Act
            sut.GetShareID(shareType);

            // Asserts
            shareRepositoryMock.Received(1).GetShareID(Arg.Is <string>(shareType));
        }
        public void ShouldThrowExceptionWhileGettingShareIDDidntExist()
        {
            // Arrange
            var shareRepositoryMock = Substitute.For <ISharesRepository>();

            var sut = new ShareManager(shareRepositoryMock);

            string shareType = "Umbrella";

            shareRepositoryMock
            .IsShareExist(Arg.Is <string>(shareType))
            .Returns(false);

            // Act
            sut.GetShareID(shareType);

            // Asserts
            shareRepositoryMock.DidNotReceive().GetShareID(Arg.Is <string>(shareType));
        }