コード例 #1
0
        public void ShouldAddNewIssuer()
        {
            //Arrange
            var           issuerTableRepository = Substitute.For <ITableRepository <Issuer> >();
            IssuerService issuerService         = new IssuerService(issuerTableRepository);
            IssuerInfo    companyInfo           = new IssuerInfo
            {
                CompanyName = "PJSC KorolevaS Company",
                Address     = "Lemesos"
            };

            //Act
            issuerService.AddIssuer(companyInfo);
            //Assert
            issuerTableRepository.Received(1).Add(Arg.Is <Issuer>(
                                                      w => w.CompanyName == "PJSC KorolevaS Company" && w.Address == "Lemesos"));
        }
コード例 #2
0
        public void ShouldNotRegisterNewIssuerIfItExists()
        {
            // Arrange
            var           issuerTableRepository = Substitute.For <ITableRepository <Issuer> >();
            IssuerService issuerService         = new IssuerService(issuerTableRepository);
            IssuerInfo    companyInfo           = new IssuerInfo
            {
                CompanyName = "PJSC KorolevaS Company",
                Address     = "Lemesos"
            };

            // Act
            issuerService.AddIssuer(companyInfo);

            issuerTableRepository.ContainsDTO(Arg.Is <Issuer>(
                                                  w => w.CompanyName == companyInfo.CompanyName &&
                                                  w.Address == companyInfo.Address)).Returns(true);

            issuerService.AddIssuer(companyInfo);
        }