private void CreateOuUsers(string ldapPath, List <AdUser> users, int deptId) { var deptUsers = users.Where(p => p.DepartmentId == deptId).ToList(); foreach (var item in deptUsers) { var newUser = new DomainUser(); newUser.User = new DomainUser.UserInfo() { Description = item.UserName, UserName = item.UserName, OfficeEMailAddress = item.Email }; newUser.Account = new DomainUser.AccountInfo() { Password = "******", UserAccount = item.UserCode, SamAccountName = item.UserCode, UserPrincipalName = $"{item.UserCode}@{AdAdminConfig.Ladp}" }; DomainUtility.InsertUser(ldapPath, newUser, new DomainUser { Account = new DomainUser.AccountInfo() { UserAccount = AdAdminConfig.AdminAccount, Password = AdAdminConfig.AdminPwd } }); } }
public static Dictionary <string, string> Find(string body, string url, List <string> userNames, List <DomainData> socialDomains, bool returnOnlyNone200 = true) { Dictionary <string, string> foundUrls = new Dictionary <string, string>(); LinkParser parser = new LinkParser(); parser.ParseLinksAgility(body, url, true); foreach (Request foundUrl in parser.GoodUrls) { string foundURL = DomainUtility.StripProtocol(foundUrl.Url.Split('?')[0]); if (SocialDomainUtility.CheckIfSocialMediaSite(foundURL, socialDomains)) { if (userNames.Count == 0) { if (!foundUrls.ContainsKey(foundURL)) { Request request = new Request(DomainUtility.EnsureHTTPS(foundURL)); RequestUtility.GetWebText(request); if (!request.Response.Code.Equals("200") || request.Url.Contains("buymethat")) { foundUrls.Add(foundURL, url); } else if (!returnOnlyNone200) { foundUrls.Add(foundURL, url); } } } else { foreach (string userName in userNames) { if (foundURL.ToLower().Contains(userName.ToLower())) { if (!foundUrls.ContainsKey(foundURL)) { if (Ignore.Contains(foundURL.ToLower())) { continue; } Request request = new Request(DomainUtility.EnsureHTTPS(foundURL)); RequestUtility.GetWebText(request); if (!request.Response.Code.Equals("200") || request.Url.Contains("buymethat")) { foundUrls.Add(foundURL, url); } else if (!returnOnlyNone200) { foundUrls.Add(foundURL, url); } } } } } } } return(foundUrls); }
public void InsertUserTest() { DomainUser newUser = new DomainUser(); newUser.User = new DomainUser.UserInfo() { UserName = "******", Name = "liu dehua", DisplayName = "liu dehua", Description = "刘德华", GivenName = "DeHua", LastName = "Liu", OfficeEMailAddress = "*****@*****.**" }; newUser.Account = new DomainUser.AccountInfo() { UserAccount = @"*****@*****.**", Password = "******", SamAccountName = "BG00012", UserPrincipalName = "*****@*****.**" }; DomainUtility.InsertUser("LDAP://10.45.9.11/ou=102_GMO,ou=pphbh.com,dc=ops,dc=net", newUser, new DomainUser() { Account = new DomainUser.AccountInfo() { UserAccount = config.AdminAccount, Password = config.AdminPwd } }); }
public void ReturnsProperBytesCount() { //Arrange var forsendelse = DomainUtility.GetDigitalDigitalPostWithNotificationMultipleDocumentsAndHigherSecurity(); var manifest = new Manifest(forsendelse); var cryptographicCertificate = forsendelse.PostInfo.Mottaker.Sertifikat; var signature = new Signature(forsendelse, manifest, DomainUtility.GetAvsenderCertificate()); var asiceAttachables = new List <IAsiceAttachable>(); asiceAttachables.AddRange(forsendelse.Dokumentpakke.Vedlegg); asiceAttachables.Add(forsendelse.Dokumentpakke.Hoveddokument); asiceAttachables.Add(manifest); asiceAttachables.Add(signature); var asiceArchive = new AsiceArchive(cryptographicCertificate, new GuidUtility(), new List <AsiceAttachableProcessor>(), asiceAttachables.ToArray()); var expectedBytesCount = 0L; foreach (var dokument in asiceAttachables) { expectedBytesCount += dokument.Bytes.Length; } //Act var actualBytesCount = asiceArchive.UnzippedContentBytesCount; //Assert Assert.Equal(expectedBytesCount, actualBytesCount); }
public List <sysBpmsDocumentDef> GetList(Guid?DocumentFolderID, string NameOf, string DisplayName, bool?IsActive, bool?IsSystemic, PagingProperties currentPaging) { NameOf = DomainUtility.toString(NameOf); DisplayName = DomainUtility.toString(DisplayName); List <sysBpmsDocumentDef> retVal; var query = this.Context.sysBpmsDocumentDefs.Where(d => (NameOf == string.Empty || d.NameOf.Contains(NameOf)) && (DisplayName == string.Empty || d.DisplayName.Contains(DisplayName)) && (!IsSystemic.HasValue || d.IsSystemic == IsSystemic) && (!IsActive.HasValue || d.IsActive == IsActive) && (!DocumentFolderID.HasValue || d.DocumentFolderID == DocumentFolderID)); if (currentPaging != null) { currentPaging.RowsCount = query.Count(); if (Math.Ceiling(Convert.ToDecimal(currentPaging.RowsCount) / Convert.ToDecimal(currentPaging.PageSize)) < currentPaging.PageIndex) { currentPaging.PageIndex = 1; } retVal = query.OrderByDescending(p => p.DisplayName).Skip((currentPaging.PageIndex - 1) * currentPaging.PageSize).Take(currentPaging.PageSize).ToList(); } else { retVal = query.OrderBy(c => c.DisplayName).ToList(); } return(retVal); }
public void ConstructorGeneratesBytes() { //Arrange var message = new Forsendelse(DomainUtility.GetAvsender(), DomainUtility.GetDigitalPostInfoSimple(), DomainUtility.GetDokumentpakkeWithMultipleVedlegg()); var asiceArchive = DomainUtility.GetAsiceArchive(message); //Act var archiveBytes = asiceArchive.UnencryptedBytes; //Assert using (var memoryStream = new MemoryStream(archiveBytes)) { using (var archive = new ZipArchive(memoryStream, ZipArchiveMode.Read)) { Assert.True(archive.Entries.Any(entry => entry.FullName == "manifest.xml")); Assert.True(archive.Entries.Any(entry => entry.FullName == "META-INF/signatures.xml")); Assert.True(archive.Entries.Any(entry => entry.FullName == message.Dokumentpakke.Hoveddokument.Filnavn)); foreach (var document in message.Dokumentpakke.Vedlegg) { Assert.True(archive.Entries.Any(entry => entry.FullName == document.Filnavn)); } } } }
public void InitializesFieldsProperly() { //Arrange var forsendelse = DomainUtility.GetDigitalDigitalPostWithNotificationMultipleDocumentsAndHigherSecurity(); var manifest = new Manifest(forsendelse); var cryptographicCertificate = forsendelse.PostInfo.Mottaker.Sertifikat; var signature = new Signature(forsendelse, manifest, DomainUtility.GetAvsenderCertificate()); var asiceAttachables = new List <IAsiceAttachable>(); asiceAttachables.AddRange(forsendelse.Dokumentpakke.Vedlegg); asiceAttachables.Add(forsendelse.Dokumentpakke.Hoveddokument); asiceAttachables.Add(manifest); asiceAttachables.Add(signature); var asiceAttachablesArray = asiceAttachables.ToArray(); var asiceAttachableProcessors = new List <AsiceAttachableProcessor>(); //Act var asiceArchive = new AsiceArchive(cryptographicCertificate, new GuidUtility(), asiceAttachableProcessors, asiceAttachablesArray); //Assert Assert.Equal(asiceAttachableProcessors, asiceArchive.AsiceAttachableProcessors); Assert.Equal(asiceAttachablesArray, asiceArchive.AsiceAttachables); }
public void SendsBytesThroughDocumentBundleProcessors() { //Arrange var clientConfiguration = new Klientkonfigurasjon(Miljø.FunksjoneltTestmiljø) { Dokumentpakkeprosessorer = new List <IDokumentpakkeProsessor> { new SimpleDocumentBundleProcessor(), new SimpleDocumentBundleProcessor() } }; var forsendelse = DomainUtility.GetForsendelseSimple(); var asiceAttachableProcessors = clientConfiguration.Dokumentpakkeprosessorer.Select(p => new AsiceAttachableProcessor(forsendelse, p)); var asiceAttachables = new IAsiceAttachable[] { DomainUtility.GetHoveddokumentSimple() }; //Act var asiceArchive = new AsiceArchive(DomainUtility.GetMottakerCertificate(), new GuidUtility(), asiceAttachableProcessors, asiceAttachables); var bytes = asiceArchive.Bytes; //Assert foreach (var simpleProcessor in clientConfiguration.Dokumentpakkeprosessorer.Cast <SimpleDocumentBundleProcessor>()) { Assert.True(simpleProcessor.StreamLength > 1000); Assert.True(simpleProcessor.CouldReadBytesStream); Assert.Equal(0, simpleProcessor.Initialposition); } }
public void LeggFilerTilDokumentpakkeAntallStemmer() { var dokumentpakke = DomainUtility.GetDokumentpakkeWithMultipleVedlegg(5); Assert.Equal(DomainUtility.GetVedleggFilesPaths().Length, dokumentpakke.Vedlegg.Count); Assert.NotNull(dokumentpakke); }
public void LagUgyldigSecurityNodeXsdValidererIkke() { var envelope = DomainUtility.GetForretningsmeldingEnvelopeWithTestTestCertificate(); var forretningsmeldingEnvelopeXml = envelope.Xml(); //Endre til ugyldig forretningsmeldingenvelope var namespaceManager = new XmlNamespaceManager(forretningsmeldingEnvelopeXml.NameTable); namespaceManager.AddNamespace("env", NavneromUtility.SoapEnvelopeEnv12); namespaceManager.AddNamespace("eb", NavneromUtility.EbXmlCore); namespaceManager.AddNamespace("ds", NavneromUtility.XmlDsig); namespaceManager.AddNamespace("wsse", NavneromUtility.WssecuritySecext10); namespaceManager.AddNamespace("wsu", NavneromUtility.WssecurityUtility10); namespaceManager.AddNamespace("ns3", NavneromUtility.StandardBusinessDocumentHeader); namespaceManager.AddNamespace("ns9", NavneromUtility.DifiSdpSchema10); namespaceManager.AddNamespace("ns5", NavneromUtility.XmlDsig); var securityNode = forretningsmeldingEnvelopeXml.DocumentElement.SelectSingleNode("//wsse:Security", namespaceManager); var gammelVerdi = securityNode.Attributes["mustUnderstand"].Value; securityNode.Attributes["mustUnderstand"].Value = "en_tekst_som_ikke_er_bool"; string validationMessages; var validert = SdpXmlValidator.Instance.Validate(forretningsmeldingEnvelopeXml.OuterXml, out validationMessages); Assert.False(validert, validationMessages); securityNode.Attributes["mustUnderstand"].Value = gammelVerdi; }
public void KonstruktørForIdentiskHash() { //Arrange var prioritet = Prioritet.Normal; var mpcId = "mpcId"; var språkkode = "NO"; var konversasjonsid = Guid.NewGuid(); var forsendelse = new Forsendelse( DomainUtility.GetAvsender(), DomainUtility.GetDigitalPostInfoSimple(), DomainUtility.GetDokumentpakkeWithoutAttachments(), konversasjonsid, prioritet, mpcId, språkkode); //Act //Assert Assert.Equal(konversasjonsid, forsendelse.KonversasjonsId); Assert.NotNull(forsendelse.Avsender); Assert.NotNull(forsendelse.PostInfo); Assert.NotNull(forsendelse.Dokumentpakke); Assert.Equal(prioritet, forsendelse.Prioritet); Assert.Equal(mpcId, forsendelse.MpcId); Assert.Equal(språkkode, forsendelse.Språkkode); }
public DomainDefaults DomainDefaults(string domainName) { if (domainDefaults == null) { domainDefaults = Provider.ReadEntityWithRequestCache <DomainDefaultsForMember>(Id); // one-to-one ilişkili tablo olduğundan member'ın id'sini kullanmak yetiyor if (domainDefaults == null) { domainDefaults = Provider.ReadEntityWithRequestCache <DomainDefaultsForClient>(ClientId); // one-to-one } if (domainDefaults == null) { var zone = DomainUtility.GetZoneFromDomainName(domainName); domainDefaults = Provider.ReadEntityWithRequestCache <DomainDefaultsForZone>(zone.Id); // one-to-one if (domainDefaults == null) { domainDefaults = Provider.ReadEntityWithRequestCache <DomainDefaultsForRegistry>(zone.SupplierId); // one-to-one } } if (domainDefaults == null) { domainDefaults = new DomainDefaults(); } } return(domainDefaults); }
public void UgyldigNavnPåHoveddokumentValidererIkke() { var manifest = new Manifest(DomainUtility.GetForsendelseWithTestCertificate()); var manifestXml = manifest.Xml(); var manifestValidator = SdpXmlValidator.Instance; var namespaceManager = new XmlNamespaceManager(manifestXml.NameTable); namespaceManager.AddNamespace("ns9", NavneromUtility.DifiSdpSchema10); namespaceManager.AddNamespace("ds", NavneromUtility.XmlDsig); var hoveddokumentNode = manifestXml.DocumentElement.SelectSingleNode("//ns9:hoveddokument", namespaceManager); var gammelVerdi = hoveddokumentNode.Attributes["href"].Value; hoveddokumentNode.Attributes["href"].Value = "abc"; //Endre navn på hoveddokument til å være for kort string validationMessages; var validert = manifestValidator.Validate(manifestXml.OuterXml, out validationMessages); Assert.False(validert, validationMessages); hoveddokumentNode.Attributes["href"].Value = gammelVerdi; }
public void SimpleConstructor() { //Arrange var jobId = 22; var jobReference = "senders-reference"; var jobStatus = JobStatus.Failed; var jobReferences = DomainUtility.GetJobReferences(); var signatures = DomainUtility.GetSignatures(1); var nextPermittedPollTime = DateTime.Now; //Act var jobStatusResponse = new JobStatusResponse( jobId, jobReference, jobStatus, jobReferences, signatures, nextPermittedPollTime ); //Assert Assert.Equal(jobId, jobStatusResponse.JobId); Assert.Equal(jobReference, jobStatusResponse.JobReference); Assert.Equal(jobStatus, jobStatusResponse.Status); Assert.Equal(jobReferences, jobStatusResponse.References); Assert.Equal(signatures, jobStatusResponse.Signatures); Assert.Equal(nextPermittedPollTime, jobStatusResponse.NextPermittedPollTime); }
private static void CrawlPage(IRequest request, int step) { // if (request.Url.Trim('/').Split('/').Count() - 2 > CrawlerContext.Depth) if (step > CrawlerContext.Depth) { return; } if (CrawlerContext.SinglePage && step > 2) { return; } Uri tempUri = new Uri(request.Url); string tempDomain = DomainUtility.GetDomainFromUrl(tempUri); if (CrawlerContext.IgnoreDirectory.Count != 0 && IgnoreDirectory(request.Url, tempDomain)) { return; } if (!PageHasBeenCrawled(request)) { CrawlerContext.Pages.Add(request); RequestUtility.GetWebText(request); _pageCounter.Invoke(); if (request.Response.Error) { //log return; } _responseHandler.Invoke(request); LinkParser linkParser = new LinkParser(); linkParser.ParseLinksAgility(request.Response.Body, request.Url); if (CrawlerContext.LightMode) { request.Response.Body = ""; } foreach (IRequest link in linkParser.GoodUrls) { CrawlerContext.PauseEvent.WaitOne(Timeout.Infinite); try { CrawlPage(link, step + 1); } catch { // _failedUrls.Add(link + " (on page at url " + url + ") - " + exc.Message); } } CrawlerContext.ExhaustedURL.Add(request.Url); } }
public void ShouldSerializeErrorMessage() { Exception exception = null; try { var message = DomainUtility.GetSimpleMessageWithRecipientById(); const HttpStatusCode statusCode = HttpStatusCode.NotFound; var messageContent = XmlResource.SendMessage.GetError(); SendMessage(message, new FakeResponseHandler { ResultCode = statusCode, HttpContent = messageContent }); } catch (AggregateException e) { exception = e.InnerExceptions.ElementAt(0); } catch (ClientResponseException e) { exception = e; } Assert.True(exception is ClientResponseException); }
public void InternalServerErrorShouldCauseDigipostResponseException() { Exception exception = null; try { var message = DomainUtility.GetSimpleMessageWithRecipientById(); const HttpStatusCode statusCode = HttpStatusCode.InternalServerError; var messageContent = new StringContent(string.Empty); SendMessage(message, new FakeResponseHandler { ResultCode = statusCode, HttpContent = messageContent }); } catch (AggregateException e) { exception = e.InnerExceptions.ElementAt(0); } catch (ClientResponseException e) { exception = e; } Assert.True(exception is ClientResponseException); }
static string GetReportData(ReportBuilder reportBuilder) { reportBuilder = InitAutoGenerateReport(reportBuilder); string rdlcXML = ""; rdlcXML += @"<?xml version=""1.0"" encoding=""utf-8""?> <Report xmlns=""http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition"" xmlns:rd=""http://schemas.microsoft.com/SQLServer/reporting/reportdesigner""> <Body>"; string _tableData = GenerateTable(reportBuilder); if (_tableData.Trim() != "") { rdlcXML += @"<ReportItems>" + _tableData + @"</ReportItems>"; } rdlcXML += $@"<Height>2.1162cm</Height> <Style /> </Body> <Width>20.8cm</Width> <Page> " + GetPageHeader(reportBuilder) + GetFooter(reportBuilder) + GetReportPageSettings(reportBuilder) + @" <Style /> </Page> <AutoRefresh>0</AutoRefresh> " + GetDataSet(reportBuilder) + $@" <Language>{DomainUtility.GetCulture()}</Language> <ConsumeContainerWhitespace>true</ConsumeContainerWhitespace> <rd:ReportUnitType>Cm</rd:ReportUnitType> <rd:ReportID>17efa4a3-5c39-4892-a44b-fbde95c96585</rd:ReportID> </Report>"; return(rdlcXML); }
private void _btnHeadersTest_Click(object sender, EventArgs e) { string address = _txtDomain.Text; StringBuilder sb = new StringBuilder(); try { sb.Append("Starting Headers Test : " + address + Environment.NewLine); ScannerRequest sRequest = new ScannerRequest(); sRequest.URL = address; sRequest.Domain = DomainUtility.GetDomainFromUrl(address); sRequest.LogDir = Settings.LogDir; CheckHeaders(sRequest, sb); } catch (Exception ex) { string inner = ""; if (ex.InnerException != null) { inner = ex.InnerException.Message; } sb.Append("!!!!!Exception: " + ex.Message + " Inner: " + inner); } LogTest(sb.ToString()); }
public TestHelper Create_pollable_direct_job(Sender sender, params SignerIdentifier[] signers) { var job = DomainUtility.GetPollableDirectJob(sender, signers); _jobResponse = _directClient.Create(job).Result; return(this); }
string AnalyzeAbsoluteUri(Uri uri, string tableName, int index, out bool success) { if (uri.Scheme.ToLower(CultureInfo.CurrentCulture) == "http") { if (DomainUtility.IsValidDomainFrom(uri, "advancedacademics.com")) { var newUrl = (new AaiDomain()).AnalyzeAndRepair(uri, tableName, index, out success); return(StringReturner.ReturnString(uri.OriginalString, newUrl, success)); } if (DomainUtility.IsValidDomainFrom(uri, "aventalearning.com")) { //var newUrl = (new AventaDomain()).AnalyzeAndRepair(uri, tableName, index, out success); //return StringReturner.ReturnString(uri.OriginalString, newUrl, success); ManualFixLog.PrintAventaPathFound(uri.OriginalString, tableName, index); } success = false; ManualFixLog.PrintNonAaiNonAventaHttpPathMessage(uri.OriginalString, tableName, index); return(uri.OriginalString); } success = false; ManualFixLog.PrintNonSupportedSchemeMessage(uri.OriginalString, tableName, index); return(uri.OriginalString); }
public void Converts_portal_job_with_polling_queue_successfully() { //Arrange var document = DomainUtility.GetPortalDocument(); var signers = DomainUtility.GetSigners(2); var reference = "reference"; var custompollingqueue = "CustomPollingQueue"; var sender = new Sender(BringPublicOrganizationNumber, new PollingQueue(custompollingqueue)); var source = new Job(document, signers, reference, sender); var expected = new portalsignaturejobrequest { reference = reference, pollingqueue = custompollingqueue }; //Act var result = DataTransferObjectConverter.ToDataTransferObject(source); //Assert var comparator = new Comparator(); IEnumerable <IDifference> differences; comparator.AreEqual(expected, result, out differences); Assert.Empty(differences); }
public void SendsBytesThroughDocumentBundleProcessor() { //Arrange var clientConfiguration = new ClientConfiguration(Environment.DifiQa, CoreDomainUtility.GetPostenTestCertificate()) { DocumentBundleProcessors = new List <IDocumentBundleProcessor> { new SimpleDocumentBundleProcessor(), new SimpleDocumentBundleProcessor() } }; var job = DomainUtility.GetDirectJobWithSender(); var asiceAttachableProcessors = clientConfiguration.DocumentBundleProcessors.Select(p => new AsiceAttachableProcessor(job, p)); var asiceAttachables = new IAsiceAttachable[] { DomainUtility.GetDirectManifest(), DomainUtility.GetSignature(), DomainUtility.GetDirectDocument() }; //Act var asiceArchive = new AsiceArchive(asiceAttachableProcessors, asiceAttachables); asiceArchive.GetBytes(); //Assert foreach (var simpleProcessor in clientConfiguration.DocumentBundleProcessors.Cast <SimpleDocumentBundleProcessor>()) { Assert.True(simpleProcessor.StreamLength > 1000); Assert.True(simpleProcessor.CouldReadBytesStream); Assert.Equal(0, simpleProcessor.Initialposition); } }
public void VedleggTittelSkalSettesIManifestet() { //Arrange var resourceUtility = new ResourceUtility("Difi.SikkerDigitalPost.Klient.Tester.testdata"); var dokument = new Dokument("hoved", resourceUtility.ReadAllBytes(true, "hoveddokument", "Hoveddokument.pdf"), "application/pdf"); var vedleggTittel = "tittel"; var vedlegg = new Dokument(vedleggTittel, resourceUtility.ReadAllBytes(true, "hoveddokument", "Hoveddokument.pdf"), "application/pdf"); var dokumentPakke = new Dokumentpakke(dokument); dokumentPakke.LeggTilVedlegg(vedlegg); var message = new Forsendelse(DomainUtility.GetAvsender(), DomainUtility.GetDigitalPostInfoSimple(), dokumentPakke, Prioritet.Normal, Guid.NewGuid().ToString()); var asiceArkiv = DomainUtility.GetAsiceArchive(message); var manifestXml = new Manifest(message).Xml(); var namespaceManager = new XmlNamespaceManager(manifestXml.NameTable); namespaceManager.AddNamespace("ns9", NavneromUtility.DifiSdpSchema10); namespaceManager.AddNamespace("ds", NavneromUtility.XmlDsig); //Act //Assert var vedleggNodeInnerText = manifestXml.DocumentElement.SelectSingleNode("//ns9:vedlegg", namespaceManager).InnerText; Assert.Equal(vedleggTittel, vedleggNodeInnerText); }
public void KonstruktørMedOptionalParametere() { //Arrange var prioritet = Prioritet.Normal; var mpcId = "mpcId"; var språkkode = "NO"; var forsendelse = new Forsendelse( DomainUtility.GetAvsender(), DomainUtility.GetDigitalPostInfoSimple(), DomainUtility.GetDokumentpakkeWithoutAttachments(), prioritet, mpcId, språkkode ); //Act //Assert Assert.NotNull(forsendelse.Avsender); Assert.NotNull(forsendelse.PostInfo); Assert.NotNull(forsendelse.Dokumentpakke); Assert.Equal(prioritet, forsendelse.Prioritet); Assert.Equal(mpcId, forsendelse.MpcId); Assert.Equal(språkkode, forsendelse.Språkkode); }
private static bool CheckIfSocialMediaSite(string startingDomain, string url) { string foundDomain = DomainUtility.GetDomainFromUrl(url); string foundURL = url.Split('?')[0]; foreach (DomainData social in _socialDomains) { if (foundDomain.ToLower().Equals(startingDomain)) { continue; } if (foundDomain.ToLower().Equals(social.DomainName.ToLower())) { if (!CheckForSharing(url, social)) { return(false); } return(true); } } return(false); }
public void ProperRequestSentRecipientByNameAndAddress() { var message = DomainUtility.GetSimpleMessageWithRecipientByNameAndAddress(); SendMessage(message, new FakeResponseHandler { ResultCode = HttpStatusCode.OK, HttpContent = XmlResource.SendMessage.GetMessageDelivery() }); }
private void ImpersonateValidUser(string accountName, string password, string domain) { _fContext = DomainUtility.ImpersonateValidUser(accountName, password, domain); if (_fContext == null) { throw new Exception(string.Format("帐号[Account={0},Domain={1}]模拟失败", accountName, domain)); } }
public void LeggTilVedleggSammeNavnSomHoveddokumentKasterException() { var dokumentpakke = DomainUtility.GetDokumentpakkeWithoutAttachments(); Assert.Throws <KonfigurasjonsException>(() => dokumentpakke.LeggTilVedlegg(new Dokument("DokumentSomHoveddokument", new byte[] { 0x00 }, "text/plain", "NO", dokumentpakke.Hoveddokument.Filnavn)) ); }
private OrderInfo placeOrderForDomain(ReqPlaceOrderForDomain req, ProductPriceTypes op) { if (req.DomainName.IsEmpty()) { throw new APIException("DomainName parameter cannot be empty"); } var extension = DomainUtility.GetZoneFromDomainName(req.DomainName); if (extension == null) { throw new APIException("We dont have such extension: " + DomainUtility.GetDomainExtension(req.DomainName)); } ProductPrice pp = Provider.Database.Read <ProductPrice>("ProductId = {0} AND ProductPriceType = {1} AND Amount = {2}", extension.Id, op.ToString(), req.Years); if (pp == null) { pp = Provider.Database.Read <ProductPrice>("ProductId = {0} AND ProductPriceType = {1}", extension.Id, op.ToString()); } if (pp == null) { throw new APIException("There is no ProductPrice for Product " + extension.Id + " and ProductPriceType " + op + " with amount of " + req.Years + " years"); } OrderItemInfo oi = new OrderItemInfo() { ProductPriceId = pp.Id, Amount = req.Years }; oi.DisplayName = req.DomainName; var basket = Order.GetMemberBasket(); basket.RemoveAllItems(); basket.AddItem(oi); if (basket.TotalPrice == 0) { throw new APIException("Order total price must be bigger than zero"); } var reseller = Provider.CurrentMember.GetAdminResellerMember(); if (reseller == null) { throw new APIException("Reseller undefined! (This Member's ClientId should have an AdminMemberId)"); } if (reseller.CreditBalance < basket.TotalPrice) { throw new APIException("Insufficient credits"); } var order = CreateOrderFromBasket(""); return(order); }