content stringlengths 5 1.04M | avg_line_length float64 1.75 12.9k | max_line_length int64 2 244k | alphanum_fraction float64 0 0.98 | licenses list | repository_name stringlengths 7 92 | path stringlengths 3 249 | size int64 5 1.04M | lang stringclasses 2 values |
|---|---|---|---|---|---|---|---|---|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
using mshtml;
using OpenLiveWriter.ApplicationFramework;
using OpenLiveWriter.Localization;
using OpenLiveWriter.Mshtml;
namespace OpenLiveWriter.HtmlEditor
{
public interface IHtmlEditorCommandSource : ISimpleTextEditorCommandSource
{
void ViewSource();
void ClearFormatting();
bool CanApplyFormatting(CommandId? commandId);
string SelectionFontFamily { get; }
void ApplyFontFamily(string fontFamily);
float SelectionFontSize { get; }
void ApplyFontSize(float fontSize);
int SelectionForeColor { get; }
void ApplyFontForeColor(int color);
int SelectionBackColor { get; }
void ApplyFontBackColor(int? color);
string SelectionStyleName { get; }
void ApplyHtmlFormattingStyle(IHtmlFormattingStyle style);
bool SelectionBold { get; }
void ApplyBold();
bool SelectionItalic { get; }
void ApplyItalic();
bool SelectionUnderlined { get; }
void ApplyUnderline();
bool SelectionStrikethrough { get; }
void ApplyStrikethrough();
bool SelectionSuperscript { get; }
void ApplySuperscript();
bool SelectionSubscript { get; }
void ApplySubscript();
bool SelectionIsLTR { get; }
void InsertLTRTextBlock();
bool SelectionIsRTL { get; }
void InsertRTLTextBlock();
EditorTextAlignment GetSelectionAlignment();
void ApplyAlignment(EditorTextAlignment alignment);
bool SelectionBulleted { get; }
void ApplyBullets();
bool SelectionNumbered { get; }
void ApplyNumbers();
bool CanIndent { get; }
void ApplyIndent();
bool CanOutdent { get; }
void ApplyOutdent();
void ApplyBlockquote();
bool SelectionBlockquoted { get; }
bool CanInsertLink { get; }
void InsertLink();
bool CanRemoveLink { get; }
void RemoveLink();
void OpenLink();
void AddToGlossary();
bool CanPasteSpecial { get; }
bool AllowPasteSpecial { get; }
void PasteSpecial();
bool CanFind { get; }
void Find();
bool CanPrint { get; }
void Print();
void PrintPreview();
LinkInfo DiscoverCurrentLink();
bool CheckSpelling(string contextDictionaryPath);
bool FullyEditableRegionActive { get; }
CommandManager CommandManager { get; }
}
public class LinkInfo
{
private string _anchorText;
private string _url;
private string _linkTitle;
private string _rel;
private bool _newWindow;
public LinkInfo(string anchorText, string url, string linkTitle, string rel, bool newWindow)
{
_anchorText = anchorText;
_url = url;
_linkTitle = linkTitle;
_rel = rel;
_newWindow = newWindow;
}
public string AnchorText
{
get
{
return _anchorText;
}
}
public string Url
{
get
{
return _url;
}
}
public string LinkTitle
{
get
{
return _linkTitle;
}
}
public string Rel
{
get
{
return _rel;
}
}
public bool NewWindow
{
get
{
return _newWindow;
}
}
}
public enum EditorTextAlignment
{
None,
Left,
Center,
Right,
Justify
}
public interface IHtmlFormattingStyle
{
/// <summary>
/// Returns the name of the formatting style.
/// </summary>
string DisplayName { get; }
/// <summary>
/// The name of the Html element to apply
/// </summary>
string ElementName { get; }
/// <summary>
/// The mshtml tag id of the element to apply.
/// </summary>
_ELEMENT_TAG_ID ElementTagId { get; }
}
}
| 23.437838 | 100 | 0.555812 | [
"MIT"
] | eocampo/OpenLiveWriter | src/managed/OpenLiveWriter.HtmlEditor/IHtmlEditorCommandSource.cs | 4,336 | C# |
using NUnit.Framework;
using System;
namespace Exceptions.Tests
{
public static class PersonTests
{
[Test]
public static void Create()
{
var person = new Person(new Name("Joe", "Smith"), 44);
Assert.AreEqual(44, person.Age);
Assert.AreEqual("Joe", person.Name.FirstName);
Assert.AreEqual("Smith", person.Name.LastName);
}
[Test]
public static void CreateWithInvalidAge() =>
Assert.That(() => new Person(new Name("Joe", "Smith"), -44), Throws.TypeOf<ArgumentException>());
[Test]
public static void CreateWithNullName() =>
Assert.That(() => new Person(null, -44), Throws.TypeOf<ArgumentNullException>());
}
} | 26.04 | 100 | 0.678955 | [
"MIT"
] | JasonBock/ExceptionalDevelopment | Exceptions/Exceptions.Tests/PersonTests.cs | 653 | C# |
// *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
namespace Pulumi.AzureNextGen.DataFactory.V20170901Preview.Outputs
{
[OutputType]
public sealed class PostgreSqlLinkedServiceResponse
{
/// <summary>
/// List of tags that can be used for describing the Dataset.
/// </summary>
public readonly ImmutableArray<object> Annotations;
/// <summary>
/// The integration runtime reference.
/// </summary>
public readonly Outputs.IntegrationRuntimeReferenceResponse? ConnectVia;
/// <summary>
/// The connection string.
/// </summary>
public readonly Union<Outputs.AzureKeyVaultSecretReferenceResponse, Outputs.SecureStringResponse> ConnectionString;
/// <summary>
/// Linked service description.
/// </summary>
public readonly string? Description;
/// <summary>
/// The encrypted credential used for authentication. Credentials are encrypted using the integration runtime credential manager. Type: string (or Expression with resultType string).
/// </summary>
public readonly object? EncryptedCredential;
/// <summary>
/// Parameters for linked service.
/// </summary>
public readonly ImmutableDictionary<string, Outputs.ParameterSpecificationResponse>? Parameters;
/// <summary>
/// Type of linked service.
/// </summary>
public readonly string Type;
[OutputConstructor]
private PostgreSqlLinkedServiceResponse(
ImmutableArray<object> annotations,
Outputs.IntegrationRuntimeReferenceResponse? connectVia,
Union<Outputs.AzureKeyVaultSecretReferenceResponse, Outputs.SecureStringResponse> connectionString,
string? description,
object? encryptedCredential,
ImmutableDictionary<string, Outputs.ParameterSpecificationResponse>? parameters,
string type)
{
Annotations = annotations;
ConnectVia = connectVia;
ConnectionString = connectionString;
Description = description;
EncryptedCredential = encryptedCredential;
Parameters = parameters;
Type = type;
}
}
}
| 35.830986 | 190 | 0.65566 | [
"Apache-2.0"
] | test-wiz-sec/pulumi-azure-nextgen | sdk/dotnet/DataFactory/V20170901Preview/Outputs/PostgreSqlLinkedServiceResponse.cs | 2,544 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using lsc.Common;
using lsc.Bll;
using lsc.Model;
using Microsoft.AspNetCore.Http;
namespace lsc.crm.Controllers
{
public class AccountController : Controller
{
/// <summary>
/// 登录页
/// </summary>
/// <returns></returns>
public IActionResult Index()
{
return View();
}
[HttpPost]
public async Task<IActionResult> Login()
{
string username = Request.Form["username"].TryToString();
string password = Request.Form["password"].TryToString();
UserBll bll = new UserBll();
UserInfo user = await bll.UserLogin(username,password);
if (user!=null)
{
HttpContext.Session.SetString("user",JsonSerializerHelper.Serialize(user));
return Json(new { code = 1, msg = "OK" });
}
return Json(new { code = 0, msg = "登录失败" });
}
public IActionResult LoginOut()
{
HttpContext.Session.Clear();
return RedirectToAction("Index");
}
/// <summary>
/// 打开邮件回调
/// </summary>
/// <param name="logid"></param>
/// <returns></returns>
[HttpGet]
public async Task<IActionResult> OpenEmailCallBack(int logid)
{
SendEmailLogBll bll = new SendEmailLogBll();
var info = await bll.GetById(logid);
if (info != null)
{
info.IsRead = true;
}
bll.Update(info);
return Json(new { code = 1, msg = "OK" });
}
}
} | 28.451613 | 91 | 0.527778 | [
"Apache-2.0"
] | 2551405234/crm | lsc/lsc.crm/Controllers/AccountController.cs | 1,792 | C# |
using Autofac.Integration.Mvc;
using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens;
using System.Linq;
using System.Net.Http;
using System.Security.Claims;
using System.Web.Http;
using System.Web.Http.Controllers;
using System.Web.Http.Filters;
using System.Web.Mvc;
using Wutnu.Common;
using Wutnu.Data;
using Wutnu.Data.Models;
namespace Wutnu.Infrastructure.Filters
{
public class ApiAuth: System.Web.Http.AuthorizeAttribute
{
protected override void HandleUnauthorizedRequest(HttpActionContext actionContext)
{
base.HandleUnauthorizedRequest(actionContext);
}
public override void OnAuthorization(HttpActionContext actionContext)
{
try
{
var key = actionContext.Request.Headers.SingleOrDefault(h => h.Key=="apikey").Value.FirstOrDefault();
if (key == null)
{
Unauthorized(actionContext);
return;
}
var cache = actionContext.Request.GetDependencyScope().GetService(typeof(WutCache)) as WutCache;
var user = cache.GetUserFromApiKey(key.ToString());
if (user == null)
{
Unauthorized(actionContext);
return;
}
if (!AuthAndAddClaims(user, actionContext))
{
Unauthorized(actionContext);
return;
}
}
catch (Exception ex)
{
throw new Exception("Error authorizing access", ex);
}
}
private static void Unauthorized(HttpActionContext actionContext)
{
actionContext.Response = actionContext.Request.CreateResponse(System.Net.HttpStatusCode.Forbidden);
actionContext.Response.Headers.Add("AuthenticationStatus", "NotAuthorized");
actionContext.Response.ReasonPhrase = "ApiKey is invalid.";
}
private static bool AuthAndAddClaims(UserPoco user, HttpActionContext context)
{
try
{
List<Claim> claims = new List<Claim>()
{
new Claim(ClaimTypes.Name, (user.PrimaryEmail ?? Convert.ToString(user.UserId))),
new Claim(CustomClaimTypes.UserId, user.UserId.ToString()),
new Claim(CustomClaimTypes.ObjectIdentifier, user.UserOID),
};
if (user.PrimaryEmail != null)
claims.Add(new Claim(ClaimTypes.Email, user.PrimaryEmail));
// create an identity with the valid claims.
ClaimsIdentity identity = new ClaimsIdentity(claims, WutAuthTypes.Api);
// set the context principal.
context.RequestContext.Principal = new ClaimsPrincipal(new[] { identity });
return true;
}
catch (Exception ex)
{
Logging.WriteDebugInfoToErrorLog("Auth Error", ex);
return false;
}
}
}
}
| 33.197917 | 117 | 0.566677 | [
"Apache-2.0"
] | Matty9191/Wutnu | Wutnu3/Infrastructure/Filters/ApiAuthAttribute.cs | 3,189 | C# |
namespace CQELight
{
/// <summary>
/// Bootstrapper options.
/// </summary>
public sealed class BootstrapperOptions
{
#region Properties
/// <summary>
/// Flag that indicates if services are autoloaded.
/// Warning : Setting this flag to true will ignore all your custom calls.
/// </summary>
public bool AutoLoad { get; set; }
/// <summary>
/// Flag to indicates if bootstrapper should stricly validates its content.
/// </summary>
public bool Strict { get; set; }
/// <summary>
/// Flag to indicates if optimal system is currently 'On', which means
/// that one service of each kind should be provided.
/// </summary>
public bool CheckOptimal { get; set; }
/// <summary>
/// Flag to indicates if any encountered error notif on bootstraping
/// should throw <see cref="BootstrappingException"/>
/// </summary>
public bool ThrowExceptionOnErrorNotif { get; set; }
#endregion
}
}
| 29.916667 | 83 | 0.583101 | [
"MIT"
] | cdie/CQELight | src/CQELight/Bootstrapping/BootstrapperOptions.cs | 1,079 | C# |
using JetBrains.Annotations;
using JetBrains.Diagnostics;
using JetBrains.Metadata.Reader.API;
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.Modules;
using JetBrains.ReSharper.Psi.Util;
using JetBrains.Util;
namespace JetBrains.ReSharper.Plugins.Unity
{
public class UnityTypeSpec
{
public static UnityTypeSpec Void = new UnityTypeSpec(PredefinedType.VOID_FQN);
public UnityTypeSpec(IClrTypeName typeName, bool isArray = false, IClrTypeName[] typeParameters = null)
{
ClrTypeName = typeName;
IsArray = isArray;
TypeParameters = typeParameters ?? EmptyArray<IClrTypeName>.Instance;
}
// CLR type name, not C# type name. Mostly the same, but can only represent open generics
// E.g. System.Collections.Generics.List`1
// Even though ApiXml contains a closed type generic name in CLR format, we parse that, and only use open here
public IClrTypeName ClrTypeName { get; }
public bool IsArray { get; }
public IClrTypeName[] TypeParameters { get; }
// TODO: Perhaps this should be an extension method
[NotNull]
public IType AsIType(KnownTypesCache knownTypesCache, IPsiModule module)
{
// TODO: It would be nice to also cache the closed generic and array types
// We would need a different key for that
IType type = knownTypesCache.GetByClrTypeName(ClrTypeName, module);
if (TypeParameters.Length > 0)
{
var typeParameters = new IType[TypeParameters.Length];
for (int i = 0; i < TypeParameters.Length; i++)
{
typeParameters[i] = knownTypesCache.GetByClrTypeName(TypeParameters[i], module);
}
var typeElement = type.GetTypeElement().NotNull("typeElement != null");
type = TypeFactory.CreateType(typeElement, typeParameters);
}
if (IsArray)
type = TypeFactory.CreateArrayType(type, 1);
return type;
}
}
}
| 37.732143 | 118 | 0.636536 | [
"Apache-2.0"
] | JetBrains/resharper-unity | resharper/resharper-unity/src/UnityTypeSpec.cs | 2,113 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Security.Cryptography;
using System.Windows.Input;
using System.Diagnostics;
using System.IO;
using Microsoft.Win32;
using lexRC5;
namespace lexRSA
{
class MainViewModel : ViewModelBase
{
private const int EncipherBlockSizeRSA = 64;
private const int DecipherBlockSizeRSA = 128;
private readonly RSACryptoServiceProvider rsa;
private readonly RC5_CBC_Pad_64Bit rc5;
private readonly lexMD5.MD5 md5;
public MainViewModel()
{
rsa = new RSACryptoServiceProvider();
rc5 = new RC5_CBC_Pad_64Bit(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 });
md5 = new lexMD5.MD5();
ResetRSA();
}
private string _inputPath;
public string InputPath
{
get => _inputPath;
set
{
_inputPath = value;
RaisePropertyChanged();
}
}
private string _outputPath;
public string OutputPath
{
get => _outputPath;
set
{
_outputPath = value;
RaisePropertyChanged();
}
}
private double _timeElapsed;
public double TimeElapsed
{
get => _timeElapsed;
set
{
_timeElapsed = value;
RaisePropertyChanged();
}
}
private long _progressBytes;
public long ProgressBytes
{
get => _progressBytes;
set
{
_progressBytes = value;
RaisePropertyChanged();
}
}
private long _totalBytes;
public long TotalBytes
{
get => _totalBytes;
set
{
_totalBytes = value;
RaisePropertyChanged();
}
}
private string _rsaKeyHash;
public string RSAKeyHash
{
get => _rsaKeyHash;
set
{
_rsaKeyHash = value;
RaisePropertyChanged();
}
}
private string _rsaKeyFilePath;
public string RSAKeyFilePath
{
get => _rsaKeyFilePath;
set
{
_rsaKeyFilePath = value;
RaisePropertyChanged();
}
}
private string _rc5Key;
public string RC5Key
{
get => _rc5Key;
set
{
_rc5Key = value;
RaisePropertyChanged();
}
}
private bool _isWorking;
public bool IsWorking
{
get => _isWorking;
set
{
_isWorking = value;
RaisePropertyChanged();
}
}
private bool stopRequested;
public ICommand EncryptRSA => new DelegateCommand(() =>
{
Task.Run(() =>
{
IsWorking = true;
try
{
byte[] input = File.ReadAllBytes(InputPath);
byte[] output = EncipherRSAAsync(input);
File.WriteAllBytes(OutputPath, output);
System.Windows.MessageBox.Show("Successfully encrypted.");
}
catch (Exception ex)
{
ErrorMessage = ex.Message;
}
IsWorking = false;
});
});
public ICommand DecryptRSA => new DelegateCommand(() =>
{
Task.Run(() =>
{
IsWorking = true;
try
{
byte[] input = File.ReadAllBytes(InputPath);
byte[] output = DecipherRSAAsync(input);
File.WriteAllBytes(OutputPath, output);
System.Windows.MessageBox.Show("Successfully decrypted.");
}
catch (Exception ex)
{
ErrorMessage = ex.Message;
}
IsWorking = false;
});
});
public ICommand EncryptRC5 => new DelegateCommand(() =>
{
Task.Run(() =>
{
IsWorking = true;
Stream inputStream = null;
Stream outputStream = null;
try
{
inputStream = new FileStream(InputPath, FileMode.Open);
outputStream = new FileStream(OutputPath, FileMode.Create);
EncipherRC5Async(inputStream, outputStream);
System.Windows.MessageBox.Show("Successfully encrypted.");
}
catch (Exception ex)
{
ErrorMessage = ex.Message;
}
finally
{
inputStream?.Dispose();
outputStream?.Dispose();
}
IsWorking = false;
});
});
public ICommand DecryptRC5 => new DelegateCommand(() =>
{
Task.Run(() =>
{
IsWorking = true;
Stream inputStream = null;
Stream outputStream = null;
try
{
inputStream = new FileStream(InputPath, FileMode.Open);
outputStream = new FileStream(OutputPath, FileMode.Create);
DecipherRC5Async(inputStream, outputStream);
System.Windows.MessageBox.Show("Successfully decrypted.");
}
catch (Exception ex)
{
ErrorMessage = ex.Message;
}
finally
{
inputStream?.Dispose();
outputStream?.Dispose();
}
IsWorking = false;
});
});
public ICommand BrowseInput => new DelegateCommand(() =>
{
Task.Run(() =>
{
OpenFileDialog dialog = new OpenFileDialog()
{
InitialDirectory = Directory.GetCurrentDirectory()
};
bool? result = dialog.ShowDialog();
if (result == true)
{
InputPath = dialog.FileName;
}
});
});
public ICommand BrowseOutput => new DelegateCommand(() =>
{
Task.Run(() =>
{
SaveFileDialog dialog = new SaveFileDialog()
{
InitialDirectory = Directory.GetCurrentDirectory()
};
bool? result = dialog.ShowDialog();
if (result == true)
{
OutputPath = dialog.FileName;
}
});
});
public ICommand ExportRSAKey => new DelegateCommand(() =>
{
Task.Run(() =>
{
try
{
SaveFileDialog dialog = new SaveFileDialog()
{
InitialDirectory = Directory.GetCurrentDirectory(),
FileName = "RSA_Key.xml"
};
bool? result = dialog.ShowDialog();
if (result == true)
{
string xml = rsa.ToXmlString(includePrivateParameters: true);
File.WriteAllText(dialog.FileName, xml);
RSAKeyFilePath = dialog.FileName;
System.Windows.MessageBox.Show("Successfully exported.");
}
}
catch (Exception ex)
{
ErrorMessage = ex.Message;
}
});
});
public ICommand ImportRSAKey => new DelegateCommand(() =>
{
Task.Run(() =>
{
try
{
OpenFileDialog dialog = new OpenFileDialog()
{
InitialDirectory = Directory.GetCurrentDirectory()
};
bool? result = dialog.ShowDialog();
if (result == true)
{
RSAKeyFilePath = dialog.FileName;
string xml = File.ReadAllText(dialog.FileName);
rsa.FromXmlString(xml);
UpdateRSAParametersHash();
System.Windows.MessageBox.Show("Successfully imported.");
}
}
catch (Exception ex)
{
ErrorMessage = ex.Message;
}
});
});
public ICommand ResetRSAKey => new DelegateCommand(() =>
{
Task.Run(() =>
{
ResetRSA();
});
});
public ICommand Stop => new DelegateCommand(() =>
{
stopRequested = true;
});
private byte[] EncipherRSAAsync(byte[] inputBytes)
{
var stopWatch = new Stopwatch();
var encipheredBytes = new List<byte>
{
Capacity = inputBytes.Length * 2
};
TotalBytes = inputBytes.LongLength;
const int updateFrequencyInMillis = 333;
long lastMillis = 0;
stopWatch.Start();
for (int i = 0; i < inputBytes.Length; i += EncipherBlockSizeRSA)
{
if (stopRequested)
{
stopRequested = false;
throw new Exception("Cancelled.");
}
var inputBlock = inputBytes
.Skip(i)
.Take(EncipherBlockSizeRSA)
.ToArray();
encipheredBytes.AddRange(rsa.Encrypt(
inputBlock,
fOAEP: false));
if (stopWatch.ElapsedMilliseconds - lastMillis > updateFrequencyInMillis)
{
ProgressBytes = i;
TimeElapsed = Math.Round((double)stopWatch.ElapsedTicks / TimeSpan.TicksPerMillisecond / 1000.0, 2);
lastMillis = stopWatch.ElapsedMilliseconds;
}
}
ProgressBytes = inputBytes.LongLength;
TimeElapsed = Math.Round((double)stopWatch.ElapsedTicks / TimeSpan.TicksPerMillisecond / 1000.0, 2);
stopWatch.Stop();
return encipheredBytes.ToArray();
}
private byte[] DecipherRSAAsync(byte[] inputBytes)
{
var stopWatch = new Stopwatch();
var decipheredBytes = new List<byte>
{
Capacity = inputBytes.Length / 2
};
TotalBytes = inputBytes.LongLength;
const int updateFrequencyInMillis = 333;
long lastMillis = 0;
stopWatch.Start();
for (int i = 0; i < inputBytes.Length; i += DecipherBlockSizeRSA)
{
if (stopRequested)
{
stopRequested = false;
throw new Exception("Cancelled.");
}
var inputBlock = inputBytes
.Skip(i)
.Take(DecipherBlockSizeRSA)
.ToArray();
decipheredBytes.AddRange(rsa.Decrypt(
inputBlock,
fOAEP: false));
if (stopWatch.ElapsedMilliseconds - lastMillis > updateFrequencyInMillis)
{
ProgressBytes = i;
TimeElapsed = Math.Round((double)stopWatch.ElapsedTicks / TimeSpan.TicksPerMillisecond / 1000.0, 2);
lastMillis = stopWatch.ElapsedMilliseconds;
}
}
ProgressBytes = inputBytes.LongLength;
TimeElapsed = Math.Round((double)stopWatch.ElapsedTicks / TimeSpan.TicksPerMillisecond / 1000.0, 2);
stopWatch.Stop();
return decipheredBytes.ToArray();
}
private void EncipherRC5Async(Stream inputStream, Stream outputStream)
{
UpdateRC5Key();
var stopWatch = new Stopwatch();
TotalBytes = inputStream.Length;
stopWatch.Start();
rc5.Encrypt(inputStream, outputStream);
ProgressBytes = inputStream.Length;
TimeElapsed = Math.Round((double)stopWatch.ElapsedTicks / TimeSpan.TicksPerMillisecond / 1000.0, 2);
stopWatch.Stop();
}
private void DecipherRC5Async(Stream inputStream, Stream outputStream)
{
UpdateRC5Key();
var stopWatch = new Stopwatch();
TotalBytes = inputStream.Length;
stopWatch.Start();
rc5.Decrypt(inputStream, outputStream);
ProgressBytes = inputStream.Length;
TimeElapsed = Math.Round((double)stopWatch.ElapsedTicks / TimeSpan.TicksPerMillisecond / 1000.0, 2);
stopWatch.Stop();
}
private void UpdateRSAParametersHash()
{
RSAParameters parameters = rsa.ExportParameters(includePrivateParameters: true);
List<byte> bytes = new List<byte>();
bytes.AddRange(parameters.D);
bytes.AddRange(parameters.DP);
bytes.AddRange(parameters.DQ);
bytes.AddRange(parameters.Exponent);
bytes.AddRange(parameters.InverseQ);
bytes.AddRange(parameters.Modulus);
bytes.AddRange(parameters.P);
bytes.AddRange(parameters.Q);
byte[] hash = md5.MakeHash(bytes.ToArray());
StringBuilder builder = new StringBuilder();
for (int i = 0; i < hash.Length; ++i)
{
builder.Append(hash[i].ToString("x2"));
}
RSAKeyHash = builder.ToString();
}
private void UpdateRC5Key()
{
byte[] keyBytes = Encoding.Unicode.GetBytes(RC5Key);
byte[] hash = md5.MakeHash(keyBytes);
rc5.Key = hash;
}
private void ResetRSA()
{
RSA r = RSA.Create();
RSAParameters parameters = r.ExportParameters(includePrivateParameters: true);
rsa.ImportParameters(parameters);
RSAKeyFilePath = "<not saved>";
UpdateRSAParametersHash();
}
}
}
| 28.790385 | 120 | 0.461158 | [
"MIT"
] | lexakogut/DataSafetyApps | Lab4/lexRSA/MainViewModel.cs | 14,973 | C# |
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
/*
* Do not modify this file. This file is generated from the eventbridge-2015-10-07.normal.json service model.
*/
using System;
using System.Collections.Generic;
using System.Net;
using Amazon.EventBridge.Model;
using Amazon.EventBridge.Model.Internal.MarshallTransformations;
using Amazon.EventBridge.Internal;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Auth;
using Amazon.Runtime.Internal.Transform;
namespace Amazon.EventBridge
{
/// <summary>
/// Implementation for accessing EventBridge
///
/// Amazon EventBridge helps you to respond to state changes in your AWS resources. When
/// your resources change state, they automatically send events into an event stream.
/// You can create rules that match selected events in the stream and route them to targets
/// to take action. You can also use rules to take action on a predetermined schedule.
/// For example, you can configure rules to:
///
/// <ul> <li>
/// <para>
/// Automatically invoke an AWS Lambda function to update DNS entries when an event notifies
/// you that Amazon EC2 instance enters the running state.
/// </para>
/// </li> <li>
/// <para>
/// Direct specific API records from AWS CloudTrail to an Amazon Kinesis data stream for
/// detailed analysis of potential security or availability risks.
/// </para>
/// </li> <li>
/// <para>
/// Periodically invoke a built-in target to create a snapshot of an Amazon EBS volume.
/// </para>
/// </li> </ul>
/// <para>
/// For more information about the features of Amazon EventBridge, see the <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide">Amazon
/// EventBridge User Guide</a>.
/// </para>
/// </summary>
public partial class AmazonEventBridgeClient : AmazonServiceClient, IAmazonEventBridge
{
private static IServiceMetadata serviceMetadata = new AmazonEventBridgeMetadata();
#region Constructors
/// <summary>
/// Constructs AmazonEventBridgeClient with the credentials loaded from the application's
/// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
///
/// Example App.config with credentials set.
/// <code>
/// <?xml version="1.0" encoding="utf-8" ?>
/// <configuration>
/// <appSettings>
/// <add key="AWSProfileName" value="AWS Default"/>
/// </appSettings>
/// </configuration>
/// </code>
///
/// </summary>
public AmazonEventBridgeClient()
: base(FallbackCredentialsFactory.GetCredentials(), new AmazonEventBridgeConfig()) { }
/// <summary>
/// Constructs AmazonEventBridgeClient with the credentials loaded from the application's
/// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
///
/// Example App.config with credentials set.
/// <code>
/// <?xml version="1.0" encoding="utf-8" ?>
/// <configuration>
/// <appSettings>
/// <add key="AWSProfileName" value="AWS Default"/>
/// </appSettings>
/// </configuration>
/// </code>
///
/// </summary>
/// <param name="region">The region to connect.</param>
public AmazonEventBridgeClient(RegionEndpoint region)
: base(FallbackCredentialsFactory.GetCredentials(), new AmazonEventBridgeConfig{RegionEndpoint = region}) { }
/// <summary>
/// Constructs AmazonEventBridgeClient with the credentials loaded from the application's
/// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
///
/// Example App.config with credentials set.
/// <code>
/// <?xml version="1.0" encoding="utf-8" ?>
/// <configuration>
/// <appSettings>
/// <add key="AWSProfileName" value="AWS Default"/>
/// </appSettings>
/// </configuration>
/// </code>
///
/// </summary>
/// <param name="config">The AmazonEventBridgeClient Configuration Object</param>
public AmazonEventBridgeClient(AmazonEventBridgeConfig config)
: base(FallbackCredentialsFactory.GetCredentials(), config) { }
/// <summary>
/// Constructs AmazonEventBridgeClient with AWS Credentials
/// </summary>
/// <param name="credentials">AWS Credentials</param>
public AmazonEventBridgeClient(AWSCredentials credentials)
: this(credentials, new AmazonEventBridgeConfig())
{
}
/// <summary>
/// Constructs AmazonEventBridgeClient with AWS Credentials
/// </summary>
/// <param name="credentials">AWS Credentials</param>
/// <param name="region">The region to connect.</param>
public AmazonEventBridgeClient(AWSCredentials credentials, RegionEndpoint region)
: this(credentials, new AmazonEventBridgeConfig{RegionEndpoint = region})
{
}
/// <summary>
/// Constructs AmazonEventBridgeClient with AWS Credentials and an
/// AmazonEventBridgeClient Configuration object.
/// </summary>
/// <param name="credentials">AWS Credentials</param>
/// <param name="clientConfig">The AmazonEventBridgeClient Configuration Object</param>
public AmazonEventBridgeClient(AWSCredentials credentials, AmazonEventBridgeConfig clientConfig)
: base(credentials, clientConfig)
{
}
/// <summary>
/// Constructs AmazonEventBridgeClient with AWS Access Key ID and AWS Secret Key
/// </summary>
/// <param name="awsAccessKeyId">AWS Access Key ID</param>
/// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
public AmazonEventBridgeClient(string awsAccessKeyId, string awsSecretAccessKey)
: this(awsAccessKeyId, awsSecretAccessKey, new AmazonEventBridgeConfig())
{
}
/// <summary>
/// Constructs AmazonEventBridgeClient with AWS Access Key ID and AWS Secret Key
/// </summary>
/// <param name="awsAccessKeyId">AWS Access Key ID</param>
/// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
/// <param name="region">The region to connect.</param>
public AmazonEventBridgeClient(string awsAccessKeyId, string awsSecretAccessKey, RegionEndpoint region)
: this(awsAccessKeyId, awsSecretAccessKey, new AmazonEventBridgeConfig() {RegionEndpoint=region})
{
}
/// <summary>
/// Constructs AmazonEventBridgeClient with AWS Access Key ID, AWS Secret Key and an
/// AmazonEventBridgeClient Configuration object.
/// </summary>
/// <param name="awsAccessKeyId">AWS Access Key ID</param>
/// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
/// <param name="clientConfig">The AmazonEventBridgeClient Configuration Object</param>
public AmazonEventBridgeClient(string awsAccessKeyId, string awsSecretAccessKey, AmazonEventBridgeConfig clientConfig)
: base(awsAccessKeyId, awsSecretAccessKey, clientConfig)
{
}
/// <summary>
/// Constructs AmazonEventBridgeClient with AWS Access Key ID and AWS Secret Key
/// </summary>
/// <param name="awsAccessKeyId">AWS Access Key ID</param>
/// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
/// <param name="awsSessionToken">AWS Session Token</param>
public AmazonEventBridgeClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken)
: this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonEventBridgeConfig())
{
}
/// <summary>
/// Constructs AmazonEventBridgeClient with AWS Access Key ID and AWS Secret Key
/// </summary>
/// <param name="awsAccessKeyId">AWS Access Key ID</param>
/// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
/// <param name="awsSessionToken">AWS Session Token</param>
/// <param name="region">The region to connect.</param>
public AmazonEventBridgeClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, RegionEndpoint region)
: this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonEventBridgeConfig{RegionEndpoint = region})
{
}
/// <summary>
/// Constructs AmazonEventBridgeClient with AWS Access Key ID, AWS Secret Key and an
/// AmazonEventBridgeClient Configuration object.
/// </summary>
/// <param name="awsAccessKeyId">AWS Access Key ID</param>
/// <param name="awsSecretAccessKey">AWS Secret Access Key</param>
/// <param name="awsSessionToken">AWS Session Token</param>
/// <param name="clientConfig">The AmazonEventBridgeClient Configuration Object</param>
public AmazonEventBridgeClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, AmazonEventBridgeConfig clientConfig)
: base(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, clientConfig)
{
}
#endregion
#region Overrides
/// <summary>
/// Creates the signer for the service.
/// </summary>
protected override AbstractAWSSigner CreateSigner()
{
return new AWS4Signer();
}
/// <summary>
/// Capture metadata for the service.
/// </summary>
protected override IServiceMetadata ServiceMetadata
{
get
{
return serviceMetadata;
}
}
#endregion
#region Dispose
/// <summary>
/// Disposes the service client.
/// </summary>
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
}
#endregion
#region ActivateEventSource
/// <summary>
/// Activates a partner event source that has been deactivated. Once activated, your matching
/// event bus will start receiving events from the event source.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ActivateEventSource service method.</param>
///
/// <returns>The response from the ActivateEventSource service method, as returned by EventBridge.</returns>
/// <exception cref="Amazon.EventBridge.Model.ConcurrentModificationException">
/// There is concurrent modification on a rule or target.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.InternalException">
/// This exception occurs due to unexpected causes.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.InvalidStateException">
/// The specified state is not a valid state for an event source.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.OperationDisabledException">
/// The operation you are attempting is not available in this region.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.ResourceNotFoundException">
/// An entity that you specified does not exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/ActivateEventSource">REST API Reference for ActivateEventSource Operation</seealso>
public virtual ActivateEventSourceResponse ActivateEventSource(ActivateEventSourceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ActivateEventSourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = ActivateEventSourceResponseUnmarshaller.Instance;
return Invoke<ActivateEventSourceResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ActivateEventSource operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ActivateEventSource operation on AmazonEventBridgeClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndActivateEventSource
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/ActivateEventSource">REST API Reference for ActivateEventSource Operation</seealso>
public virtual IAsyncResult BeginActivateEventSource(ActivateEventSourceRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = ActivateEventSourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = ActivateEventSourceResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the ActivateEventSource operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginActivateEventSource.</param>
///
/// <returns>Returns a ActivateEventSourceResult from EventBridge.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/ActivateEventSource">REST API Reference for ActivateEventSource Operation</seealso>
public virtual ActivateEventSourceResponse EndActivateEventSource(IAsyncResult asyncResult)
{
return EndInvoke<ActivateEventSourceResponse>(asyncResult);
}
#endregion
#region CreateEventBus
/// <summary>
/// Creates a new event bus within your account. This can be a custom event bus which
/// you can use to receive events from your custom applications and services, or it can
/// be a partner event bus which can be matched to a partner event source.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreateEventBus service method.</param>
///
/// <returns>The response from the CreateEventBus service method, as returned by EventBridge.</returns>
/// <exception cref="Amazon.EventBridge.Model.ConcurrentModificationException">
/// There is concurrent modification on a rule or target.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.InternalException">
/// This exception occurs due to unexpected causes.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.InvalidStateException">
/// The specified state is not a valid state for an event source.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.LimitExceededException">
/// You tried to create more rules or add more targets to a rule than is allowed.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.OperationDisabledException">
/// The operation you are attempting is not available in this region.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.ResourceAlreadyExistsException">
/// The resource you are trying to create already exists.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.ResourceNotFoundException">
/// An entity that you specified does not exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/CreateEventBus">REST API Reference for CreateEventBus Operation</seealso>
public virtual CreateEventBusResponse CreateEventBus(CreateEventBusRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateEventBusRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateEventBusResponseUnmarshaller.Instance;
return Invoke<CreateEventBusResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the CreateEventBus operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the CreateEventBus operation on AmazonEventBridgeClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndCreateEventBus
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/CreateEventBus">REST API Reference for CreateEventBus Operation</seealso>
public virtual IAsyncResult BeginCreateEventBus(CreateEventBusRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateEventBusRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateEventBusResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the CreateEventBus operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginCreateEventBus.</param>
///
/// <returns>Returns a CreateEventBusResult from EventBridge.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/CreateEventBus">REST API Reference for CreateEventBus Operation</seealso>
public virtual CreateEventBusResponse EndCreateEventBus(IAsyncResult asyncResult)
{
return EndInvoke<CreateEventBusResponse>(asyncResult);
}
#endregion
#region CreatePartnerEventSource
/// <summary>
/// Called by an SaaS partner to create a partner event source. This operation is not
/// used by AWS customers.
///
///
/// <para>
/// Each partner event source can be used by one AWS account to create a matching partner
/// event bus in that AWS account. A SaaS partner must create one partner event source
/// for each AWS account that wants to receive those event types.
/// </para>
///
/// <para>
/// A partner event source creates events based on resources within the SaaS partner's
/// service or application.
/// </para>
///
/// <para>
/// An AWS account that creates a partner event bus that matches the partner event source
/// can use that event bus to receive events from the partner, and then process them using
/// AWS Events rules and targets.
/// </para>
///
/// <para>
/// Partner event source names follow this format:
/// </para>
///
/// <para>
/// <code> <i>partner_name</i>/<i>event_namespace</i>/<i>event_name</i> </code>
/// </para>
///
/// <para>
/// <i>partner_name</i> is determined during partner registration and identifies the
/// partner to AWS customers. <i>event_namespace</i> is determined by the partner and
/// is a way for the partner to categorize their events. <i>event_name</i> is determined
/// by the partner, and should uniquely identify an event-generating resource within the
/// partner system. The combination of <i>event_namespace</i> and <i>event_name</i> should
/// help AWS customers decide whether to create an event bus to receive these events.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the CreatePartnerEventSource service method.</param>
///
/// <returns>The response from the CreatePartnerEventSource service method, as returned by EventBridge.</returns>
/// <exception cref="Amazon.EventBridge.Model.ConcurrentModificationException">
/// There is concurrent modification on a rule or target.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.InternalException">
/// This exception occurs due to unexpected causes.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.LimitExceededException">
/// You tried to create more rules or add more targets to a rule than is allowed.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.OperationDisabledException">
/// The operation you are attempting is not available in this region.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.ResourceAlreadyExistsException">
/// The resource you are trying to create already exists.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/CreatePartnerEventSource">REST API Reference for CreatePartnerEventSource Operation</seealso>
public virtual CreatePartnerEventSourceResponse CreatePartnerEventSource(CreatePartnerEventSourceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreatePartnerEventSourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreatePartnerEventSourceResponseUnmarshaller.Instance;
return Invoke<CreatePartnerEventSourceResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the CreatePartnerEventSource operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the CreatePartnerEventSource operation on AmazonEventBridgeClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndCreatePartnerEventSource
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/CreatePartnerEventSource">REST API Reference for CreatePartnerEventSource Operation</seealso>
public virtual IAsyncResult BeginCreatePartnerEventSource(CreatePartnerEventSourceRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreatePartnerEventSourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreatePartnerEventSourceResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the CreatePartnerEventSource operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginCreatePartnerEventSource.</param>
///
/// <returns>Returns a CreatePartnerEventSourceResult from EventBridge.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/CreatePartnerEventSource">REST API Reference for CreatePartnerEventSource Operation</seealso>
public virtual CreatePartnerEventSourceResponse EndCreatePartnerEventSource(IAsyncResult asyncResult)
{
return EndInvoke<CreatePartnerEventSourceResponse>(asyncResult);
}
#endregion
#region DeactivateEventSource
/// <summary>
/// You can use this operation to temporarily stop receiving events from the specified
/// partner event source. The matching event bus is not deleted.
///
///
/// <para>
/// When you deactivate a partner event source, the source goes into PENDING state. If
/// it remains in PENDING state for more than two weeks, it is deleted.
/// </para>
///
/// <para>
/// To activate a deactivated partner event source, use <a>ActivateEventSource</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeactivateEventSource service method.</param>
///
/// <returns>The response from the DeactivateEventSource service method, as returned by EventBridge.</returns>
/// <exception cref="Amazon.EventBridge.Model.ConcurrentModificationException">
/// There is concurrent modification on a rule or target.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.InternalException">
/// This exception occurs due to unexpected causes.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.InvalidStateException">
/// The specified state is not a valid state for an event source.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.OperationDisabledException">
/// The operation you are attempting is not available in this region.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.ResourceNotFoundException">
/// An entity that you specified does not exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/DeactivateEventSource">REST API Reference for DeactivateEventSource Operation</seealso>
public virtual DeactivateEventSourceResponse DeactivateEventSource(DeactivateEventSourceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeactivateEventSourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeactivateEventSourceResponseUnmarshaller.Instance;
return Invoke<DeactivateEventSourceResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DeactivateEventSource operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeactivateEventSource operation on AmazonEventBridgeClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDeactivateEventSource
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/DeactivateEventSource">REST API Reference for DeactivateEventSource Operation</seealso>
public virtual IAsyncResult BeginDeactivateEventSource(DeactivateEventSourceRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeactivateEventSourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeactivateEventSourceResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DeactivateEventSource operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDeactivateEventSource.</param>
///
/// <returns>Returns a DeactivateEventSourceResult from EventBridge.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/DeactivateEventSource">REST API Reference for DeactivateEventSource Operation</seealso>
public virtual DeactivateEventSourceResponse EndDeactivateEventSource(IAsyncResult asyncResult)
{
return EndInvoke<DeactivateEventSourceResponse>(asyncResult);
}
#endregion
#region DeleteEventBus
/// <summary>
/// Deletes the specified custom event bus or partner event bus. All rules associated
/// with this event bus need to be deleted. You can't delete your account's default event
/// bus.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteEventBus service method.</param>
///
/// <returns>The response from the DeleteEventBus service method, as returned by EventBridge.</returns>
/// <exception cref="Amazon.EventBridge.Model.ConcurrentModificationException">
/// There is concurrent modification on a rule or target.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.InternalException">
/// This exception occurs due to unexpected causes.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/DeleteEventBus">REST API Reference for DeleteEventBus Operation</seealso>
public virtual DeleteEventBusResponse DeleteEventBus(DeleteEventBusRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteEventBusRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteEventBusResponseUnmarshaller.Instance;
return Invoke<DeleteEventBusResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DeleteEventBus operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeleteEventBus operation on AmazonEventBridgeClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDeleteEventBus
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/DeleteEventBus">REST API Reference for DeleteEventBus Operation</seealso>
public virtual IAsyncResult BeginDeleteEventBus(DeleteEventBusRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteEventBusRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteEventBusResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DeleteEventBus operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDeleteEventBus.</param>
///
/// <returns>Returns a DeleteEventBusResult from EventBridge.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/DeleteEventBus">REST API Reference for DeleteEventBus Operation</seealso>
public virtual DeleteEventBusResponse EndDeleteEventBus(IAsyncResult asyncResult)
{
return EndInvoke<DeleteEventBusResponse>(asyncResult);
}
#endregion
#region DeletePartnerEventSource
/// <summary>
/// This operation is used by SaaS partners to delete a partner event source. This operation
/// is not used by AWS customers.
///
///
/// <para>
/// When you delete an event source, the status of the corresponding partner event bus
/// in the AWS customer account becomes DELETED.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeletePartnerEventSource service method.</param>
///
/// <returns>The response from the DeletePartnerEventSource service method, as returned by EventBridge.</returns>
/// <exception cref="Amazon.EventBridge.Model.ConcurrentModificationException">
/// There is concurrent modification on a rule or target.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.InternalException">
/// This exception occurs due to unexpected causes.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.OperationDisabledException">
/// The operation you are attempting is not available in this region.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/DeletePartnerEventSource">REST API Reference for DeletePartnerEventSource Operation</seealso>
public virtual DeletePartnerEventSourceResponse DeletePartnerEventSource(DeletePartnerEventSourceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeletePartnerEventSourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeletePartnerEventSourceResponseUnmarshaller.Instance;
return Invoke<DeletePartnerEventSourceResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DeletePartnerEventSource operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeletePartnerEventSource operation on AmazonEventBridgeClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDeletePartnerEventSource
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/DeletePartnerEventSource">REST API Reference for DeletePartnerEventSource Operation</seealso>
public virtual IAsyncResult BeginDeletePartnerEventSource(DeletePartnerEventSourceRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeletePartnerEventSourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeletePartnerEventSourceResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DeletePartnerEventSource operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDeletePartnerEventSource.</param>
///
/// <returns>Returns a DeletePartnerEventSourceResult from EventBridge.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/DeletePartnerEventSource">REST API Reference for DeletePartnerEventSource Operation</seealso>
public virtual DeletePartnerEventSourceResponse EndDeletePartnerEventSource(IAsyncResult asyncResult)
{
return EndInvoke<DeletePartnerEventSourceResponse>(asyncResult);
}
#endregion
#region DeleteRule
/// <summary>
/// Deletes the specified rule.
///
///
/// <para>
/// Before you can delete the rule, you must remove all targets, using <a>RemoveTargets</a>.
/// </para>
///
/// <para>
/// When you delete a rule, incoming events might continue to match to the deleted rule.
/// Allow a short period of time for changes to take effect.
/// </para>
///
/// <para>
/// Managed rules are rules created and managed by another AWS service on your behalf.
/// These rules are created by those other AWS services to support functionality in those
/// services. You can delete these rules using the <code>Force</code> option, but you
/// should do so only if you are sure the other service is not still using that rule.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DeleteRule service method.</param>
///
/// <returns>The response from the DeleteRule service method, as returned by EventBridge.</returns>
/// <exception cref="Amazon.EventBridge.Model.ConcurrentModificationException">
/// There is concurrent modification on a rule or target.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.InternalException">
/// This exception occurs due to unexpected causes.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.ManagedRuleException">
/// This rule was created by an AWS service on behalf of your account. It is managed by
/// that service. If you see this error in response to <code>DeleteRule</code> or <code>RemoveTargets</code>,
/// you can use the <code>Force</code> parameter in those calls to delete the rule or
/// remove targets from the rule. You cannot modify these managed rules by using <code>DisableRule</code>,
/// <code>EnableRule</code>, <code>PutTargets</code>, <code>PutRule</code>, <code>TagResource</code>,
/// or <code>UntagResource</code>.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.ResourceNotFoundException">
/// An entity that you specified does not exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/DeleteRule">REST API Reference for DeleteRule Operation</seealso>
public virtual DeleteRuleResponse DeleteRule(DeleteRuleRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteRuleResponseUnmarshaller.Instance;
return Invoke<DeleteRuleResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DeleteRule operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DeleteRule operation on AmazonEventBridgeClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDeleteRule
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/DeleteRule">REST API Reference for DeleteRule Operation</seealso>
public virtual IAsyncResult BeginDeleteRule(DeleteRuleRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteRuleResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DeleteRule operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDeleteRule.</param>
///
/// <returns>Returns a DeleteRuleResult from EventBridge.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/DeleteRule">REST API Reference for DeleteRule Operation</seealso>
public virtual DeleteRuleResponse EndDeleteRule(IAsyncResult asyncResult)
{
return EndInvoke<DeleteRuleResponse>(asyncResult);
}
#endregion
#region DescribeEventBus
/// <summary>
/// Displays details about an event bus in your account. This can include the external
/// AWS accounts that are permitted to write events to your default event bus, and the
/// associated policy. For custom event buses and partner event buses, it displays the
/// name, ARN, policy, state, and creation time.
///
///
/// <para>
/// To enable your account to receive events from other accounts on its default event
/// bus, use <a>PutPermission</a>.
/// </para>
///
/// <para>
/// For more information about partner event buses, see <a>CreateEventBus</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeEventBus service method.</param>
///
/// <returns>The response from the DescribeEventBus service method, as returned by EventBridge.</returns>
/// <exception cref="Amazon.EventBridge.Model.InternalException">
/// This exception occurs due to unexpected causes.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.ResourceNotFoundException">
/// An entity that you specified does not exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/DescribeEventBus">REST API Reference for DescribeEventBus Operation</seealso>
public virtual DescribeEventBusResponse DescribeEventBus(DescribeEventBusRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeEventBusRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeEventBusResponseUnmarshaller.Instance;
return Invoke<DescribeEventBusResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DescribeEventBus operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DescribeEventBus operation on AmazonEventBridgeClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDescribeEventBus
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/DescribeEventBus">REST API Reference for DescribeEventBus Operation</seealso>
public virtual IAsyncResult BeginDescribeEventBus(DescribeEventBusRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeEventBusRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeEventBusResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DescribeEventBus operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDescribeEventBus.</param>
///
/// <returns>Returns a DescribeEventBusResult from EventBridge.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/DescribeEventBus">REST API Reference for DescribeEventBus Operation</seealso>
public virtual DescribeEventBusResponse EndDescribeEventBus(IAsyncResult asyncResult)
{
return EndInvoke<DescribeEventBusResponse>(asyncResult);
}
#endregion
#region DescribeEventSource
/// <summary>
/// This operation lists details about a partner event source that is shared with your
/// account.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeEventSource service method.</param>
///
/// <returns>The response from the DescribeEventSource service method, as returned by EventBridge.</returns>
/// <exception cref="Amazon.EventBridge.Model.InternalException">
/// This exception occurs due to unexpected causes.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.OperationDisabledException">
/// The operation you are attempting is not available in this region.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.ResourceNotFoundException">
/// An entity that you specified does not exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/DescribeEventSource">REST API Reference for DescribeEventSource Operation</seealso>
public virtual DescribeEventSourceResponse DescribeEventSource(DescribeEventSourceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeEventSourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeEventSourceResponseUnmarshaller.Instance;
return Invoke<DescribeEventSourceResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DescribeEventSource operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DescribeEventSource operation on AmazonEventBridgeClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDescribeEventSource
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/DescribeEventSource">REST API Reference for DescribeEventSource Operation</seealso>
public virtual IAsyncResult BeginDescribeEventSource(DescribeEventSourceRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeEventSourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeEventSourceResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DescribeEventSource operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDescribeEventSource.</param>
///
/// <returns>Returns a DescribeEventSourceResult from EventBridge.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/DescribeEventSource">REST API Reference for DescribeEventSource Operation</seealso>
public virtual DescribeEventSourceResponse EndDescribeEventSource(IAsyncResult asyncResult)
{
return EndInvoke<DescribeEventSourceResponse>(asyncResult);
}
#endregion
#region DescribePartnerEventSource
/// <summary>
/// An SaaS partner can use this operation to list details about a partner event source
/// that they have created. AWS customers do not use this operation. Instead, AWS customers
/// can use <a>DescribeEventSource</a> to see details about a partner event source that
/// is shared with them.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribePartnerEventSource service method.</param>
///
/// <returns>The response from the DescribePartnerEventSource service method, as returned by EventBridge.</returns>
/// <exception cref="Amazon.EventBridge.Model.InternalException">
/// This exception occurs due to unexpected causes.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.OperationDisabledException">
/// The operation you are attempting is not available in this region.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.ResourceNotFoundException">
/// An entity that you specified does not exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/DescribePartnerEventSource">REST API Reference for DescribePartnerEventSource Operation</seealso>
public virtual DescribePartnerEventSourceResponse DescribePartnerEventSource(DescribePartnerEventSourceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribePartnerEventSourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribePartnerEventSourceResponseUnmarshaller.Instance;
return Invoke<DescribePartnerEventSourceResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DescribePartnerEventSource operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DescribePartnerEventSource operation on AmazonEventBridgeClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDescribePartnerEventSource
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/DescribePartnerEventSource">REST API Reference for DescribePartnerEventSource Operation</seealso>
public virtual IAsyncResult BeginDescribePartnerEventSource(DescribePartnerEventSourceRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribePartnerEventSourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribePartnerEventSourceResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DescribePartnerEventSource operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDescribePartnerEventSource.</param>
///
/// <returns>Returns a DescribePartnerEventSourceResult from EventBridge.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/DescribePartnerEventSource">REST API Reference for DescribePartnerEventSource Operation</seealso>
public virtual DescribePartnerEventSourceResponse EndDescribePartnerEventSource(IAsyncResult asyncResult)
{
return EndInvoke<DescribePartnerEventSourceResponse>(asyncResult);
}
#endregion
#region DescribeRule
/// <summary>
/// Describes the specified rule.
///
///
/// <para>
/// DescribeRule does not list the targets of a rule. To see the targets associated with
/// a rule, use <a>ListTargetsByRule</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DescribeRule service method.</param>
///
/// <returns>The response from the DescribeRule service method, as returned by EventBridge.</returns>
/// <exception cref="Amazon.EventBridge.Model.InternalException">
/// This exception occurs due to unexpected causes.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.ResourceNotFoundException">
/// An entity that you specified does not exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/DescribeRule">REST API Reference for DescribeRule Operation</seealso>
public virtual DescribeRuleResponse DescribeRule(DescribeRuleRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeRuleResponseUnmarshaller.Instance;
return Invoke<DescribeRuleResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DescribeRule operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DescribeRule operation on AmazonEventBridgeClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDescribeRule
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/DescribeRule">REST API Reference for DescribeRule Operation</seealso>
public virtual IAsyncResult BeginDescribeRule(DescribeRuleRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeRuleResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DescribeRule operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDescribeRule.</param>
///
/// <returns>Returns a DescribeRuleResult from EventBridge.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/DescribeRule">REST API Reference for DescribeRule Operation</seealso>
public virtual DescribeRuleResponse EndDescribeRule(IAsyncResult asyncResult)
{
return EndInvoke<DescribeRuleResponse>(asyncResult);
}
#endregion
#region DisableRule
/// <summary>
/// Disables the specified rule. A disabled rule won't match any events, and won't self-trigger
/// if it has a schedule expression.
///
///
/// <para>
/// When you disable a rule, incoming events might continue to match to the disabled rule.
/// Allow a short period of time for changes to take effect.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the DisableRule service method.</param>
///
/// <returns>The response from the DisableRule service method, as returned by EventBridge.</returns>
/// <exception cref="Amazon.EventBridge.Model.ConcurrentModificationException">
/// There is concurrent modification on a rule or target.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.InternalException">
/// This exception occurs due to unexpected causes.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.ManagedRuleException">
/// This rule was created by an AWS service on behalf of your account. It is managed by
/// that service. If you see this error in response to <code>DeleteRule</code> or <code>RemoveTargets</code>,
/// you can use the <code>Force</code> parameter in those calls to delete the rule or
/// remove targets from the rule. You cannot modify these managed rules by using <code>DisableRule</code>,
/// <code>EnableRule</code>, <code>PutTargets</code>, <code>PutRule</code>, <code>TagResource</code>,
/// or <code>UntagResource</code>.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.ResourceNotFoundException">
/// An entity that you specified does not exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/DisableRule">REST API Reference for DisableRule Operation</seealso>
public virtual DisableRuleResponse DisableRule(DisableRuleRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DisableRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = DisableRuleResponseUnmarshaller.Instance;
return Invoke<DisableRuleResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the DisableRule operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the DisableRule operation on AmazonEventBridgeClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDisableRule
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/DisableRule">REST API Reference for DisableRule Operation</seealso>
public virtual IAsyncResult BeginDisableRule(DisableRuleRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = DisableRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = DisableRuleResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the DisableRule operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginDisableRule.</param>
///
/// <returns>Returns a DisableRuleResult from EventBridge.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/DisableRule">REST API Reference for DisableRule Operation</seealso>
public virtual DisableRuleResponse EndDisableRule(IAsyncResult asyncResult)
{
return EndInvoke<DisableRuleResponse>(asyncResult);
}
#endregion
#region EnableRule
/// <summary>
/// Enables the specified rule. If the rule does not exist, the operation fails.
///
///
/// <para>
/// When you enable a rule, incoming events might not immediately start matching to a
/// newly enabled rule. Allow a short period of time for changes to take effect.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the EnableRule service method.</param>
///
/// <returns>The response from the EnableRule service method, as returned by EventBridge.</returns>
/// <exception cref="Amazon.EventBridge.Model.ConcurrentModificationException">
/// There is concurrent modification on a rule or target.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.InternalException">
/// This exception occurs due to unexpected causes.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.ManagedRuleException">
/// This rule was created by an AWS service on behalf of your account. It is managed by
/// that service. If you see this error in response to <code>DeleteRule</code> or <code>RemoveTargets</code>,
/// you can use the <code>Force</code> parameter in those calls to delete the rule or
/// remove targets from the rule. You cannot modify these managed rules by using <code>DisableRule</code>,
/// <code>EnableRule</code>, <code>PutTargets</code>, <code>PutRule</code>, <code>TagResource</code>,
/// or <code>UntagResource</code>.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.ResourceNotFoundException">
/// An entity that you specified does not exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/EnableRule">REST API Reference for EnableRule Operation</seealso>
public virtual EnableRuleResponse EnableRule(EnableRuleRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = EnableRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = EnableRuleResponseUnmarshaller.Instance;
return Invoke<EnableRuleResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the EnableRule operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the EnableRule operation on AmazonEventBridgeClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndEnableRule
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/EnableRule">REST API Reference for EnableRule Operation</seealso>
public virtual IAsyncResult BeginEnableRule(EnableRuleRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = EnableRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = EnableRuleResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the EnableRule operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginEnableRule.</param>
///
/// <returns>Returns a EnableRuleResult from EventBridge.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/EnableRule">REST API Reference for EnableRule Operation</seealso>
public virtual EnableRuleResponse EndEnableRule(IAsyncResult asyncResult)
{
return EndInvoke<EnableRuleResponse>(asyncResult);
}
#endregion
#region ListEventBuses
/// <summary>
/// Lists all the event buses in your account, including the default event bus, custom
/// event buses, and partner event buses.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListEventBuses service method.</param>
///
/// <returns>The response from the ListEventBuses service method, as returned by EventBridge.</returns>
/// <exception cref="Amazon.EventBridge.Model.InternalException">
/// This exception occurs due to unexpected causes.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/ListEventBuses">REST API Reference for ListEventBuses Operation</seealso>
public virtual ListEventBusesResponse ListEventBuses(ListEventBusesRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListEventBusesRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListEventBusesResponseUnmarshaller.Instance;
return Invoke<ListEventBusesResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListEventBuses operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListEventBuses operation on AmazonEventBridgeClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndListEventBuses
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/ListEventBuses">REST API Reference for ListEventBuses Operation</seealso>
public virtual IAsyncResult BeginListEventBuses(ListEventBusesRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListEventBusesRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListEventBusesResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the ListEventBuses operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginListEventBuses.</param>
///
/// <returns>Returns a ListEventBusesResult from EventBridge.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/ListEventBuses">REST API Reference for ListEventBuses Operation</seealso>
public virtual ListEventBusesResponse EndListEventBuses(IAsyncResult asyncResult)
{
return EndInvoke<ListEventBusesResponse>(asyncResult);
}
#endregion
#region ListEventSources
/// <summary>
/// You can use this to see all the partner event sources that have been shared with your
/// AWS account. For more information about partner event sources, see <a>CreateEventBus</a>.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListEventSources service method.</param>
///
/// <returns>The response from the ListEventSources service method, as returned by EventBridge.</returns>
/// <exception cref="Amazon.EventBridge.Model.InternalException">
/// This exception occurs due to unexpected causes.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.OperationDisabledException">
/// The operation you are attempting is not available in this region.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/ListEventSources">REST API Reference for ListEventSources Operation</seealso>
public virtual ListEventSourcesResponse ListEventSources(ListEventSourcesRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListEventSourcesRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListEventSourcesResponseUnmarshaller.Instance;
return Invoke<ListEventSourcesResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListEventSources operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListEventSources operation on AmazonEventBridgeClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndListEventSources
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/ListEventSources">REST API Reference for ListEventSources Operation</seealso>
public virtual IAsyncResult BeginListEventSources(ListEventSourcesRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListEventSourcesRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListEventSourcesResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the ListEventSources operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginListEventSources.</param>
///
/// <returns>Returns a ListEventSourcesResult from EventBridge.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/ListEventSources">REST API Reference for ListEventSources Operation</seealso>
public virtual ListEventSourcesResponse EndListEventSources(IAsyncResult asyncResult)
{
return EndInvoke<ListEventSourcesResponse>(asyncResult);
}
#endregion
#region ListPartnerEventSourceAccounts
/// <summary>
/// An SaaS partner can use this operation to display the AWS account ID that a particular
/// partner event source name is associated with. This operation is not used by AWS customers.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListPartnerEventSourceAccounts service method.</param>
///
/// <returns>The response from the ListPartnerEventSourceAccounts service method, as returned by EventBridge.</returns>
/// <exception cref="Amazon.EventBridge.Model.InternalException">
/// This exception occurs due to unexpected causes.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.OperationDisabledException">
/// The operation you are attempting is not available in this region.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.ResourceNotFoundException">
/// An entity that you specified does not exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/ListPartnerEventSourceAccounts">REST API Reference for ListPartnerEventSourceAccounts Operation</seealso>
public virtual ListPartnerEventSourceAccountsResponse ListPartnerEventSourceAccounts(ListPartnerEventSourceAccountsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListPartnerEventSourceAccountsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListPartnerEventSourceAccountsResponseUnmarshaller.Instance;
return Invoke<ListPartnerEventSourceAccountsResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListPartnerEventSourceAccounts operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListPartnerEventSourceAccounts operation on AmazonEventBridgeClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndListPartnerEventSourceAccounts
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/ListPartnerEventSourceAccounts">REST API Reference for ListPartnerEventSourceAccounts Operation</seealso>
public virtual IAsyncResult BeginListPartnerEventSourceAccounts(ListPartnerEventSourceAccountsRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListPartnerEventSourceAccountsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListPartnerEventSourceAccountsResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the ListPartnerEventSourceAccounts operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginListPartnerEventSourceAccounts.</param>
///
/// <returns>Returns a ListPartnerEventSourceAccountsResult from EventBridge.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/ListPartnerEventSourceAccounts">REST API Reference for ListPartnerEventSourceAccounts Operation</seealso>
public virtual ListPartnerEventSourceAccountsResponse EndListPartnerEventSourceAccounts(IAsyncResult asyncResult)
{
return EndInvoke<ListPartnerEventSourceAccountsResponse>(asyncResult);
}
#endregion
#region ListPartnerEventSources
/// <summary>
/// An SaaS partner can use this operation to list all the partner event source names
/// that they have created. This operation is not used by AWS customers.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListPartnerEventSources service method.</param>
///
/// <returns>The response from the ListPartnerEventSources service method, as returned by EventBridge.</returns>
/// <exception cref="Amazon.EventBridge.Model.InternalException">
/// This exception occurs due to unexpected causes.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.OperationDisabledException">
/// The operation you are attempting is not available in this region.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/ListPartnerEventSources">REST API Reference for ListPartnerEventSources Operation</seealso>
public virtual ListPartnerEventSourcesResponse ListPartnerEventSources(ListPartnerEventSourcesRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListPartnerEventSourcesRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListPartnerEventSourcesResponseUnmarshaller.Instance;
return Invoke<ListPartnerEventSourcesResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListPartnerEventSources operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListPartnerEventSources operation on AmazonEventBridgeClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndListPartnerEventSources
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/ListPartnerEventSources">REST API Reference for ListPartnerEventSources Operation</seealso>
public virtual IAsyncResult BeginListPartnerEventSources(ListPartnerEventSourcesRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListPartnerEventSourcesRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListPartnerEventSourcesResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the ListPartnerEventSources operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginListPartnerEventSources.</param>
///
/// <returns>Returns a ListPartnerEventSourcesResult from EventBridge.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/ListPartnerEventSources">REST API Reference for ListPartnerEventSources Operation</seealso>
public virtual ListPartnerEventSourcesResponse EndListPartnerEventSources(IAsyncResult asyncResult)
{
return EndInvoke<ListPartnerEventSourcesResponse>(asyncResult);
}
#endregion
#region ListRuleNamesByTarget
/// <summary>
/// Lists the rules for the specified target. You can see which of the rules in Amazon
/// EventBridge can invoke a specific target in your account.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListRuleNamesByTarget service method.</param>
///
/// <returns>The response from the ListRuleNamesByTarget service method, as returned by EventBridge.</returns>
/// <exception cref="Amazon.EventBridge.Model.InternalException">
/// This exception occurs due to unexpected causes.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.ResourceNotFoundException">
/// An entity that you specified does not exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/ListRuleNamesByTarget">REST API Reference for ListRuleNamesByTarget Operation</seealso>
public virtual ListRuleNamesByTargetResponse ListRuleNamesByTarget(ListRuleNamesByTargetRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListRuleNamesByTargetRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListRuleNamesByTargetResponseUnmarshaller.Instance;
return Invoke<ListRuleNamesByTargetResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListRuleNamesByTarget operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListRuleNamesByTarget operation on AmazonEventBridgeClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndListRuleNamesByTarget
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/ListRuleNamesByTarget">REST API Reference for ListRuleNamesByTarget Operation</seealso>
public virtual IAsyncResult BeginListRuleNamesByTarget(ListRuleNamesByTargetRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListRuleNamesByTargetRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListRuleNamesByTargetResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the ListRuleNamesByTarget operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginListRuleNamesByTarget.</param>
///
/// <returns>Returns a ListRuleNamesByTargetResult from EventBridge.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/ListRuleNamesByTarget">REST API Reference for ListRuleNamesByTarget Operation</seealso>
public virtual ListRuleNamesByTargetResponse EndListRuleNamesByTarget(IAsyncResult asyncResult)
{
return EndInvoke<ListRuleNamesByTargetResponse>(asyncResult);
}
#endregion
#region ListRules
/// <summary>
/// Lists your Amazon EventBridge rules. You can either list all the rules or you can
/// provide a prefix to match to the rule names.
///
///
/// <para>
/// ListRules does not list the targets of a rule. To see the targets associated with
/// a rule, use <a>ListTargetsByRule</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListRules service method.</param>
///
/// <returns>The response from the ListRules service method, as returned by EventBridge.</returns>
/// <exception cref="Amazon.EventBridge.Model.InternalException">
/// This exception occurs due to unexpected causes.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.ResourceNotFoundException">
/// An entity that you specified does not exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/ListRules">REST API Reference for ListRules Operation</seealso>
public virtual ListRulesResponse ListRules(ListRulesRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListRulesRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListRulesResponseUnmarshaller.Instance;
return Invoke<ListRulesResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListRules operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListRules operation on AmazonEventBridgeClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndListRules
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/ListRules">REST API Reference for ListRules Operation</seealso>
public virtual IAsyncResult BeginListRules(ListRulesRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListRulesRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListRulesResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the ListRules operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginListRules.</param>
///
/// <returns>Returns a ListRulesResult from EventBridge.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/ListRules">REST API Reference for ListRules Operation</seealso>
public virtual ListRulesResponse EndListRules(IAsyncResult asyncResult)
{
return EndInvoke<ListRulesResponse>(asyncResult);
}
#endregion
#region ListTagsForResource
/// <summary>
/// Displays the tags associated with an EventBridge resource. In EventBridge, rules and
/// event buses can be tagged.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListTagsForResource service method.</param>
///
/// <returns>The response from the ListTagsForResource service method, as returned by EventBridge.</returns>
/// <exception cref="Amazon.EventBridge.Model.InternalException">
/// This exception occurs due to unexpected causes.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.ResourceNotFoundException">
/// An entity that you specified does not exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/ListTagsForResource">REST API Reference for ListTagsForResource Operation</seealso>
public virtual ListTagsForResourceResponse ListTagsForResource(ListTagsForResourceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListTagsForResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListTagsForResourceResponseUnmarshaller.Instance;
return Invoke<ListTagsForResourceResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListTagsForResource operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListTagsForResource operation on AmazonEventBridgeClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndListTagsForResource
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/ListTagsForResource">REST API Reference for ListTagsForResource Operation</seealso>
public virtual IAsyncResult BeginListTagsForResource(ListTagsForResourceRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListTagsForResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListTagsForResourceResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the ListTagsForResource operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginListTagsForResource.</param>
///
/// <returns>Returns a ListTagsForResourceResult from EventBridge.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/ListTagsForResource">REST API Reference for ListTagsForResource Operation</seealso>
public virtual ListTagsForResourceResponse EndListTagsForResource(IAsyncResult asyncResult)
{
return EndInvoke<ListTagsForResourceResponse>(asyncResult);
}
#endregion
#region ListTargetsByRule
/// <summary>
/// Lists the targets assigned to the specified rule.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the ListTargetsByRule service method.</param>
///
/// <returns>The response from the ListTargetsByRule service method, as returned by EventBridge.</returns>
/// <exception cref="Amazon.EventBridge.Model.InternalException">
/// This exception occurs due to unexpected causes.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.ResourceNotFoundException">
/// An entity that you specified does not exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/ListTargetsByRule">REST API Reference for ListTargetsByRule Operation</seealso>
public virtual ListTargetsByRuleResponse ListTargetsByRule(ListTargetsByRuleRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListTargetsByRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListTargetsByRuleResponseUnmarshaller.Instance;
return Invoke<ListTargetsByRuleResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the ListTargetsByRule operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the ListTargetsByRule operation on AmazonEventBridgeClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndListTargetsByRule
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/ListTargetsByRule">REST API Reference for ListTargetsByRule Operation</seealso>
public virtual IAsyncResult BeginListTargetsByRule(ListTargetsByRuleRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListTargetsByRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListTargetsByRuleResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the ListTargetsByRule operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginListTargetsByRule.</param>
///
/// <returns>Returns a ListTargetsByRuleResult from EventBridge.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/ListTargetsByRule">REST API Reference for ListTargetsByRule Operation</seealso>
public virtual ListTargetsByRuleResponse EndListTargetsByRule(IAsyncResult asyncResult)
{
return EndInvoke<ListTargetsByRuleResponse>(asyncResult);
}
#endregion
#region PutEvents
/// <summary>
/// Sends custom events to Amazon EventBridge so that they can be matched to rules.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the PutEvents service method.</param>
///
/// <returns>The response from the PutEvents service method, as returned by EventBridge.</returns>
/// <exception cref="Amazon.EventBridge.Model.InternalException">
/// This exception occurs due to unexpected causes.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/PutEvents">REST API Reference for PutEvents Operation</seealso>
public virtual PutEventsResponse PutEvents(PutEventsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = PutEventsRequestMarshaller.Instance;
options.ResponseUnmarshaller = PutEventsResponseUnmarshaller.Instance;
return Invoke<PutEventsResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the PutEvents operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the PutEvents operation on AmazonEventBridgeClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndPutEvents
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/PutEvents">REST API Reference for PutEvents Operation</seealso>
public virtual IAsyncResult BeginPutEvents(PutEventsRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = PutEventsRequestMarshaller.Instance;
options.ResponseUnmarshaller = PutEventsResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the PutEvents operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginPutEvents.</param>
///
/// <returns>Returns a PutEventsResult from EventBridge.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/PutEvents">REST API Reference for PutEvents Operation</seealso>
public virtual PutEventsResponse EndPutEvents(IAsyncResult asyncResult)
{
return EndInvoke<PutEventsResponse>(asyncResult);
}
#endregion
#region PutPartnerEvents
/// <summary>
/// This is used by SaaS partners to write events to a customer's partner event bus. AWS
/// customers do not use this operation.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the PutPartnerEvents service method.</param>
///
/// <returns>The response from the PutPartnerEvents service method, as returned by EventBridge.</returns>
/// <exception cref="Amazon.EventBridge.Model.InternalException">
/// This exception occurs due to unexpected causes.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.OperationDisabledException">
/// The operation you are attempting is not available in this region.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/PutPartnerEvents">REST API Reference for PutPartnerEvents Operation</seealso>
public virtual PutPartnerEventsResponse PutPartnerEvents(PutPartnerEventsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = PutPartnerEventsRequestMarshaller.Instance;
options.ResponseUnmarshaller = PutPartnerEventsResponseUnmarshaller.Instance;
return Invoke<PutPartnerEventsResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the PutPartnerEvents operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the PutPartnerEvents operation on AmazonEventBridgeClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndPutPartnerEvents
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/PutPartnerEvents">REST API Reference for PutPartnerEvents Operation</seealso>
public virtual IAsyncResult BeginPutPartnerEvents(PutPartnerEventsRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = PutPartnerEventsRequestMarshaller.Instance;
options.ResponseUnmarshaller = PutPartnerEventsResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the PutPartnerEvents operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginPutPartnerEvents.</param>
///
/// <returns>Returns a PutPartnerEventsResult from EventBridge.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/PutPartnerEvents">REST API Reference for PutPartnerEvents Operation</seealso>
public virtual PutPartnerEventsResponse EndPutPartnerEvents(IAsyncResult asyncResult)
{
return EndInvoke<PutPartnerEventsResponse>(asyncResult);
}
#endregion
#region PutPermission
/// <summary>
/// Running <code>PutPermission</code> permits the specified AWS account or AWS organization
/// to put events to the specified <i>event bus</i>. Amazon EventBridge (CloudWatch Events)
/// rules in your account are triggered by these events arriving to an event bus in your
/// account.
///
///
/// <para>
/// For another account to send events to your account, that external account must have
/// an EventBridge rule with your account's event bus as a target.
/// </para>
///
/// <para>
/// To enable multiple AWS accounts to put events to your event bus, run <code>PutPermission</code>
/// once for each of these accounts. Or, if all the accounts are members of the same AWS
/// organization, you can run <code>PutPermission</code> once specifying <code>Principal</code>
/// as "*" and specifying the AWS organization ID in <code>Condition</code>, to grant
/// permissions to all accounts in that organization.
/// </para>
///
/// <para>
/// If you grant permissions using an organization, then accounts in that organization
/// must specify a <code>RoleArn</code> with proper permissions when they use <code>PutTarget</code>
/// to add your account's event bus as a target. For more information, see <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eventbridge-cross-account-event-delivery.html">Sending
/// and Receiving Events Between AWS Accounts</a> in the <i>Amazon EventBridge User Guide</i>.
/// </para>
///
/// <para>
/// The permission policy on the default event bus cannot exceed 10 KB in size.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the PutPermission service method.</param>
///
/// <returns>The response from the PutPermission service method, as returned by EventBridge.</returns>
/// <exception cref="Amazon.EventBridge.Model.ConcurrentModificationException">
/// There is concurrent modification on a rule or target.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.InternalException">
/// This exception occurs due to unexpected causes.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.PolicyLengthExceededException">
/// The event bus policy is too long. For more information, see the limits.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.ResourceNotFoundException">
/// An entity that you specified does not exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/PutPermission">REST API Reference for PutPermission Operation</seealso>
public virtual PutPermissionResponse PutPermission(PutPermissionRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = PutPermissionRequestMarshaller.Instance;
options.ResponseUnmarshaller = PutPermissionResponseUnmarshaller.Instance;
return Invoke<PutPermissionResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the PutPermission operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the PutPermission operation on AmazonEventBridgeClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndPutPermission
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/PutPermission">REST API Reference for PutPermission Operation</seealso>
public virtual IAsyncResult BeginPutPermission(PutPermissionRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = PutPermissionRequestMarshaller.Instance;
options.ResponseUnmarshaller = PutPermissionResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the PutPermission operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginPutPermission.</param>
///
/// <returns>Returns a PutPermissionResult from EventBridge.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/PutPermission">REST API Reference for PutPermission Operation</seealso>
public virtual PutPermissionResponse EndPutPermission(IAsyncResult asyncResult)
{
return EndInvoke<PutPermissionResponse>(asyncResult);
}
#endregion
#region PutRule
/// <summary>
/// Creates or updates the specified rule. Rules are enabled by default, or based on value
/// of the state. You can disable a rule using <a>DisableRule</a>.
///
///
/// <para>
/// A single rule watches for events from a single event bus. Events generated by AWS
/// services go to your account's default event bus. Events generated by SaaS partner
/// services or applications go to the matching partner event bus. If you have custom
/// applications or services, you can specify whether their events go to your default
/// event bus or a custom event bus that you have created. For more information, see <a>CreateEventBus</a>.
/// </para>
///
/// <para>
/// If you are updating an existing rule, the rule is replaced with what you specify in
/// this <code>PutRule</code> command. If you omit arguments in <code>PutRule</code>,
/// the old values for those arguments are not kept. Instead, they are replaced with null
/// values.
/// </para>
///
/// <para>
/// When you create or update a rule, incoming events might not immediately start matching
/// to new or updated rules. Allow a short period of time for changes to take effect.
/// </para>
///
/// <para>
/// A rule must contain at least an EventPattern or ScheduleExpression. Rules with EventPatterns
/// are triggered when a matching event is observed. Rules with ScheduleExpressions self-trigger
/// based on the given schedule. A rule can have both an EventPattern and a ScheduleExpression,
/// in which case the rule triggers on matching events as well as on a schedule.
/// </para>
///
/// <para>
/// When you initially create a rule, you can optionally assign one or more tags to the
/// rule. Tags can help you organize and categorize your resources. You can also use them
/// to scope user permissions, by granting a user permission to access or change only
/// rules with certain tag values. To use the <code>PutRule</code> operation and assign
/// tags, you must have both the <code>events:PutRule</code> and <code>events:TagResource</code>
/// permissions.
/// </para>
///
/// <para>
/// If you are updating an existing rule, any tags you specify in the <code>PutRule</code>
/// operation are ignored. To update the tags of an existing rule, use <a>TagResource</a>
/// and <a>UntagResource</a>.
/// </para>
///
/// <para>
/// Most services in AWS treat : or / as the same character in Amazon Resource Names (ARNs).
/// However, EventBridge uses an exact match in event patterns and rules. Be sure to use
/// the correct ARN characters when creating event patterns so that they match the ARN
/// syntax in the event you want to match.
/// </para>
///
/// <para>
/// In EventBridge, it is possible to create rules that lead to infinite loops, where
/// a rule is fired repeatedly. For example, a rule might detect that ACLs have changed
/// on an S3 bucket, and trigger software to change them to the desired state. If the
/// rule is not written carefully, the subsequent change to the ACLs fires the rule again,
/// creating an infinite loop.
/// </para>
///
/// <para>
/// To prevent this, write the rules so that the triggered actions do not re-fire the
/// same rule. For example, your rule could fire only if ACLs are found to be in a bad
/// state, instead of after any change.
/// </para>
///
/// <para>
/// An infinite loop can quickly cause higher than expected charges. We recommend that
/// you use budgeting, which alerts you when charges exceed your specified limit. For
/// more information, see <a href="https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/budgets-managing-costs.html">Managing
/// Your Costs with Budgets</a>.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the PutRule service method.</param>
///
/// <returns>The response from the PutRule service method, as returned by EventBridge.</returns>
/// <exception cref="Amazon.EventBridge.Model.ConcurrentModificationException">
/// There is concurrent modification on a rule or target.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.InternalException">
/// This exception occurs due to unexpected causes.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.InvalidEventPatternException">
/// The event pattern is not valid.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.LimitExceededException">
/// You tried to create more rules or add more targets to a rule than is allowed.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.ManagedRuleException">
/// This rule was created by an AWS service on behalf of your account. It is managed by
/// that service. If you see this error in response to <code>DeleteRule</code> or <code>RemoveTargets</code>,
/// you can use the <code>Force</code> parameter in those calls to delete the rule or
/// remove targets from the rule. You cannot modify these managed rules by using <code>DisableRule</code>,
/// <code>EnableRule</code>, <code>PutTargets</code>, <code>PutRule</code>, <code>TagResource</code>,
/// or <code>UntagResource</code>.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.ResourceNotFoundException">
/// An entity that you specified does not exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/PutRule">REST API Reference for PutRule Operation</seealso>
public virtual PutRuleResponse PutRule(PutRuleRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = PutRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = PutRuleResponseUnmarshaller.Instance;
return Invoke<PutRuleResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the PutRule operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the PutRule operation on AmazonEventBridgeClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndPutRule
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/PutRule">REST API Reference for PutRule Operation</seealso>
public virtual IAsyncResult BeginPutRule(PutRuleRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = PutRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = PutRuleResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the PutRule operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginPutRule.</param>
///
/// <returns>Returns a PutRuleResult from EventBridge.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/PutRule">REST API Reference for PutRule Operation</seealso>
public virtual PutRuleResponse EndPutRule(IAsyncResult asyncResult)
{
return EndInvoke<PutRuleResponse>(asyncResult);
}
#endregion
#region PutTargets
/// <summary>
/// Adds the specified targets to the specified rule, or updates the targets if they are
/// already associated with the rule.
///
///
/// <para>
/// Targets are the resources that are invoked when a rule is triggered.
/// </para>
///
/// <para>
/// You can configure the following as targets for Events:
/// </para>
/// <ul> <li>
/// <para>
/// EC2 instances
/// </para>
/// </li> <li>
/// <para>
/// SSM Run Command
/// </para>
/// </li> <li>
/// <para>
/// SSM Automation
/// </para>
/// </li> <li>
/// <para>
/// AWS Lambda functions
/// </para>
/// </li> <li>
/// <para>
/// Data streams in Amazon Kinesis Data Streams
/// </para>
/// </li> <li>
/// <para>
/// Data delivery streams in Amazon Kinesis Data Firehose
/// </para>
/// </li> <li>
/// <para>
/// Amazon ECS tasks
/// </para>
/// </li> <li>
/// <para>
/// AWS Step Functions state machines
/// </para>
/// </li> <li>
/// <para>
/// AWS Batch jobs
/// </para>
/// </li> <li>
/// <para>
/// AWS CodeBuild projects
/// </para>
/// </li> <li>
/// <para>
/// Pipelines in AWS CodePipeline
/// </para>
/// </li> <li>
/// <para>
/// Amazon Inspector assessment templates
/// </para>
/// </li> <li>
/// <para>
/// Amazon SNS topics
/// </para>
/// </li> <li>
/// <para>
/// Amazon SQS queues, including FIFO queues
/// </para>
/// </li> <li>
/// <para>
/// The default event bus of another AWS account
/// </para>
/// </li> <li>
/// <para>
/// Amazon API Gateway REST APIs
/// </para>
/// </li> </ul>
/// <para>
/// Creating rules with built-in targets is supported only in the AWS Management Console.
/// The built-in targets are <code>EC2 CreateSnapshot API call</code>, <code>EC2 RebootInstances
/// API call</code>, <code>EC2 StopInstances API call</code>, and <code>EC2 TerminateInstances
/// API call</code>.
/// </para>
///
/// <para>
/// For some target types, <code>PutTargets</code> provides target-specific parameters.
/// If the target is a Kinesis data stream, you can optionally specify which shard the
/// event goes to by using the <code>KinesisParameters</code> argument. To invoke a command
/// on multiple EC2 instances with one rule, you can use the <code>RunCommandParameters</code>
/// field.
/// </para>
///
/// <para>
/// To be able to make API calls against the resources that you own, Amazon EventBridge
/// (CloudWatch Events) needs the appropriate permissions. For AWS Lambda and Amazon SNS
/// resources, EventBridge relies on resource-based policies. For EC2 instances, Kinesis
/// data streams, AWS Step Functions state machines and API Gateway REST APIs, EventBridge
/// relies on IAM roles that you specify in the <code>RoleARN</code> argument in <code>PutTargets</code>.
/// For more information, see <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/auth-and-access-control-eventbridge.html">Authentication
/// and Access Control</a> in the <i>Amazon EventBridge User Guide</i>.
/// </para>
///
/// <para>
/// If another AWS account is in the same region and has granted you permission (using
/// <code>PutPermission</code>), you can send events to that account. Set that account's
/// event bus as a target of the rules in your account. To send the matched events to
/// the other account, specify that account's event bus as the <code>Arn</code> value
/// when you run <code>PutTargets</code>. If your account sends events to another account,
/// your account is charged for each sent event. Each event sent to another account is
/// charged as a custom event. The account receiving the event is not charged. For more
/// information, see <a href="https://aws.amazon.com/eventbridge/pricing/">Amazon EventBridge
/// (CloudWatch Events) Pricing</a>.
/// </para>
/// <note>
/// <para>
/// <code>Input</code>, <code>InputPath</code>, and <code>InputTransformer</code> are
/// not available with <code>PutTarget</code> if the target is an event bus of a different
/// AWS account.
/// </para>
/// </note>
/// <para>
/// If you are setting the event bus of another account as the target, and that account
/// granted permission to your account through an organization instead of directly by
/// the account ID, then you must specify a <code>RoleArn</code> with proper permissions
/// in the <code>Target</code> structure. For more information, see <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eventbridge-cross-account-event-delivery.html">Sending
/// and Receiving Events Between AWS Accounts</a> in the <i>Amazon EventBridge User Guide</i>.
/// </para>
///
/// <para>
/// For more information about enabling cross-account events, see <a>PutPermission</a>.
/// </para>
///
/// <para>
/// <b>Input</b>, <b>InputPath</b>, and <b>InputTransformer</b> are mutually exclusive
/// and optional parameters of a target. When a rule is triggered due to a matched event:
/// </para>
/// <ul> <li>
/// <para>
/// If none of the following arguments are specified for a target, then the entire event
/// is passed to the target in JSON format (unless the target is Amazon EC2 Run Command
/// or Amazon ECS task, in which case nothing from the event is passed to the target).
/// </para>
/// </li> <li>
/// <para>
/// If <b>Input</b> is specified in the form of valid JSON, then the matched event is
/// overridden with this constant.
/// </para>
/// </li> <li>
/// <para>
/// If <b>InputPath</b> is specified in the form of JSONPath (for example, <code>$.detail</code>),
/// then only the part of the event specified in the path is passed to the target (for
/// example, only the detail part of the event is passed).
/// </para>
/// </li> <li>
/// <para>
/// If <b>InputTransformer</b> is specified, then one or more specified JSONPaths are
/// extracted from the event and used as values in a template that you specify as the
/// input to the target.
/// </para>
/// </li> </ul>
/// <para>
/// When you specify <code>InputPath</code> or <code>InputTransformer</code>, you must
/// use JSON dot notation, not bracket notation.
/// </para>
///
/// <para>
/// When you add targets to a rule and the associated rule triggers soon after, new or
/// updated targets might not be immediately invoked. Allow a short period of time for
/// changes to take effect.
/// </para>
///
/// <para>
/// This action can partially fail if too many requests are made at the same time. If
/// that happens, <code>FailedEntryCount</code> is non-zero in the response and each entry
/// in <code>FailedEntries</code> provides the ID of the failed target and the error code.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the PutTargets service method.</param>
///
/// <returns>The response from the PutTargets service method, as returned by EventBridge.</returns>
/// <exception cref="Amazon.EventBridge.Model.ConcurrentModificationException">
/// There is concurrent modification on a rule or target.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.InternalException">
/// This exception occurs due to unexpected causes.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.LimitExceededException">
/// You tried to create more rules or add more targets to a rule than is allowed.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.ManagedRuleException">
/// This rule was created by an AWS service on behalf of your account. It is managed by
/// that service. If you see this error in response to <code>DeleteRule</code> or <code>RemoveTargets</code>,
/// you can use the <code>Force</code> parameter in those calls to delete the rule or
/// remove targets from the rule. You cannot modify these managed rules by using <code>DisableRule</code>,
/// <code>EnableRule</code>, <code>PutTargets</code>, <code>PutRule</code>, <code>TagResource</code>,
/// or <code>UntagResource</code>.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.ResourceNotFoundException">
/// An entity that you specified does not exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/PutTargets">REST API Reference for PutTargets Operation</seealso>
public virtual PutTargetsResponse PutTargets(PutTargetsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = PutTargetsRequestMarshaller.Instance;
options.ResponseUnmarshaller = PutTargetsResponseUnmarshaller.Instance;
return Invoke<PutTargetsResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the PutTargets operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the PutTargets operation on AmazonEventBridgeClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndPutTargets
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/PutTargets">REST API Reference for PutTargets Operation</seealso>
public virtual IAsyncResult BeginPutTargets(PutTargetsRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = PutTargetsRequestMarshaller.Instance;
options.ResponseUnmarshaller = PutTargetsResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the PutTargets operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginPutTargets.</param>
///
/// <returns>Returns a PutTargetsResult from EventBridge.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/PutTargets">REST API Reference for PutTargets Operation</seealso>
public virtual PutTargetsResponse EndPutTargets(IAsyncResult asyncResult)
{
return EndInvoke<PutTargetsResponse>(asyncResult);
}
#endregion
#region RemovePermission
/// <summary>
/// Revokes the permission of another AWS account to be able to put events to the specified
/// event bus. Specify the account to revoke by the <code>StatementId</code> value that
/// you associated with the account when you granted it permission with <code>PutPermission</code>.
/// You can find the <code>StatementId</code> by using <a>DescribeEventBus</a>.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the RemovePermission service method.</param>
///
/// <returns>The response from the RemovePermission service method, as returned by EventBridge.</returns>
/// <exception cref="Amazon.EventBridge.Model.ConcurrentModificationException">
/// There is concurrent modification on a rule or target.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.InternalException">
/// This exception occurs due to unexpected causes.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.ResourceNotFoundException">
/// An entity that you specified does not exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/RemovePermission">REST API Reference for RemovePermission Operation</seealso>
public virtual RemovePermissionResponse RemovePermission(RemovePermissionRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = RemovePermissionRequestMarshaller.Instance;
options.ResponseUnmarshaller = RemovePermissionResponseUnmarshaller.Instance;
return Invoke<RemovePermissionResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the RemovePermission operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the RemovePermission operation on AmazonEventBridgeClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndRemovePermission
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/RemovePermission">REST API Reference for RemovePermission Operation</seealso>
public virtual IAsyncResult BeginRemovePermission(RemovePermissionRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = RemovePermissionRequestMarshaller.Instance;
options.ResponseUnmarshaller = RemovePermissionResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the RemovePermission operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginRemovePermission.</param>
///
/// <returns>Returns a RemovePermissionResult from EventBridge.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/RemovePermission">REST API Reference for RemovePermission Operation</seealso>
public virtual RemovePermissionResponse EndRemovePermission(IAsyncResult asyncResult)
{
return EndInvoke<RemovePermissionResponse>(asyncResult);
}
#endregion
#region RemoveTargets
/// <summary>
/// Removes the specified targets from the specified rule. When the rule is triggered,
/// those targets are no longer be invoked.
///
///
/// <para>
/// When you remove a target, when the associated rule triggers, removed targets might
/// continue to be invoked. Allow a short period of time for changes to take effect.
/// </para>
///
/// <para>
/// This action can partially fail if too many requests are made at the same time. If
/// that happens, <code>FailedEntryCount</code> is non-zero in the response and each entry
/// in <code>FailedEntries</code> provides the ID of the failed target and the error code.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the RemoveTargets service method.</param>
///
/// <returns>The response from the RemoveTargets service method, as returned by EventBridge.</returns>
/// <exception cref="Amazon.EventBridge.Model.ConcurrentModificationException">
/// There is concurrent modification on a rule or target.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.InternalException">
/// This exception occurs due to unexpected causes.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.ManagedRuleException">
/// This rule was created by an AWS service on behalf of your account. It is managed by
/// that service. If you see this error in response to <code>DeleteRule</code> or <code>RemoveTargets</code>,
/// you can use the <code>Force</code> parameter in those calls to delete the rule or
/// remove targets from the rule. You cannot modify these managed rules by using <code>DisableRule</code>,
/// <code>EnableRule</code>, <code>PutTargets</code>, <code>PutRule</code>, <code>TagResource</code>,
/// or <code>UntagResource</code>.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.ResourceNotFoundException">
/// An entity that you specified does not exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/RemoveTargets">REST API Reference for RemoveTargets Operation</seealso>
public virtual RemoveTargetsResponse RemoveTargets(RemoveTargetsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = RemoveTargetsRequestMarshaller.Instance;
options.ResponseUnmarshaller = RemoveTargetsResponseUnmarshaller.Instance;
return Invoke<RemoveTargetsResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the RemoveTargets operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the RemoveTargets operation on AmazonEventBridgeClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndRemoveTargets
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/RemoveTargets">REST API Reference for RemoveTargets Operation</seealso>
public virtual IAsyncResult BeginRemoveTargets(RemoveTargetsRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = RemoveTargetsRequestMarshaller.Instance;
options.ResponseUnmarshaller = RemoveTargetsResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the RemoveTargets operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginRemoveTargets.</param>
///
/// <returns>Returns a RemoveTargetsResult from EventBridge.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/RemoveTargets">REST API Reference for RemoveTargets Operation</seealso>
public virtual RemoveTargetsResponse EndRemoveTargets(IAsyncResult asyncResult)
{
return EndInvoke<RemoveTargetsResponse>(asyncResult);
}
#endregion
#region TagResource
/// <summary>
/// Assigns one or more tags (key-value pairs) to the specified EventBridge resource.
/// Tags can help you organize and categorize your resources. You can also use them to
/// scope user permissions by granting a user permission to access or change only resources
/// with certain tag values. In EventBridge, rules and event buses can be tagged.
///
///
/// <para>
/// Tags don't have any semantic meaning to AWS and are interpreted strictly as strings
/// of characters.
/// </para>
///
/// <para>
/// You can use the <code>TagResource</code> action with a resource that already has tags.
/// If you specify a new tag key, this tag is appended to the list of tags associated
/// with the resource. If you specify a tag key that is already associated with the resource,
/// the new tag value that you specify replaces the previous value for that tag.
/// </para>
///
/// <para>
/// You can associate as many as 50 tags with a resource.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the TagResource service method.</param>
///
/// <returns>The response from the TagResource service method, as returned by EventBridge.</returns>
/// <exception cref="Amazon.EventBridge.Model.ConcurrentModificationException">
/// There is concurrent modification on a rule or target.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.InternalException">
/// This exception occurs due to unexpected causes.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.ManagedRuleException">
/// This rule was created by an AWS service on behalf of your account. It is managed by
/// that service. If you see this error in response to <code>DeleteRule</code> or <code>RemoveTargets</code>,
/// you can use the <code>Force</code> parameter in those calls to delete the rule or
/// remove targets from the rule. You cannot modify these managed rules by using <code>DisableRule</code>,
/// <code>EnableRule</code>, <code>PutTargets</code>, <code>PutRule</code>, <code>TagResource</code>,
/// or <code>UntagResource</code>.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.ResourceNotFoundException">
/// An entity that you specified does not exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/TagResource">REST API Reference for TagResource Operation</seealso>
public virtual TagResourceResponse TagResource(TagResourceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = TagResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = TagResourceResponseUnmarshaller.Instance;
return Invoke<TagResourceResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the TagResource operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the TagResource operation on AmazonEventBridgeClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndTagResource
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/TagResource">REST API Reference for TagResource Operation</seealso>
public virtual IAsyncResult BeginTagResource(TagResourceRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = TagResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = TagResourceResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the TagResource operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginTagResource.</param>
///
/// <returns>Returns a TagResourceResult from EventBridge.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/TagResource">REST API Reference for TagResource Operation</seealso>
public virtual TagResourceResponse EndTagResource(IAsyncResult asyncResult)
{
return EndInvoke<TagResourceResponse>(asyncResult);
}
#endregion
#region TestEventPattern
/// <summary>
/// Tests whether the specified event pattern matches the provided event.
///
///
/// <para>
/// Most services in AWS treat : or / as the same character in Amazon Resource Names (ARNs).
/// However, EventBridge uses an exact match in event patterns and rules. Be sure to use
/// the correct ARN characters when creating event patterns so that they match the ARN
/// syntax in the event you want to match.
/// </para>
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the TestEventPattern service method.</param>
///
/// <returns>The response from the TestEventPattern service method, as returned by EventBridge.</returns>
/// <exception cref="Amazon.EventBridge.Model.InternalException">
/// This exception occurs due to unexpected causes.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.InvalidEventPatternException">
/// The event pattern is not valid.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/TestEventPattern">REST API Reference for TestEventPattern Operation</seealso>
public virtual TestEventPatternResponse TestEventPattern(TestEventPatternRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = TestEventPatternRequestMarshaller.Instance;
options.ResponseUnmarshaller = TestEventPatternResponseUnmarshaller.Instance;
return Invoke<TestEventPatternResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the TestEventPattern operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the TestEventPattern operation on AmazonEventBridgeClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndTestEventPattern
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/TestEventPattern">REST API Reference for TestEventPattern Operation</seealso>
public virtual IAsyncResult BeginTestEventPattern(TestEventPatternRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = TestEventPatternRequestMarshaller.Instance;
options.ResponseUnmarshaller = TestEventPatternResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the TestEventPattern operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginTestEventPattern.</param>
///
/// <returns>Returns a TestEventPatternResult from EventBridge.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/TestEventPattern">REST API Reference for TestEventPattern Operation</seealso>
public virtual TestEventPatternResponse EndTestEventPattern(IAsyncResult asyncResult)
{
return EndInvoke<TestEventPatternResponse>(asyncResult);
}
#endregion
#region UntagResource
/// <summary>
/// Removes one or more tags from the specified EventBridge resource. In Amazon EventBridge
/// (CloudWatch Events, rules and event buses can be tagged.
/// </summary>
/// <param name="request">Container for the necessary parameters to execute the UntagResource service method.</param>
///
/// <returns>The response from the UntagResource service method, as returned by EventBridge.</returns>
/// <exception cref="Amazon.EventBridge.Model.ConcurrentModificationException">
/// There is concurrent modification on a rule or target.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.InternalException">
/// This exception occurs due to unexpected causes.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.ManagedRuleException">
/// This rule was created by an AWS service on behalf of your account. It is managed by
/// that service. If you see this error in response to <code>DeleteRule</code> or <code>RemoveTargets</code>,
/// you can use the <code>Force</code> parameter in those calls to delete the rule or
/// remove targets from the rule. You cannot modify these managed rules by using <code>DisableRule</code>,
/// <code>EnableRule</code>, <code>PutTargets</code>, <code>PutRule</code>, <code>TagResource</code>,
/// or <code>UntagResource</code>.
/// </exception>
/// <exception cref="Amazon.EventBridge.Model.ResourceNotFoundException">
/// An entity that you specified does not exist.
/// </exception>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/UntagResource">REST API Reference for UntagResource Operation</seealso>
public virtual UntagResourceResponse UntagResource(UntagResourceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UntagResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = UntagResourceResponseUnmarshaller.Instance;
return Invoke<UntagResourceResponse>(request, options);
}
/// <summary>
/// Initiates the asynchronous execution of the UntagResource operation.
/// </summary>
///
/// <param name="request">Container for the necessary parameters to execute the UntagResource operation on AmazonEventBridgeClient.</param>
/// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
/// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
/// procedure using the AsyncState property.</param>
///
/// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndUntagResource
/// operation.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/UntagResource">REST API Reference for UntagResource Operation</seealso>
public virtual IAsyncResult BeginUntagResource(UntagResourceRequest request, AsyncCallback callback, object state)
{
var options = new InvokeOptions();
options.RequestMarshaller = UntagResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = UntagResourceResponseUnmarshaller.Instance;
return BeginInvoke(request, options, callback, state);
}
/// <summary>
/// Finishes the asynchronous execution of the UntagResource operation.
/// </summary>
///
/// <param name="asyncResult">The IAsyncResult returned by the call to BeginUntagResource.</param>
///
/// <returns>Returns a UntagResourceResult from EventBridge.</returns>
/// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/eventbridge-2015-10-07/UntagResource">REST API Reference for UntagResource Operation</seealso>
public virtual UntagResourceResponse EndUntagResource(IAsyncResult asyncResult)
{
return EndInvoke<UntagResourceResponse>(asyncResult);
}
#endregion
}
} | 55.925844 | 203 | 0.663396 | [
"Apache-2.0"
] | joshongithub/aws-sdk-net | sdk/src/Services/EventBridge/Generated/_bcl35/AmazonEventBridgeClient.cs | 152,342 | C# |
using UnityEngine;
using System;
//-----------------------------------------------------------------------------
// structure definition
//-----------------------------------------------------------------------------
namespace UnityEngine.Experimental.Rendering.HDPipeline
{
[GenerateHLSL(PackingRules.Exact)]
public enum ShaderPass
{
GBuffer,
Forward,
ForwardUnlit,
DeferredLighting,
DepthOnly,
Velocity,
Distortion,
LightTransport,
Shadows,
SubsurfaceScattering,
VolumeVoxelization,
VolumetricLighting,
DbufferProjector,
DbufferMesh,
ForwardEmissiveProjector,
ForwardEmissiveMesh,
Raytracing,
RaytracingIndirect,
RaytracingVisibility,
RaytracingForward,
}
}
| 24.617647 | 79 | 0.510155 | [
"MIT"
] | ToadsworthLP/Millenium | Library/PackageCache/com.unity.render-pipelines.high-definition@5.10.0-preview/Runtime/RenderPipeline/ShaderPass/ShaderPass.cs | 837 | C# |
// The MIT License (MIT)
//
// Copyright (c) 2014-2017, Institute for Software & Systems Engineering
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
namespace Tests.Execution.Components.Fields
{
using System.Collections.Generic;
using SafetySharp.Modeling;
using SafetySharp.Runtime;
using Shouldly;
using Utilities;
internal class List : TestObject
{
protected override void Check()
{
var c = new C { Sub = new D(), F = new List<int>() };
c.GetStateFields().ShouldBe(new[] { typeof(C).GetField("F") });
}
private class C : Component
{
public List<int> F;
public Component Sub;
}
private class D : Component
{
}
}
} | 33.8 | 80 | 0.731953 | [
"MIT"
] | isse-augsburg/ssharp | SafetySharpTests/Execution/Components/Fields/list.cs | 1,692 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations;
using Microsoft.AspNetCore.Http;
namespace MovieTheater.Validations
{
public class FileWeightValidation : ValidationAttribute
{
private readonly int maxWeightInMb;
public FileWeightValidation(int maxWeightInMb)
{
this.maxWeightInMb = maxWeightInMb;
}
protected override ValidationResult IsValid(object value, ValidationContext validationContext)
{
if (value == null) return ValidationResult.Success;
var formFile = value as IFormFile;
if (formFile == null) return ValidationResult.Success;
if (formFile.Length > maxWeightInMb * 1024 * 1024)
{
return new ValidationResult($"The weight of the file can't be higher than {maxWeightInMb}mb.");
}
return ValidationResult.Success;
}
}
}
| 29.647059 | 111 | 0.662698 | [
"MIT"
] | NeshGogo/movie-theater | MovieTheater/Validations/FileWeightValidation.cs | 1,010 | C# |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("TestDNetLibrary")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TestDNetLibrary")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("6e4af2f9-ddca-4547-80b8-363e30258e30")]
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 30 | 56 | 0.757143 | [
"MIT"
] | yamanobori-old/DNetLibrary | TestDNetLibrary/Properties/AssemblyInfo.cs | 631 | C# |
using Reception.App.Model.Auth;
using Reception.Model.Interface;
using System.Threading.Tasks;
namespace Reception.App.Network.Auth
{
public interface IUserService
{
AuthenticateResponse AuthData { get; }
public IToken Token { get; }
Task<AuthenticateResponse> Authenticate(AuthenticateRequest request);
Task<bool> IsAuthValid();
void SetUserAuth(int userId, string token);
}
} | 22.894737 | 77 | 0.701149 | [
"MIT"
] | kirichenec/ReceptionNetCore | src/Reception.App.Network/Auth/IUserService.cs | 437 | C# |
#if NETSTANDARD2_0
namespace System.IO
{
using System.Buffers;
/// <summary>
/// Shims for .netstandard 2.0.
/// </summary>
public static class TextWriterExtensions
{
/// <summary>
/// Writes <paramref name="buffer"/> to <paramref name="writer"/>.
/// Just a copy of code that is in .NET Core so .netstandard2.0 can use it.
/// </summary>
/// <param name="writer">The text writer to write to.</param>
/// <param name="buffer">The data to write.</param>
public static void Write(this TextWriter writer, ReadOnlySpan<char> buffer)
{
// Writes a span of characters to the text stream.
char[] array = ArrayPool<char>.Shared.Rent(buffer.Length);
try
{
buffer.CopyTo(new Span<char>(array));
writer.Write(array, 0, buffer.Length);
}
finally
{
ArrayPool<char>.Shared.Return(array);
}
}
}
}
#endif | 25.787879 | 77 | 0.654524 | [
"MIT"
] | Michmcb/SectionConfig | src/SectionConfig/Shims/TextWriterExtensions.cs | 853 | C# |
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
namespace Pulumi.Aws.WafV2.Inputs
{
public sealed class RuleGroupRuleStatementOrStatementStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchAllQueryArgumentsGetArgs : Pulumi.ResourceArgs
{
public RuleGroupRuleStatementOrStatementStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchAllQueryArgumentsGetArgs()
{
}
}
}
| 35.75 | 178 | 0.798601 | [
"ECL-2.0",
"Apache-2.0"
] | Otanikotani/pulumi-aws | sdk/dotnet/WafV2/Inputs/RuleGroupRuleStatementOrStatementStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchAllQueryArgumentsGetArgs.cs | 715 | C# |
/*
* The contents of this file are subject to MIT Licence. Please
* view License.txt for further details.
*
* The Original Code was created by Simon Carter (s1cart3r@gmail.com)
*
* Copyright (c) 2015 Simon Carter
*
* Purpose: Simple control for selecting a colour
*
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
namespace SharedControls
{
/// <summary>
/// Color selector control
///
/// Allows users to select colors
/// </summary>
public partial class ColorSelector : UserControl
{
#region Constructors
/// <summary>
/// Constructor - Initialises new instance
/// </summary>
public ColorSelector()
{
InitializeComponent();
LoadColors();
}
#endregion Constructors
#region Properties
/// <summary>
/// Description above color selector
/// </summary>
public string Description
{
get
{
return (lblDescription.Text);
}
set
{
lblDescription.Text = value;
}
}
/// <summary>
/// Selected color
/// </summary>
public Color Color
{
get
{
Color Result = (Color)cmbColorSelector.SelectedItem;
return (Result);
}
set
{
foreach (Color color in cmbColorSelector.Items)
{
if (color.Name == value.Name)
{
cmbColorSelector.SelectedItem = color;
break;
}
}
}
}
#endregion Properties
#region Private Methods
private void LoadColors()
{
cmbColorSelector.Items.Clear();
foreach (KnownColor colorValue in Enum.GetValues(typeof(KnownColor)))
{
Color color = Color.FromKnownColor((KnownColor)colorValue);
cmbColorSelector.Items.Add(color);
}
if (cmbColorSelector.SelectedIndex == -1)
cmbColorSelector.SelectedIndex = 0;
}
private void cmbColorSelector_DrawItem(object sender, DrawItemEventArgs e)
{
if (e.Index == -1)
return;
System.Drawing.Color currentColor = (System.Drawing.Color)cmbColorSelector.Items[e.Index];
// Draw the background of the item.
e.DrawBackground();
// Create a square filled with the animals color. Vary the size
// of the rectangle based on the length of the animals name.
Rectangle rectangle = new Rectangle(2, e.Bounds.Top + 2,
e.Bounds.Height, e.Bounds.Height - 4);
e.Graphics.FillRectangle(new SolidBrush(currentColor), rectangle);
e.Graphics.DrawString(currentColor.Name, cmbColorSelector.Font, System.Drawing.Brushes.Black,
new RectangleF(e.Bounds.X+rectangle.Width, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height));
// Draw the focus rectangle if the mouse hovers over an item.
e.DrawFocusRectangle();
}
#endregion Private Methods
}
}
| 26.381679 | 105 | 0.540509 | [
"MIT"
] | k3ldar/SharedControls | Controls/ColorSelector.cs | 3,458 | C# |
using System;
using System.Xml.Serialization;
using System.ComponentModel.DataAnnotations;
using BroadWorksConnector.Ocip.Validation;
using System.Collections.Generic;
namespace BroadWorksConnector.Ocip.Models
{
/// <summary>
/// Add one or more voice mail aliases to a users voice message.
/// The response is either a SuccessResponse or an ErrorResponse.
/// <see cref="SuccessResponse"/>
/// <see cref="ErrorResponse"/>
/// </summary>
[Serializable]
[XmlRoot(Namespace = "")]
[Groups(@"[{""__type"":""Sequence:#BroadWorksConnector.Ocip.Validation"",""id"":""3347d430e0d5c93a9ff8dcf0e3b60d6c:1659""}]")]
public class UserVoiceMessagingUserAddAliasListRequest : BroadWorksConnector.Ocip.Models.C.OCIRequest
{
private string _userId;
[XmlElement(ElementName = "userId", IsNullable = false, Namespace = "")]
[Group(@"3347d430e0d5c93a9ff8dcf0e3b60d6c:1659")]
[MinLength(1)]
[MaxLength(161)]
public string UserId
{
get => _userId;
set
{
UserIdSpecified = true;
_userId = value;
}
}
[XmlIgnore]
protected bool UserIdSpecified { get; set; }
private List<string> _phoneNumber = new List<string>();
[XmlElement(ElementName = "phoneNumber", IsNullable = false, Namespace = "")]
[Group(@"3347d430e0d5c93a9ff8dcf0e3b60d6c:1659")]
[MinLength(1)]
[MaxLength(23)]
public List<string> PhoneNumber
{
get => _phoneNumber;
set
{
PhoneNumberSpecified = true;
_phoneNumber = value;
}
}
[XmlIgnore]
protected bool PhoneNumberSpecified { get; set; }
}
}
| 29.193548 | 130 | 0.598343 | [
"MIT"
] | Rogn/broadworks-connector-net | BroadworksConnector/Ocip/Models/UserVoiceMessagingUserAddAliasListRequest.cs | 1,810 | C# |
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Windows.Forms;
namespace Desktop
{
public partial class WorkspaceControl : UserControl
{
public IWorkspace Workspace { get; set; }
private Dictionary<IActivity, TabPage> _tabs = new Dictionary<IActivity, TabPage>();
private Dictionary<IActivity, TabPage> _sideTabs = new Dictionary<IActivity, TabPage>();
private HashSet<TabPage> _spacers = new HashSet<TabPage>();
private bool _forceSwitch = false;
private bool _activated;
public WorkspaceControl()
{
InitializeComponent();
}
internal void AddActivity(IActivity activity)
{
activity.Activated += Activity_Activated;
Control ctl = activity as Control;
if (ctl == null)
throw new ArgumentException($"Expected activity {activity.GetType().Name} to be an instance of Control");
if (activity.GetType().GetCustomAttribute<SpacerAttribute>() != null)
{
AddSpacer(activity.Pane);
}
//Create the tab page
TabPage page = new TabPage();
page.Text = activity.Caption;
page.Tag = activity;
ctl.Dock = DockStyle.Fill;
page.Controls.Add(ctl);
switch (activity.Pane)
{
case WorkspacePane.Main:
tabActivities.TabPages.Add(page);
_tabs[activity] = page;
break;
case WorkspacePane.Sidebar:
tabSidebarActivities.TabPages.Add(page);
_sideTabs[activity] = page;
break;
}
UpdateTabVisibility();
}
private void AddSpacer(WorkspacePane pane)
{
TabPage page = new TabPage();
page.Tag = "spacer";
switch (pane)
{
case WorkspacePane.Main:
tabActivities.TabPages.Add(page);
break;
case WorkspacePane.Sidebar:
tabSidebarActivities.TabPages.Add(page);
break;
}
_spacers.Add(page);
}
internal void RemoveActivity(IActivity activity)
{
activity.Activated -= Activity_Activated;
switch (activity.Pane)
{
case WorkspacePane.Main:
TabPage tab = _tabs[activity];
tabActivities.TabPages.Remove(tab);
_tabs.Remove(activity);
break;
case WorkspacePane.Sidebar:
tab = _sideTabs[activity];
tabSidebarActivities.TabPages.Remove(tab);
_sideTabs.Remove(activity);
break;
}
UpdateTabVisibility();
}
private void Activity_Activated(object sender, EventArgs e)
{
_forceSwitch = true;
TabPage tab;
IActivity activity = sender as IActivity;
if (_tabs.TryGetValue(activity, out tab))
{
tabActivities.SelectedTab = tab;
}
else if (_sideTabs.TryGetValue(activity, out tab))
{
if (!_activated)
{
tabSidebarActivities.SelectedTab = tab;
splitContainer1.SplitterDistance = Math.Min(splitContainer1.Width - 10, splitContainer1.Width - Math.Max(100, activity.SidebarWidth));
_activated = true;
}
}
_forceSwitch = false;
}
private void UpdateTabVisibility()
{
if (_tabs.Count == 0)
return;
TabPage page = tabActivities.TabPages[0];
Control ctl = page.Tag as Control;
DockTabPage(_tabs, tabActivities, splitContainer1.Panel1, stripActivities);
//Update sidebar visibility
if (tabSidebarActivities.TabPages.Count == 0)
{
splitContainer1.Panel2Collapsed = true;
}
else
{
splitContainer1.Panel2Collapsed = false;
DockTabPage(_sideTabs, tabSidebarActivities, sidebar, stripSidebar);
}
}
private void DockTabPage(Dictionary<IActivity, TabPage> tabs, TabControl tabControl, Control parentControl, Control tabStrip)
{
TabPage page = tabControl.TabPages[0];
Control ctl = page.Tag as Control;
if (tabs.Count == 1)
{
//Move the control out of the tabstrip
parentControl.Controls.Add(ctl);
tabControl.Visible = false;
tabStrip.Visible = false;
}
else
{
//put the control back into the tabstrip
page.Controls.Add(ctl);
tabControl.Visible = true;
tabStrip.Visible = true;
}
}
private void OnSelectingTab(object sender, TabControlCancelEventArgs e)
{
if (_spacers.Contains(e.TabPage))
{
e.Cancel = true;
return;
}
if (_forceSwitch)
return;
IActivity activity = e.TabPage.Tag as IActivity;
if (!Shell.Instance.Activate(activity))
e.Cancel = true;
}
public bool IsSidebarExpanded
{
get { return Workspace.ActiveSidebarActivity != null && !splitContainer1.Panel2Collapsed; }
}
public void ToggleSidebar(bool expanded)
{
if (Workspace.ActiveSidebarActivity == null) { return; }
splitContainer1.Panel2Collapsed = !expanded;
}
}
}
| 24.601093 | 139 | 0.691248 | [
"MIT"
] | laytonc32/spnati | editor source/Desktop/Controls/WorkspaceControl.cs | 4,504 | C# |
namespace NPatternRecognizer.Interface
{
using System;
using NPatternRecognizer.Common;
[Serializable()]
public class Example
{
#region Fields
private string m_id;
private SparseVector m_X;
private Category m_Label;
// foamliu, 2009/01/03, for SVM.
private bool m_isSV;
#endregion
#region Properties
public string ID
{
get
{
return m_id;
}
set
{
m_id = value;
}
}
public SparseVector X
{
get
{
return m_X;
}
set
{
m_X = value;
}
}
public Category Label
{
get
{
return m_Label;
}
set
{
m_Label = value;
}
}
// foamliu, 2009/01/03, for SVM.
public bool IsSV
{
get
{
return m_isSV;
}
set
{
m_isSV = value;
}
}
#endregion
#region Methods
#endregion
#region Constructors
public Example(Category c)
{
this.m_Label = c;
}
public Example()
{
}
#endregion
}
}
| 17.685393 | 41 | 0.344346 | [
"Apache-2.0"
] | foamliu/NPatternRecognizer | src/NPatternRecognizer/Interface/Example.cs | 1,576 | C# |
using System;
using System.IO;
using System.Xml;
using System.Xml.XPath;
using System.Security.Permissions;
using Microsoft.Win32;
using TestFramework.Run;
using TestFramework.Log;
using TestFramework.Exceptions;
using Holodeck;
using FaultsXMLFramework;
namespace FaultXMLTest
{
/// <summary>
/// Summary description for FaultXMLTest24.
/// Make Faults.xml with 'Faults Fault Function MatchParams MatchParam TestValue' Value Edited to "originalValue + testValue"
/// </summary>
public class FaultXMLTest24:FaultXMLTest
{
string FaultsXMLFilePath;
string FaultsXMLBackupFilePath;
FileInfo modifyThisFile;
public FaultXMLTest24()
{
}
public override void executeTest( )
{
Console.WriteLine("Test Case :Make Faults.xml with 'Faults Fault Function MatchParams MatchParam TestValue' Value Edited to \"originalValue + testValue\"");
try
{
string holodeckPath;
holodeckPath = (string) Registry.LocalMachine.OpenSubKey ("Software\\HolodeckEE", true).GetValue ("InstallPath");
FaultsXMLFilePath = string.Concat(holodeckPath,"\\function_db\\faults.xml");
FaultsXMLBackupFilePath = string.Concat(FaultsXMLFilePath,".bak");
modifyThisFile = new FileInfo(FaultsXMLFilePath);
modifyThisFile.Attributes = FileAttributes.Normal;
modifyThisFile.CopyTo(FaultsXMLBackupFilePath,true);
//modify xml here
FaultsXMLFilePath = modifyThisFile.FullName;
XmlDocument xmlDocument = new XmlDocument( );
xmlDocument.Load(FaultsXMLFilePath);
XmlNode nodeMatchParam = xmlDocument.SelectSingleNode( "/Faults/Fault/Function/MatchParams/MatchParam[@TestValue]" );
EditValues editMatchParamTestValue = new EditValues();
editMatchParamTestValue.EditMatchParam(nodeMatchParam,testValue,"TestValue");
xmlDocument.Save(FaultsXMLFilePath);
//add code here which will launch Holodeck
Holodeck.HolodeckProcess.Start();
}
catch(HolodeckExceptions.IncorrectRegistryException e)
{
Console.WriteLine(" Incorrect Registry Exception caught.... : " + e.Message);
Console.WriteLine("Details: " + e.StackTrace);
}
catch(FileNotFoundException f)
{
Console.WriteLine(" File Not Found Exception caught.... : " + f.Message);
Console.WriteLine("Details: " + f.StackTrace);
}
finally
{
if(Holodeck.HolodeckProcess.IsRunning ())
{
Holodeck.HolodeckProcess.Stop();
}
//reverting back to original
modifyThisFile.Delete();
FileInfo regainOriginal = new FileInfo(FaultsXMLBackupFilePath);
regainOriginal.MoveTo(FaultsXMLFilePath);
}
}
}
}
| 28.479167 | 160 | 0.698244 | [
"MIT"
] | SecurityInnovation/Holodeck | Test/Automation/TestingFaultsXML/TestingFaultsXML/FaultXMLTest24.cs | 2,734 | C# |
namespace IDisposableAnalyzers.Test.Helpers
{
using System;
using System.Linq;
using System.Threading;
using Gu.Roslyn.Asserts;
using Microsoft.CodeAnalysis.CSharp;
using NUnit.Framework;
internal class ConstructorsWalkerTests
{
[Test]
public void TwoInternalChained()
{
var syntaxTree = CSharpSyntaxTree.ParseText(@"
namespace RoslynSandbox
{
internal class Foo
{
internal Foo()
{
}
internal Foo(string text)
: this()
{
}
}
}");
var compilation = CSharpCompilation.Create("test", new[] { syntaxTree }, MetadataReferences.FromAttributes());
var semanticModel = compilation.GetSemanticModel(syntaxTree);
var type = syntaxTree.FindTypeDeclaration("Foo");
using (var walker = ConstructorsWalker.Borrow(type, semanticModel, CancellationToken.None))
{
var actual = string.Join(", ", walker.NonPrivateCtors.Select(c => c.ToString().Split(new[] { "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries)[0]));
Assert.AreEqual("internal Foo(), internal Foo(string text)", actual);
Assert.AreEqual(0, walker.ObjectCreations.Count);
}
}
[Test]
public void InternalPrivateChained()
{
var syntaxTree = CSharpSyntaxTree.ParseText(@"
namespace RoslynSandbox
{
internal class Foo
{
private Foo()
{
}
internal Foo(string text)
: this()
{
}
}
}");
var compilation = CSharpCompilation.Create("test", new[] { syntaxTree }, MetadataReferences.FromAttributes());
var semanticModel = compilation.GetSemanticModel(syntaxTree);
var type = syntaxTree.FindTypeDeclaration("Foo");
using (var pooled = ConstructorsWalker.Borrow(type, semanticModel, CancellationToken.None))
{
var actual = string.Join(", ", pooled.NonPrivateCtors.Select(c => c.ToString().Split(new[] { "\n", "\r\n" }, StringSplitOptions.RemoveEmptyEntries)[0]));
Assert.AreEqual("internal Foo(string text)", actual);
Assert.AreEqual(0, pooled.ObjectCreations.Count);
}
}
[Test]
public void PrivatePrivateFactory()
{
var syntaxTree = CSharpSyntaxTree.ParseText(@"
namespace RoslynSandbox
{
internal class Foo
{
private Foo()
{
}
internal Foo Create()
{
return new Foo();
}
}
}");
var compilation = CSharpCompilation.Create("test", new[] { syntaxTree }, MetadataReferences.FromAttributes());
var semanticModel = compilation.GetSemanticModel(syntaxTree);
var type = syntaxTree.FindTypeDeclaration("Foo");
using (var walker = ConstructorsWalker.Borrow(type, semanticModel, CancellationToken.None))
{
var actual = string.Join(", ", walker.NonPrivateCtors.Select(c => c.ToString().Split('\r')[0]));
Assert.AreEqual(string.Empty, actual);
Assert.AreEqual("new Foo()", string.Join(", ", walker.ObjectCreations));
}
}
}
}
| 32.683168 | 169 | 0.582854 | [
"MIT"
] | AArnott/IDisposableAnalyzers | IDisposableAnalyzers.Test/Helpers/ConstructorsWalkerTests.cs | 3,301 | C# |
using DarkSoulsII.DebugView.Core;
namespace DarkSoulsII.DebugView.Model.Resources.Param.Character
{
public class BossPartsParam : IReadable<BossPartsParam>
{
public BossPartsParam Read(IPointerFactory pointerFactory, IReader reader, int address, bool relative = false)
{
return this;
}
}
}
| 26.076923 | 118 | 0.699115 | [
"MIT"
] | Atvaark/DarkSoulsII.DebugView | DarkSoulsII.DebugView.Model/Resources/Param/Character/BossPartsParam.cs | 339 | C# |
using System;
using System.Diagnostics;
using System.IO;
using Codeer.Friendly.Dynamic;
using Codeer.Friendly.Windows;
using Codeer.Friendly.Windows.Grasp;
using RM.Friendly.WPFStandardControls;
using Tttt.Gui.Windows.Test.Helper;
namespace Tttt.Gui.Windows.Test.Driver
{
internal class AppDriver : IDisposable
{
private static string ExePath
{
get
{
const string exe =
#if DEBUG
"../../../../Tttt.Gui.Windows/bin/Debug/Tttt.Gui.Windows.exe";
#else
"../../../../Tttt.Gui.Windows/bin/Release/Tttt.Gui.Windows.exe";
#endif
return Path.GetFullPath(exe);
}
}
public void Dispose()
{
//タイムアップ終了していない場合は自ら終了させる
if (_killer.IsKilled == false)
_killer.Kill();
_killer.Dispose();
_app.Dispose();
_proc.Dispose();
}
public WindowControl MainWindow => _mainWindowDriver.Window;
private readonly Process _proc;
private readonly WindowsAppFriend _app;
private readonly MainWindowDriver _mainWindowDriver;
private readonly Killer _killer;
public AppDriver()
: this(null, 60 * 1000)
{
}
public AppDriver(string args, int timeoutMs)
{
_proc = Process.Start(ExePath, args);
_app = new WindowsAppFriend(_proc);
_mainWindowDriver = new MainWindowDriver(_app.Type<System.Windows.Application>().Current.MainWindow);
WPFStandardControls_3.Injection(_app);
WPFStandardControls_3_5.Injection(_app);
WPFStandardControls_4.Injection(_app);
WindowsAppExpander.LoadAssembly(_app, GetType().Assembly);
// ReSharper disable once PossibleNullReferenceException
_killer = new Killer(timeoutMs, _proc.Id);
}
}
} | 28.970149 | 113 | 0.599176 | [
"MIT"
] | YoshihiroIto/Tttt | Tttt/source/Tttt.Gui.Windows.Test/Driver/AppDriver.cs | 1,989 | C# |
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
//
using UnityEngine;
using System.Collections;
using System;
using HUX.Focus;
namespace HUX.Receivers
{
/// <summary>
/// Example receiver that scales based on gazing at an object
/// </summary>
public class GazeScaleReceiver : InteractionReceiver
{
[Tooltip("Target object to receive interactions for.")]
public GameObject TargetObject;
[Tooltip("When gazing scale up to the Target Scale")]
public Vector3 TargetScale = new Vector3(1.0f, 1.0f, 1.0f);
[Tooltip("Time it takes to scale to Target Scale")]
public float ScaleTime = 3.0f;
private Vector3 InitialScale;
private bool bScaling;
public void Awake()
{
InitialScale = TargetObject.transform.localScale;
}
protected void FocusEnter(FocusArgs args)
{
bScaling = true;
}
protected void FocusExit(FocusArgs args)
{
if (args.CurNumFocusers == 0)
{
bScaling = false;
}
}
public void Update()
{
if (bScaling)
{
TargetObject.transform.localScale = Vector3.Slerp(TargetObject.transform.localScale, TargetScale, Time.smoothDeltaTime / ScaleTime);
}
else if (TargetObject.transform.localScale != InitialScale)
{
TargetObject.transform.localScale = Vector3.Slerp(TargetObject.transform.localScale, InitialScale, Time.smoothDeltaTime / ScaleTime);
}
}
}
} | 30.271186 | 150 | 0.587346 | [
"MIT"
] | AhmedAldahshoury/HololensApp | DesignLabs_Unity/Assets/MRDesignLab/HUX/Scripts/Receivers/GazeScaleReceiver.cs | 1,786 | C# |
using CompanyName.MyMeetings.Modules.Payments.Application.Contracts;
using MediatR;
namespace CompanyName.MyMeetings.Modules.Payments.Application.Configuration.Queries
{
public interface IQueryHandler<in TQuery, TResult> :
IRequestHandler<TQuery, TResult> where TQuery : IQuery<TResult>
{
}
} | 28.727273 | 83 | 0.772152 | [
"MIT"
] | Allesad/modular-monolith-with-ddd | src/Modules/Payments/Application/Configuration/Queries/IQueryHandler.cs | 318 | C# |
// *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
using System;
using System.ComponentModel;
using Pulumi;
namespace Pulumi.AzureNextGen.Resources.V20201001
{
/// <summary>
/// The mode that is used to deploy resources. This value can be either Incremental or Complete. In Incremental mode, resources are deployed without deleting existing resources that are not included in the template. In Complete mode, resources are deployed and existing resources in the resource group that are not included in the template are deleted. Be careful when using Complete mode as you may unintentionally delete resources.
/// </summary>
[EnumType]
public readonly struct DeploymentMode : IEquatable<DeploymentMode>
{
private readonly string _value;
private DeploymentMode(string value)
{
_value = value ?? throw new ArgumentNullException(nameof(value));
}
public static DeploymentMode Incremental { get; } = new DeploymentMode("Incremental");
public static DeploymentMode Complete { get; } = new DeploymentMode("Complete");
public static bool operator ==(DeploymentMode left, DeploymentMode right) => left.Equals(right);
public static bool operator !=(DeploymentMode left, DeploymentMode right) => !left.Equals(right);
public static explicit operator string(DeploymentMode value) => value._value;
[EditorBrowsable(EditorBrowsableState.Never)]
public override bool Equals(object? obj) => obj is DeploymentMode other && Equals(other);
public bool Equals(DeploymentMode other) => string.Equals(_value, other._value, StringComparison.Ordinal);
[EditorBrowsable(EditorBrowsableState.Never)]
public override int GetHashCode() => _value?.GetHashCode() ?? 0;
public override string ToString() => _value;
}
/// <summary>
/// The scope to be used for evaluation of parameters, variables and functions in a nested template.
/// </summary>
[EnumType]
public readonly struct ExpressionEvaluationOptionsScopeType : IEquatable<ExpressionEvaluationOptionsScopeType>
{
private readonly string _value;
private ExpressionEvaluationOptionsScopeType(string value)
{
_value = value ?? throw new ArgumentNullException(nameof(value));
}
public static ExpressionEvaluationOptionsScopeType NotSpecified { get; } = new ExpressionEvaluationOptionsScopeType("NotSpecified");
public static ExpressionEvaluationOptionsScopeType Outer { get; } = new ExpressionEvaluationOptionsScopeType("Outer");
public static ExpressionEvaluationOptionsScopeType Inner { get; } = new ExpressionEvaluationOptionsScopeType("Inner");
public static bool operator ==(ExpressionEvaluationOptionsScopeType left, ExpressionEvaluationOptionsScopeType right) => left.Equals(right);
public static bool operator !=(ExpressionEvaluationOptionsScopeType left, ExpressionEvaluationOptionsScopeType right) => !left.Equals(right);
public static explicit operator string(ExpressionEvaluationOptionsScopeType value) => value._value;
[EditorBrowsable(EditorBrowsableState.Never)]
public override bool Equals(object? obj) => obj is ExpressionEvaluationOptionsScopeType other && Equals(other);
public bool Equals(ExpressionEvaluationOptionsScopeType other) => string.Equals(_value, other._value, StringComparison.Ordinal);
[EditorBrowsable(EditorBrowsableState.Never)]
public override int GetHashCode() => _value?.GetHashCode() ?? 0;
public override string ToString() => _value;
}
/// <summary>
/// Type of the managed identity.
/// </summary>
[EnumType]
public readonly struct ManagedServiceIdentityType : IEquatable<ManagedServiceIdentityType>
{
private readonly string _value;
private ManagedServiceIdentityType(string value)
{
_value = value ?? throw new ArgumentNullException(nameof(value));
}
public static ManagedServiceIdentityType UserAssigned { get; } = new ManagedServiceIdentityType("UserAssigned");
public static bool operator ==(ManagedServiceIdentityType left, ManagedServiceIdentityType right) => left.Equals(right);
public static bool operator !=(ManagedServiceIdentityType left, ManagedServiceIdentityType right) => !left.Equals(right);
public static explicit operator string(ManagedServiceIdentityType value) => value._value;
[EditorBrowsable(EditorBrowsableState.Never)]
public override bool Equals(object? obj) => obj is ManagedServiceIdentityType other && Equals(other);
public bool Equals(ManagedServiceIdentityType other) => string.Equals(_value, other._value, StringComparison.Ordinal);
[EditorBrowsable(EditorBrowsableState.Never)]
public override int GetHashCode() => _value?.GetHashCode() ?? 0;
public override string ToString() => _value;
}
/// <summary>
/// The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment.
/// </summary>
[EnumType]
public readonly struct OnErrorDeploymentType : IEquatable<OnErrorDeploymentType>
{
private readonly string _value;
private OnErrorDeploymentType(string value)
{
_value = value ?? throw new ArgumentNullException(nameof(value));
}
public static OnErrorDeploymentType LastSuccessful { get; } = new OnErrorDeploymentType("LastSuccessful");
public static OnErrorDeploymentType SpecificDeployment { get; } = new OnErrorDeploymentType("SpecificDeployment");
public static bool operator ==(OnErrorDeploymentType left, OnErrorDeploymentType right) => left.Equals(right);
public static bool operator !=(OnErrorDeploymentType left, OnErrorDeploymentType right) => !left.Equals(right);
public static explicit operator string(OnErrorDeploymentType value) => value._value;
[EditorBrowsable(EditorBrowsableState.Never)]
public override bool Equals(object? obj) => obj is OnErrorDeploymentType other && Equals(other);
public bool Equals(OnErrorDeploymentType other) => string.Equals(_value, other._value, StringComparison.Ordinal);
[EditorBrowsable(EditorBrowsableState.Never)]
public override int GetHashCode() => _value?.GetHashCode() ?? 0;
public override string ToString() => _value;
}
/// <summary>
/// The identity type.
/// </summary>
[EnumType]
public readonly struct ResourceIdentityType : IEquatable<ResourceIdentityType>
{
private readonly string _value;
private ResourceIdentityType(string value)
{
_value = value ?? throw new ArgumentNullException(nameof(value));
}
public static ResourceIdentityType SystemAssigned { get; } = new ResourceIdentityType("SystemAssigned");
public static ResourceIdentityType UserAssigned { get; } = new ResourceIdentityType("UserAssigned");
public static ResourceIdentityType SystemAssigned_UserAssigned { get; } = new ResourceIdentityType("SystemAssigned, UserAssigned");
public static ResourceIdentityType None { get; } = new ResourceIdentityType("None");
public static bool operator ==(ResourceIdentityType left, ResourceIdentityType right) => left.Equals(right);
public static bool operator !=(ResourceIdentityType left, ResourceIdentityType right) => !left.Equals(right);
public static explicit operator string(ResourceIdentityType value) => value._value;
[EditorBrowsable(EditorBrowsableState.Never)]
public override bool Equals(object? obj) => obj is ResourceIdentityType other && Equals(other);
public bool Equals(ResourceIdentityType other) => string.Equals(_value, other._value, StringComparison.Ordinal);
[EditorBrowsable(EditorBrowsableState.Never)]
public override int GetHashCode() => _value?.GetHashCode() ?? 0;
public override string ToString() => _value;
}
/// <summary>
/// Type of the script.
/// </summary>
[EnumType]
public readonly struct ScriptType : IEquatable<ScriptType>
{
private readonly string _value;
private ScriptType(string value)
{
_value = value ?? throw new ArgumentNullException(nameof(value));
}
public static ScriptType AzurePowerShell { get; } = new ScriptType("AzurePowerShell");
public static ScriptType AzureCLI { get; } = new ScriptType("AzureCLI");
public static bool operator ==(ScriptType left, ScriptType right) => left.Equals(right);
public static bool operator !=(ScriptType left, ScriptType right) => !left.Equals(right);
public static explicit operator string(ScriptType value) => value._value;
[EditorBrowsable(EditorBrowsableState.Never)]
public override bool Equals(object? obj) => obj is ScriptType other && Equals(other);
public bool Equals(ScriptType other) => string.Equals(_value, other._value, StringComparison.Ordinal);
[EditorBrowsable(EditorBrowsableState.Never)]
public override int GetHashCode() => _value?.GetHashCode() ?? 0;
public override string ToString() => _value;
}
}
| 47.616162 | 437 | 0.71224 | [
"Apache-2.0"
] | pulumi/pulumi-azure-nextgen | sdk/dotnet/Resources/V20201001/Enums.cs | 9,428 | C# |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("EnhancedDiscordUI")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EnhancedDiscordUI")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3639ae05-14e6-43b2-9ddb-1a3f4f52657c")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 38.027027 | 84 | 0.746979 | [
"MIT"
] | Hypertyrannical/EnhancedDiscord | installer/EnhancedDiscordUI/Properties/AssemblyInfo.cs | 1,410 | C# |
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Abp.Authorization.Roles;
using Abp.AutoMapper;
using AgentPurchaseManagementPlatform.Authorization.Roles;
namespace AgentPurchaseManagementPlatform.Roles.Dto
{
[AutoMapTo(typeof(Role))]
public class CreateRoleDto
{
[Required]
[StringLength(AbpRoleBase.MaxNameLength)]
public string Name { get; set; }
[Required]
[StringLength(AbpRoleBase.MaxDisplayNameLength)]
public string DisplayName { get; set; }
public string NormalizedName { get; set; }
[StringLength(Role.MaxDescriptionLength)]
public string Description { get; set; }
public bool IsStatic { get; set; }
public List<string> Permissions { get; set; }
}
}
| 27.4 | 58 | 0.678832 | [
"MIT"
] | q397133334/AgentPurchaseManagementPlatform | aspnet-core/src/AgentPurchaseManagementPlatform.Application/Roles/Dto/CreateRoleDto.cs | 822 | C# |
using System;
using Harmony;
using Steamworks;
using UnityEngine;
using BWModLoader;
using Alternion.Structs;
namespace Alternion.SkinHandlers
{
[Mod]
public class weaponSkinHandler : MonoBehaviour
{
/// <summary>
/// WeaponSkinHandler instance
/// </summary>
public static weaponSkinHandler Instance;
/// <summary>
/// Assigns the weapon skin to the weapon.
/// </summary>
/// <param name="renderer">Renderer to apply to</param>
/// <param name="weaponSkin">Weapon skin to use</param>
/// <param name="weapon">Name of the Weapon</param>
static void assignWeaponToRenderer(Renderer renderer, string weaponSkin, string weapon)
{
try
{
// If the player Dict contains a reference to the specific weapon, output the texture
if (weaponSkin != "default")
{
Texture newTex;
if (TheGreatCacher.Instance.weaponSkins.TryGetValue(weapon + "_" + weaponSkin, out newTex))
{
renderer.material.mainTexture = newTex;
}
if (TheGreatCacher.Instance.weaponSkins.TryGetValue(weapon + "_" + weaponSkin + "_met", out newTex))
{
renderer.material.SetTexture("_Metallic", newTex);
}
}
}
catch (Exception e)
{
Logger.debugLog(e.Message);
}
}
/// <summary>
/// Handles the finding of which skin, to apply to the weapon, based off the player setup and weapon equipped.
/// </summary>
/// <param name="__instance">WeaponRender Instance</param>
/// <param name="player">Player loadout</param>
static void mainSkinHandler(WeaponRender __instance, playerObject player)
{
Renderer renderer = __instance.GetComponent<Renderer>();
switch (renderer.material.mainTexture.name)
{
case "wpn_standardMusket_stock_alb":
assignWeaponToRenderer(renderer, player.musketSkinName, "musket");
break;
case "wpn_standardCutlass_alb":
if (renderer.name == "Cutlass" || renderer.name == "wpn_cutlass_LOD1")
{
assignWeaponToRenderer(renderer, player.cutlassSkinName, "cutlass");
}
else if (renderer.name == "wpn_dagger")
{
assignWeaponToRenderer(renderer, player.daggerSkinName, "dagger");
}
break;
case "wpn_blunderbuss_alb":
assignWeaponToRenderer(renderer, player.blunderbussSkinName, "blunderbuss");
break;
case "wpn_nockGun_stock_alb":
assignWeaponToRenderer(renderer, player.nockgunSkinName, "nockgun");
break;
case "wpn_handMortar_alb":
assignWeaponToRenderer(renderer, player.handMortarSkinName, "handmortar");
break;
case "wpn_dagger_alb":
assignWeaponToRenderer(renderer, player.daggerSkinName, "dagger");
break;
case "wpn_bottle_alb":
assignWeaponToRenderer(renderer, player.bottleSkinName, "bottle");
break;
case "wpn_rumHealth_alb":
assignWeaponToRenderer(renderer, player.healItemSkinName, "bottleHealth");
break;
case "prp_hammer_alb":
assignWeaponToRenderer(renderer, player.hammerSkinName, "hammer");
break;
case "wpn_standardPistol_stock_alb":
assignWeaponToRenderer(renderer, player.standardPistolSkinName, "standardPistol");
break;
case "prp_atlas01_alb":
assignWeaponToRenderer(renderer, player.atlas01SkinName, "atlas01");
break;
case "prp_bucket_alb":
assignWeaponToRenderer(renderer, player.bucketSkinName, "bucket");
break;
case "wpn_shortpistol_alb":
assignWeaponToRenderer(renderer, player.shortPistolSkinName, "shortPistol");
break;
case "wpn_duckfoot_alb":
assignWeaponToRenderer(renderer, player.duckfootSkinName, "duckfoot");
break;
case "wpn_annelyRevolver_alb":
assignWeaponToRenderer(renderer, player.annelyRevolverSkinName, "annelyRevolver");
break;
case "wpn_tomohawk_alb":
assignWeaponToRenderer(renderer, player.tomahawkSkinName, "tomahawk");
break;
case "wpn_matchlockRevolver_alb":
assignWeaponToRenderer(renderer, player.matchlockRevolverSkinName, "matchlock");
break;
case "wpn_twoHandAxe_alb":
if (renderer.name == "wpn_twoHandAxe")
{
assignWeaponToRenderer(renderer, player.axeSkinName, "axe");
}
else if (renderer.name == "wpn_rapier")
{
assignWeaponToRenderer(renderer, player.rapierSkinName, "rapier");
}
break;
case "wpn_boardingPike_alb":
assignWeaponToRenderer(renderer, player.pikeSkinName, "pike");
break;
case "wpn_spyglass_alb":
assignWeaponToRenderer(renderer, player.spyglassSkinName, "spyglass");
break;
case "prp_teaCup_alb":
assignWeaponToRenderer(renderer, player.teaCupSkinName, "teaCup");
break;
case "tea_alb":
assignWeaponToRenderer(renderer, player.teaWaterSkinName, "teaWater");
break;
case "wpn_grenade_alb":
assignWeaponToRenderer(renderer, player.grenadeSkinName, "grenade");
break;
default:
#if DEBUG
// If not known, output here
//Logger.logLow("Type name: -" + renderer.name + "-");
//Logger.logLow("Default name: -" + renderer.material.mainTexture.name + "-");
#endif
break;
}
}
void Awake()
{
if (!Instance)
{
Instance = this;
}
else
{
DestroyImmediate(this);
}
}
/// <summary>
/// Weapon skin patch (Third person)
/// </summary>
[HarmonyPatch(typeof(WeaponRender), "ìæóòèðêççæî")]
class goldApplyPatch
{
static void Postfix(WeaponRender __instance)
{
if (AlternionSettings.useWeaponSkins)
{
try
{
string steamID = __instance.ìäóêäðçóììî.ìêïòëîåëìòñ.gameObject.transform.parent.parent.GetComponent<PlayerInfo>().steamID.ToString();
if (TheGreatCacher.Instance.players.TryGetValue(steamID, out playerObject player))
{
mainSkinHandler(__instance, player);
}
}
catch (Exception e)
{
Logger.debugLog("err: " + e.Message);
}
}
}
}
/// <summary>
/// Mask skin patch
/// </summary>
[HarmonyPatch(typeof(Character), "setGoldMask")]
class goldMaskPatch
{
static void Postfix(Character __instance)
{
try
{
if (AlternionSettings.useMaskSkins)
{
string steamID = __instance.transform.parent.GetComponent<PlayerInfo>().steamID.ToString();
if (TheGreatCacher.Instance.players.TryGetValue(steamID, out playerObject player))
{
if (TheGreatCacher.Instance.maskSkins.TryGetValue(player.maskSkinName, out Texture newTex))
{
// Renderer renderer = __instance.éäéïéðïåææè.transform.GetComponent<Renderer>();
__instance.éäéïéðïåææè.transform.GetComponent<Renderer>().material.mainTexture = newTex;
}
}
}
}
catch (Exception e)
{
Logger.debugLog("err: " + e.Message);
}
}
}
/// <summary>
/// Weapon skin patch (First person)
/// </summary>
[HarmonyPatch(typeof(WeaponRender), "Start")]
class weaponSkinpatch1stPerson
{
static void Postfix(WeaponRender __instance)
{
if (AlternionSettings.useWeaponSkins)
{
try
{
if (!__instance.åïääìêêäéèç)
{
//Grab local steamID
string steamID = SteamUser.GetSteamID().m_SteamID.ToString();
if (TheGreatCacher.Instance.players.TryGetValue(steamID, out playerObject player))
{
mainSkinHandler(__instance, player);
}
}
}
catch (Exception e)
{
Logger.debugLog(e.Message);
}
}
}
}
}
}
| 40.529644 | 157 | 0.486249 | [
"MIT"
] | cheesenibbles123/Alternion-BW-mod | Alternion/SkinHandlers/WeaponSkinHandler.cs | 10,322 | C# |
using OpenONVIF.Surveillance.Camera;
using System;
using System.Collections.Generic;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenONVIF.Surveillance.Snapshot
{
internal class SnapshotHandler : IDisposable
{
private CameraConnection camera;
private DateTime lastSnapshot;
public SnapshotHandler(CameraConnection camera)
{
this.camera = camera;
if (camera.Settings.Properties.EnableSnapshots)
{
// bind events
this.camera.NewFrameEvent += Camera_NewFrameEvent;
}
}
private void Camera_NewFrameEvent(object sender, NewCameraFrameEventArgs e)
{
DateTime now = DateTime.Now;
TimeSpan timeSinceLastSnapshot = now - lastSnapshot;
if(timeSinceLastSnapshot.TotalSeconds >= camera.Settings.Properties.SnapshotInternal)
{
string snapshotFile = Path.Combine(camera.BasePath, "snapshots", String.Format("snap_{0}.jpg", now.Ticks));
Directory.CreateDirectory(Path.GetDirectoryName(snapshotFile));
e.Frame.Save(snapshotFile, ImageFormat.Jpeg);
lastSnapshot = now;
camera.Log.Info("Snapshot taken");
}
}
public void Dispose()
{
lastSnapshot = DateTime.MinValue;
}
}
}
| 28.886792 | 124 | 0.600261 | [
"MIT"
] | trembon/OpenONVIF | OpenONVIF.Surveillance/Snapshot/SnapshotHandler.cs | 1,533 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class PlayerManager : MonoBehaviour {
public float speedX;
public float jumpSpeedY;
public GameObject firePrefab;
public Transform fireSpawn;
public int score = 0;
private Animator anim;
private Rigidbody2D rb;
bool facingRight, jumping, walking;
float speed;
// Use this for initialization
void Start() {
anim = GetComponent<Animator>();
rb = GetComponent<Rigidbody2D>();
facingRight = true;
}
// Update is called once per frame
void Update() {
//flip if necessary
Flip();
//jump and fall
HandleJumpandFall();
//move the player
MovePlayer(speed);
//walk left
if (Input.GetKeyDown(KeyCode.LeftArrow))
{
WalkLeft();
}
if (Input.GetKeyUp(KeyCode.LeftArrow))
{
WalkStop();
}
//walk right
if (Input.GetKeyDown(KeyCode.RightArrow))
{
WalkRight();
}
if (Input.GetKeyUp(KeyCode.RightArrow))
{
WalkStop();
}
//jump
if (Input.GetKeyDown(KeyCode.UpArrow))
{
Jump();
}
//fire
if (Input.GetKeyDown(KeyCode.Space))
{
Fire();
}
}
void Flip()
{
if ((speed > 0 && !facingRight) || (speed < 0 && facingRight))
{
facingRight = !facingRight;
Vector3 temp = transform.localScale;
temp.x *= -1;
transform.localScale = temp;
}
}
void MovePlayer (float playerSpeed)
{
if (!jumping)
{
if (playerSpeed == 0)
//stop
anim.SetInteger("State", 0);
else
//walk
anim.SetInteger("State", 1);
}
else
anim.SetInteger("State", 3);
rb.velocity = new Vector3(speed, rb.velocity.y, 0);
}
private void OnCollisionEnter2D(Collision2D collision)
{
jumping = false;
anim.SetInteger("State", 4);
if (collision.gameObject.tag == "Spike")
{
anim.SetInteger("State", 5);
}
}
public void WalkLeft()
{
speed = -speedX;
}
public void WalkRight()
{
speed = speedX;
}
public void WalkStop()
{
speed = 0;
}
public void Jump()
{
jumping = true;
rb.AddForce(new Vector2(rb.velocity.x, jumpSpeedY));
}
public void Fire()
{
// Create the Bullet from the Bullet Prefab
var bullet = (GameObject)Instantiate(
firePrefab,
fireSpawn.position,
fireSpawn.rotation);
//kam letí střela: 1 = doprava, -1 = doleva
int multiplier = facingRight ? 1 : -1;
//nasměruj střelu, je třeba přes pomocný vektor (viz tutoriál Unity)
Vector3 temp = bullet.transform.localScale;
temp.x = Mathf.Abs(temp.x);
temp.x *= multiplier;
bullet.transform.localScale = temp;
//dej střele energii
bullet.GetComponent<Rigidbody2D>().AddForce(new Vector2(bullet.GetComponent<FireManager>().speedX * multiplier, 0));
anim.SetInteger("State", 6);
// Destroy the bullet after 2 seconds
Destroy(bullet, 2.0f);
}
void HandleJumpandFall()
{
if(jumping)
{
if(rb.velocity.y>0)
{
//jde nahoru
anim.SetInteger("State", 3);
}
else
{
//jde dolu
anim.SetInteger("State", 4);
}
}
}
//přidej score
public void AddScore()
{
score++;
CountScore();
}
//spočítej score a nahraj další level
void CountScore()
{
if(score==6)
{
SceneManager.LoadScene("2nd floor");
}
}
}
| 22.650794 | 125 | 0.486101 | [
"Apache-2.0"
] | PetrGasparik/Unity.Game.1 | Assets/Scripts/PlayerManager.cs | 4,297 | C# |
/* _BEGIN_TEMPLATE_
{
"id": "TB_HeadlessHorseman_H2d",
"name": [
"暴风城调查员 - 木乃伊",
"Stormwind Investigator Mummy"
],
"text": [
null,
null
],
"cardClass": "NEUTRAL",
"type": "HERO",
"cost": null,
"rarity": null,
"set": "TB",
"collectible": null,
"dbfId": 59196
}
_END_TEMPLATE_ */
namespace HREngine.Bots
{
class Sim_TB_HeadlessHorseman_H2d : SimTemplate
{
}
} | 15.185185 | 51 | 0.590244 | [
"MIT"
] | chi-rei-den/Silverfish | cards/TB/TB/Sim_TB_HeadlessHorseman_H2d.cs | 428 | C# |
using System;
[Equals]
public class GuidClass
{
public Guid Key { get; set; }
}
| 11.625 | 34 | 0.602151 | [
"MIT"
] | GeertvanHorrik/Equals | AssemblyToProcess/GuidClass.cs | 88 | C# |
// *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
namespace Pulumi.AzureNextGen.AVS.V20210101Preview
{
public static class GetDatastore
{
/// <summary>
/// A datastore resource
/// </summary>
public static Task<GetDatastoreResult> InvokeAsync(GetDatastoreArgs args, InvokeOptions? options = null)
=> Pulumi.Deployment.Instance.InvokeAsync<GetDatastoreResult>("azure-nextgen:avs/v20210101preview:getDatastore", args ?? new GetDatastoreArgs(), options.WithVersion());
}
public sealed class GetDatastoreArgs : Pulumi.InvokeArgs
{
/// <summary>
/// Name of the cluster in the private cloud
/// </summary>
[Input("clusterName", required: true)]
public string ClusterName { get; set; } = null!;
/// <summary>
/// Name of the datastore in the private cloud cluster
/// </summary>
[Input("datastoreName", required: true)]
public string DatastoreName { get; set; } = null!;
/// <summary>
/// Name of the private cloud
/// </summary>
[Input("privateCloudName", required: true)]
public string PrivateCloudName { get; set; } = null!;
/// <summary>
/// The name of the resource group. The name is case insensitive.
/// </summary>
[Input("resourceGroupName", required: true)]
public string ResourceGroupName { get; set; } = null!;
public GetDatastoreArgs()
{
}
}
[OutputType]
public sealed class GetDatastoreResult
{
/// <summary>
/// An iSCSI volume
/// </summary>
public readonly Outputs.DiskPoolVolumeResponse? DiskPoolVolume;
/// <summary>
/// Resource ID.
/// </summary>
public readonly string Id;
/// <summary>
/// Resource name.
/// </summary>
public readonly string Name;
/// <summary>
/// An Azure NetApp Files volume
/// </summary>
public readonly Outputs.NetAppVolumeResponse? NetAppVolume;
/// <summary>
/// The state of the datastore provisioning
/// </summary>
public readonly string ProvisioningState;
/// <summary>
/// Resource type.
/// </summary>
public readonly string Type;
[OutputConstructor]
private GetDatastoreResult(
Outputs.DiskPoolVolumeResponse? diskPoolVolume,
string id,
string name,
Outputs.NetAppVolumeResponse? netAppVolume,
string provisioningState,
string type)
{
DiskPoolVolume = diskPoolVolume;
Id = id;
Name = name;
NetAppVolume = netAppVolume;
ProvisioningState = provisioningState;
Type = type;
}
}
}
| 29.771429 | 180 | 0.586052 | [
"Apache-2.0"
] | pulumi/pulumi-azure-nextgen | sdk/dotnet/AVS/V20210101Preview/GetDatastore.cs | 3,126 | C# |
// MIT License
//
// Copyright (c) 2019 Jeesu Choi
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
namespace JSSoft.Communication.Logging
{
public interface ILogger
{
void Debug(object message);
void Info(object message);
void Error(object message);
void Warn(object message);
void Fatal(object message);
}
}
| 36.763158 | 81 | 0.732999 | [
"MIT"
] | s2quake/JSSoft.Communication | JSSoft.Communication/Logging/ILogger.cs | 1,397 | C# |
#if USE_UNI_LUA
using LuaAPI = UniLua.Lua;
using RealStatePtr = UniLua.ILuaState;
using LuaCSFunction = UniLua.CSharpFunctionDelegate;
#else
using LuaAPI = XLua.LuaDLL.Lua;
using RealStatePtr = System.IntPtr;
using LuaCSFunction = XLua.LuaDLL.lua_CSFunction;
#endif
using XLua;
using System.Collections.Generic;
namespace XLua.CSObjectWrap
{
using Utils = XLua.Utils;
public class XLuaCSObjectWrapXLuaCSObjectWrapXLuaCSObjectWrapXLuaCSObjectWrapDCETModelPlayerComponentWrapWrapWrapWrapWrap
{
public static void __Register(RealStatePtr L)
{
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
System.Type type = typeof(XLua.CSObjectWrap.XLuaCSObjectWrapXLuaCSObjectWrapXLuaCSObjectWrapDCETModelPlayerComponentWrapWrapWrapWrap);
Utils.BeginObjectRegister(type, L, translator, 0, 0, 0, 0);
Utils.EndObjectRegister(type, L, translator, null, null,
null, null, null);
Utils.BeginClassRegister(type, L, __CreateInstance, 2, 0, 0);
Utils.RegisterFunc(L, Utils.CLS_IDX, "__Register", _m___Register_xlua_st_);
Utils.EndClassRegister(type, L, translator);
}
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
static int __CreateInstance(RealStatePtr L)
{
try {
ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);
if(LuaAPI.lua_gettop(L) == 1)
{
XLua.CSObjectWrap.XLuaCSObjectWrapXLuaCSObjectWrapXLuaCSObjectWrapDCETModelPlayerComponentWrapWrapWrapWrap gen_ret = new XLua.CSObjectWrap.XLuaCSObjectWrapXLuaCSObjectWrapXLuaCSObjectWrapDCETModelPlayerComponentWrapWrapWrapWrap();
translator.Push(L, gen_ret);
return 1;
}
}
catch(System.Exception gen_e) {
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
}
return LuaAPI.luaL_error(L, "invalid arguments to XLua.CSObjectWrap.XLuaCSObjectWrapXLuaCSObjectWrapXLuaCSObjectWrapDCETModelPlayerComponentWrapWrapWrapWrap constructor!");
}
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
static int _m___Register_xlua_st_(RealStatePtr L)
{
try {
{
System.IntPtr _L = LuaAPI.lua_touserdata(L, 1);
XLua.CSObjectWrap.XLuaCSObjectWrapXLuaCSObjectWrapXLuaCSObjectWrapDCETModelPlayerComponentWrapWrapWrapWrap.__Register( _L );
return 0;
}
} catch(System.Exception gen_e) {
return LuaAPI.luaL_error(L, "c# exception:" + gen_e);
}
}
}
}
| 27.118182 | 235 | 0.614147 | [
"MIT"
] | zxsean/DCET | Unity/Assets/Model/XLua/Gen/XLuaCSObjectWrapXLuaCSObjectWrapXLuaCSObjectWrapXLuaCSObjectWrapDCETModelPlayerComponentWrapWrapWrapWrapWrap.cs | 2,985 | C# |
#pragma warning disable 108 // new keyword hiding
#pragma warning disable 114 // new keyword hiding
namespace Windows.Security.Cryptography.Certificates
{
#if __ANDROID__ || __IOS__ || NET46 || __WASM__
[global::Uno.NotImplemented]
#endif
public partial class ChainBuildingParameters
{
#if __ANDROID__ || __IOS__ || NET46 || __WASM__
[global::Uno.NotImplemented]
public global::System.DateTimeOffset ValidationTimestamp
{
get
{
throw new global::System.NotImplementedException("The member DateTimeOffset ChainBuildingParameters.ValidationTimestamp is not implemented in Uno.");
}
set
{
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.Security.Cryptography.Certificates.ChainBuildingParameters", "DateTimeOffset ChainBuildingParameters.ValidationTimestamp");
}
}
#endif
#if __ANDROID__ || __IOS__ || NET46 || __WASM__
[global::Uno.NotImplemented]
public bool RevocationCheckEnabled
{
get
{
throw new global::System.NotImplementedException("The member bool ChainBuildingParameters.RevocationCheckEnabled is not implemented in Uno.");
}
set
{
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.Security.Cryptography.Certificates.ChainBuildingParameters", "bool ChainBuildingParameters.RevocationCheckEnabled");
}
}
#endif
#if __ANDROID__ || __IOS__ || NET46 || __WASM__
[global::Uno.NotImplemented]
public bool NetworkRetrievalEnabled
{
get
{
throw new global::System.NotImplementedException("The member bool ChainBuildingParameters.NetworkRetrievalEnabled is not implemented in Uno.");
}
set
{
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.Security.Cryptography.Certificates.ChainBuildingParameters", "bool ChainBuildingParameters.NetworkRetrievalEnabled");
}
}
#endif
#if __ANDROID__ || __IOS__ || NET46 || __WASM__
[global::Uno.NotImplemented]
public bool CurrentTimeValidationEnabled
{
get
{
throw new global::System.NotImplementedException("The member bool ChainBuildingParameters.CurrentTimeValidationEnabled is not implemented in Uno.");
}
set
{
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.Security.Cryptography.Certificates.ChainBuildingParameters", "bool ChainBuildingParameters.CurrentTimeValidationEnabled");
}
}
#endif
#if __ANDROID__ || __IOS__ || NET46 || __WASM__
[global::Uno.NotImplemented]
public bool AuthorityInformationAccessEnabled
{
get
{
throw new global::System.NotImplementedException("The member bool ChainBuildingParameters.AuthorityInformationAccessEnabled is not implemented in Uno.");
}
set
{
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.Security.Cryptography.Certificates.ChainBuildingParameters", "bool ChainBuildingParameters.AuthorityInformationAccessEnabled");
}
}
#endif
#if __ANDROID__ || __IOS__ || NET46 || __WASM__
[global::Uno.NotImplemented]
public global::System.Collections.Generic.IList<string> EnhancedKeyUsages
{
get
{
throw new global::System.NotImplementedException("The member IList<string> ChainBuildingParameters.EnhancedKeyUsages is not implemented in Uno.");
}
}
#endif
#if __ANDROID__ || __IOS__ || NET46 || __WASM__
[global::Uno.NotImplemented]
public global::System.Collections.Generic.IList<global::Windows.Security.Cryptography.Certificates.Certificate> ExclusiveTrustRoots
{
get
{
throw new global::System.NotImplementedException("The member IList<Certificate> ChainBuildingParameters.ExclusiveTrustRoots is not implemented in Uno.");
}
}
#endif
#if __ANDROID__ || __IOS__ || NET46 || __WASM__
[global::Uno.NotImplemented]
public ChainBuildingParameters()
{
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.Security.Cryptography.Certificates.ChainBuildingParameters", "ChainBuildingParameters.ChainBuildingParameters()");
}
#endif
// Forced skipping of method Windows.Security.Cryptography.Certificates.ChainBuildingParameters.ChainBuildingParameters()
// Forced skipping of method Windows.Security.Cryptography.Certificates.ChainBuildingParameters.EnhancedKeyUsages.get
// Forced skipping of method Windows.Security.Cryptography.Certificates.ChainBuildingParameters.ValidationTimestamp.get
// Forced skipping of method Windows.Security.Cryptography.Certificates.ChainBuildingParameters.ValidationTimestamp.set
// Forced skipping of method Windows.Security.Cryptography.Certificates.ChainBuildingParameters.RevocationCheckEnabled.get
// Forced skipping of method Windows.Security.Cryptography.Certificates.ChainBuildingParameters.RevocationCheckEnabled.set
// Forced skipping of method Windows.Security.Cryptography.Certificates.ChainBuildingParameters.NetworkRetrievalEnabled.get
// Forced skipping of method Windows.Security.Cryptography.Certificates.ChainBuildingParameters.NetworkRetrievalEnabled.set
// Forced skipping of method Windows.Security.Cryptography.Certificates.ChainBuildingParameters.AuthorityInformationAccessEnabled.get
// Forced skipping of method Windows.Security.Cryptography.Certificates.ChainBuildingParameters.AuthorityInformationAccessEnabled.set
// Forced skipping of method Windows.Security.Cryptography.Certificates.ChainBuildingParameters.CurrentTimeValidationEnabled.get
// Forced skipping of method Windows.Security.Cryptography.Certificates.ChainBuildingParameters.CurrentTimeValidationEnabled.set
// Forced skipping of method Windows.Security.Cryptography.Certificates.ChainBuildingParameters.ExclusiveTrustRoots.get
}
}
| 46.92623 | 214 | 0.799127 | [
"Apache-2.0"
] | nv-ksavaria/Uno | src/Uno.UWP/Generated/3.0.0.0/Windows.Security.Cryptography.Certificates/ChainBuildingParameters.cs | 5,725 | C# |
// package main -- go2cs converted at 2020 October 09 06:03:46 UTC
// Original source: C:\Users\ritchie\go\src\golang.org\x\tools\go\ssa\interp\testdata\initorder.go
using fmt = go.fmt_package;
using static go.builtin;
namespace go
{
public static partial class main_package
{
// Test of initialization order of package-level vars.
private static long counter = default;
private static long next()
{
var c = counter;
counter++;
return c;
}
private static (long, long) next2()
{
long x = default;
long y = default;
x = next();
y = next();
return ;
}
private static long makeOrder()
{
_ = f;
_ = b;
_ = d;
_ = e;
return 0L;
}
private static void Main() => func((_, panic, __) =>
{
// Initialization constraints:
// - {f,b,c/d,e} < order (ref graph traversal)
// - order < {a} (lexical order)
// - b < c/d < e < f (lexical order)
// Solution: a b c/d e f
array<long> abcdef = new array<long>(new long[] { a, b, c, d, e, f });
if (abcdef != new array<long>(new long[] { 0, 1, 2, 3, 4, 5 }))
{
panic(abcdef);
}
});
private static var order = makeOrder();
private static var a = next(); private static var b = next();
private static var e = next(); private static var f = next();
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
private static slice<@string> order2 = default;
private static long create(long x, @string name)
{
order2 = append(order2, name);
return x;
}
public static var C = create(B + 1L, "C");
public static var A = create(1L, "A"); public static var B = create(2L, "B");
// Initialization order of package-level value specs.
// Initialization order of package-level value specs.
private static void init() => func((_, panic, __) =>
{
var x = fmt.Sprint(order2);
// Result varies by toolchain. This is a spec bug.
if (x != "[B C A]" && x != "[A B C]")
{ // go/types
panic(x);
}
if (C != 3L)
{
panic(c);
}
});
}
}
| 26.514851 | 98 | 0.434279 | [
"MIT"
] | GridProtectionAlliance/go2cs | src/go-src-converted/initorder.cs | 2,678 | C# |
using FluentAssertions;
using FullCalendar.Serialization.SerializableObjects;
using FullCalendar.Tests.Mocks;
using NUnit.Framework;
using System;
using System.Collections.Generic;
namespace FullCalendar.Serialization.Tests
{
[TestFixture]
public class NullPropertiesConverterTests
{
[Test]
public void Deserialize_UsedOnAJavaScriptSerializer_NotImplementedExceptionShouldBeThrown()
{
NullPropertiesConverter nullPropertiesConverter = new NullPropertiesConverter();
Action target = () =>
{
nullPropertiesConverter.Deserialize(null, typeof(int), null);
};
target.ShouldThrow<NotImplementedException>();
}
[Test]
public void Serialize_When_IntegerPropertyIsZero_PropertyIsNotAddedToSerialization()
{
NullPropertiesConverter nullPropertiesConverter = new NullPropertiesConverter();
Duration duration = new Duration
{
Days = 1,
Weeks = 0,
Months = 2
};
IDictionary<string, object> target = nullPropertiesConverter.Serialize(duration, null);
target.Should().Contain("Days", 1);
target.Should().Contain("Months", 2);
target.Should().NotContainKey("Weeks");
}
[Test]
public void Serialize_When_PropertyDecoratedWithScriptIgnoreAttribute_PropertyIsNotAddedToSerialization()
{
NullPropertiesConverter nullPropertiesConverter = new NullPropertiesConverter();
ScriptIgnoreAttributeMock scriptIgnoreAttributeMock = new ScriptIgnoreAttributeMock
{
Id = 32
};
IDictionary<string, object> target = nullPropertiesConverter.Serialize(scriptIgnoreAttributeMock, null);
target.Should().BeEmpty();
}
[Test]
public void Serialize_When_PropertyIsNull_PropertyIsNotAddedToSerialization()
{
NullPropertiesConverter nullPropertiesConverter = new NullPropertiesConverter();
FullCalendarParameters parameters = new FullCalendarParameters
{
EventRenderWait = null
};
IDictionary<string, object> target = nullPropertiesConverter.Serialize(parameters, null);
target.Should().NotContainKey("EventRenderWait");
}
[Test]
public void Serialize_When_PropertiesAreNotNull_AllOfThemAreAddedToSerialization()
{
NullPropertiesConverter nullPropertiesConverter = new NullPropertiesConverter();
SerializableValidRange validRange = new SerializableValidRange
{
start = "1:00",
end = "2:00"
};
IDictionary<string, object> target = nullPropertiesConverter.Serialize(validRange, null);
target.Should().Contain("start", "1:00");
target.Should().Contain("end", "2:00");
}
}
} | 38.74359 | 116 | 0.636995 | [
"MIT"
] | HajbokRobert/FullCalendarMVC | FullCalendarMVC/FullCalendar.Tests/Serialization/NullPropertiesConverterTests.cs | 3,024 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenCodeDev.NetCMS.Core.Server.Plugin.Options.Controllers
{
public interface IPluginController : IPluginHookActionController, IPluginHookFilterController
{
bool PluginContain(string name);
object PluginGetObject(string name);
PluginServerBase PluginGetBase(string name);
void PluginRegister(object obj);
void PluginUnregister(object name);
}
}
| 25.095238 | 97 | 0.749526 | [
"MIT"
] | OpenCodeDev/OpenCodeDev.NetCMS.Core | Server/Plugin/Controllers/IPluginController.cs | 529 | C# |
using System.Threading.Tasks;
using Conflux.JsonRpc.Client;
using Newtonsoft.Json.Linq;
namespace Conflux.Parity.RPC.Trace
{
public interface ITraceTransaction
{
RpcRequest BuildRequest(string transactionHash, object id = null);
Task<JArray> SendRequestAsync(string transactionHash, object id = null);
}
}
| 25.846154 | 80 | 0.741071 | [
"Apache-2.0",
"MIT"
] | NconfluxSDK/Nconflux | src/Nethereum.Parity/RPC/Trace/ITraceTransaction.cs | 338 | C# |
using System.IO;
using Vokabular.DataEntities.Database.Entities.Enums;
namespace Vokabular.MainService.Core.Utils
{
public class AudioEnumHelper
{
public static AudioTypeEnum FileNameToAudioType(string fileName)
{
var extension = Path.GetExtension(fileName)?.ToLower();
switch (extension)
{
case ".mp3":
return AudioTypeEnum.Mp3;
case ".ogg":
return AudioTypeEnum.Ogg;
case ".wav":
return AudioTypeEnum.Wav;
default:
return AudioTypeEnum.Unknown;
}
}
}
}
| 27.4 | 72 | 0.525547 | [
"BSD-3-Clause"
] | RIDICS/ITJakub | UJCSystem/Vokabular.MainService.Core/Utils/AudioEnumHelper.cs | 687 | C# |
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
namespace ShippingContainer.Tests
{
/// <summary>
/// Extension methods for controller testing
/// </summary>
public static class ControllerExtensions
{
/// <summary>
/// Trigger model validation (normally handled by MVC)
/// </summary>
public static void ValidateViewModel(this Controller controller, object viewModelToValidate)
{
controller?.ModelState?.Clear();
var validationContext = new ValidationContext(viewModelToValidate, null, null);
var validationResults = new List<ValidationResult>();
Validator.TryValidateObject(viewModelToValidate, validationContext, validationResults, true);
foreach (var validationResult in validationResults)
{
controller.ModelState.AddModelError(validationResult.MemberNames.FirstOrDefault() ?? string.Empty, validationResult.ErrorMessage);
}
}
}
}
| 35.225806 | 146 | 0.680403 | [
"MIT"
] | gplumb/CertainSix | ShippingContainer/ShippingContainer.Tests/ControllerExtensions.cs | 1,094 | C# |
using System;
namespace csharpdemo
{
class Program
{
static void Main()
{
FizzBuzzExample1.FizzBuzz();
FizzBuzzExample2.FizzBuzz();
FizzBuzzExample3.FizzBuzz();
var i = CalculationExample.NestedCalls();
Console.WriteLine($"NestedCalls {i}");
i = CalculationExample.HorizontalPipeline();
Console.WriteLine($"Pipeline {i}");
i = CalculationExample.VerticalPipeline();
Console.WriteLine($"Pipeline2 {i}");
i = CalculationExample.PipelineWithParams();
Console.Write($"Pipeline3 {i}");
}
}
}
| 22.862069 | 56 | 0.559578 | [
"Apache-2.0"
] | swlaschin/pipeline_oriented_programming_talk | csharpdemo/Program.cs | 665 | C# |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Linq;
using Microsoft.ML;
using Microsoft.ML.Sweeper;
[assembly: LoadableClass(typeof(UniformRandomSweeper), typeof(SweeperBase.OptionsBase), typeof(SignatureSweeper),
"Uniform Random Sweeper", "UniformRandomSweeper", "UniformRandom")]
[assembly: LoadableClass(typeof(UniformRandomSweeper), typeof(SweeperBase.OptionsBase), typeof(SignatureSweeperFromParameterList),
"Uniform Random Sweeper", "UniformRandomSweeperParamList", "UniformRandompl")]
namespace Microsoft.ML.Sweeper
{
/// <summary>
/// Random sweeper, it generates random values for each of the parameters.
/// </summary>
public sealed class UniformRandomSweeper : SweeperBase
{
public UniformRandomSweeper(IHostEnvironment env, OptionsBase options)
: base(options, env, "UniformRandom")
{
}
public UniformRandomSweeper(IHostEnvironment env, OptionsBase options, IValueGenerator[] sweepParameters)
: base(options, env, sweepParameters, "UniformRandom")
{
}
protected override ParameterSet CreateParamSet()
{
return new ParameterSet(SweepParameters.Select(sweepParameter => sweepParameter.CreateFromNormalized(Host.Rand.NextDouble())));
}
}
}
| 39.567568 | 139 | 0.724727 | [
"MIT"
] | IndigoShock/machinelearning | src/Microsoft.ML.Sweeper/Algorithms/Random.cs | 1,464 | C# |
using EdnaMonitoring.App.Data;
using EdnaMonitoring.Domain.Entities;
using MediatR;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace EdnaMonitoring.App.Icts.Queries.GetAllActiveIcts
{
public class GetAllActiveIctsQuery : IRequest<List<Ict>>
{
public class GetAllActiveIctsQueryHandler : IRequestHandler<GetAllActiveIctsQuery, List<Ict>>
{
private readonly AppIdentityDbContext _context;
public GetAllActiveIctsQueryHandler(AppIdentityDbContext context)
{
_context = context;
}
public async Task<List<Ict>> Handle(GetAllActiveIctsQuery request, CancellationToken cancellationToken)
{
List<Ict> res = await _context.Icts.ToListAsync();
return res;
}
}
}
}
| 29.53125 | 115 | 0.679365 | [
"MIT"
] | nagasudhirpulla/edna_monitoring | src/EdnaMonitoring.App/Icts/Queries/GetAllActiveIcts/GetAllActiveIctsQuery.cs | 947 | C# |
#pragma warning disable 108 // new keyword hiding
#pragma warning disable 114 // new keyword hiding
namespace Windows.Networking.NetworkOperators
{
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented]
#endif
public partial class MobileBroadbandModemConfiguration
{
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public string HomeProviderId
{
get
{
throw new global::System.NotImplementedException("The member string MobileBroadbandModemConfiguration.HomeProviderId is not implemented in Uno.");
}
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public string HomeProviderName
{
get
{
throw new global::System.NotImplementedException("The member string MobileBroadbandModemConfiguration.HomeProviderName is not implemented in Uno.");
}
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Networking.NetworkOperators.MobileBroadbandUicc Uicc
{
get
{
throw new global::System.NotImplementedException("The member MobileBroadbandUicc MobileBroadbandModemConfiguration.Uicc is not implemented in Uno.");
}
}
#endif
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Networking.NetworkOperators.MobileBroadbandSarManager SarManager
{
get
{
throw new global::System.NotImplementedException("The member MobileBroadbandSarManager MobileBroadbandModemConfiguration.SarManager is not implemented in Uno.");
}
}
#endif
// Forced skipping of method Windows.Networking.NetworkOperators.MobileBroadbandModemConfiguration.Uicc.get
// Forced skipping of method Windows.Networking.NetworkOperators.MobileBroadbandModemConfiguration.HomeProviderId.get
// Forced skipping of method Windows.Networking.NetworkOperators.MobileBroadbandModemConfiguration.HomeProviderName.get
// Forced skipping of method Windows.Networking.NetworkOperators.MobileBroadbandModemConfiguration.SarManager.get
}
}
| 48.696429 | 165 | 0.765677 | [
"Apache-2.0"
] | AbdalaMask/uno | src/Uno.UWP/Generated/3.0.0.0/Windows.Networking.NetworkOperators/MobileBroadbandModemConfiguration.cs | 2,727 | C# |
using Fitness.SocketClient;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SocketMono : MonoBehaviour {
// Use this for initialization
void Start () {
DontDestroyOnLoad(this.gameObject);
this.InitManager();
}
private void InitManager()
{
HeartManager.Instance.CreateModel(gameObject);
}
private void Update()
{
SocketManager.Instance.UpdateProto();
}
private void OnApplicationQuit()
{
SocketManager.Instance.OnApplicationQuit();
}
}
| 19.551724 | 54 | 0.673721 | [
"MIT"
] | Altoid76/Unity3DTraining | NetWorkAndResources/Socket_Protobuff/Assets/Scripts/Socket/SocketMono.cs | 569 | C# |
//
// Copyright (c) Antmicro
// Copyright (c) Bas Stottelaar <basstottelaar@gmail.com>
//
// This file is part of the Emul8 project.
// Full license details are defined in the 'LICENSE' file.
//
using Emul8.Logging;
using Emul8.Peripherals.Bus;
namespace Emul8.Peripherals
{
[AllowedTranslations(AllowedTranslation.ByteToDoubleWord)]
public class EFR32FG13PDeviceInformation: IDoubleWordPeripheral, IKnownSize
{
public EFR32FG13PDeviceInformation(ushort deviceNumber, ushort flashSize, ushort sramSize, byte productRevision = 0)
{
this.flashSize = flashSize;
this.sramSize = sramSize;
this.productRevision = productRevision;
this.deviceFamily = 0x31;
this.deviceNumber = deviceNumber;
}
public void Reset()
{
}
public uint ReadDoubleWord(long offset)
{
switch((DeviceInformationOffset)offset)
{
case DeviceInformationOffset.EUI48L:
return (uint)(EUI >> 32);
case DeviceInformationOffset.EUI48H:
return (uint)(EUI & 0xFFFFFFFF);
case DeviceInformationOffset.UNIQUEL:
return (uint)(Unique >> 32);
case DeviceInformationOffset.UNIQUEH:
return (uint)(Unique & 0xFFFFFFFF);
case DeviceInformationOffset.MSIZE:
return (uint)((sramSize << 16) | (flashSize & 0xFFFF));
case DeviceInformationOffset.PART:
return (uint)((productRevision << 24) | ((byte)deviceFamily << 16) | deviceNumber);
case DeviceInformationOffset.DEVINFOREV:
return 0xFFFFFF00 | 0x01;
default:
this.LogUnhandledRead(offset);
return 0;
}
}
public void WriteDoubleWord(long offset, uint value)
{
this.LogUnhandledWrite(offset, value);
}
public long Size
{
get
{
return 0x200;
}
}
public ulong EUI { get; set; }
public ulong Unique { get; set; }
private readonly ushort flashSize;
private readonly ushort sramSize;
private readonly byte productRevision;
private readonly byte deviceFamily;
private readonly ushort deviceNumber;
// This structure should resemble the structure of efr32fg13p_devinfo.h.
private enum DeviceInformationOffset : long
{
MODULEINFO = 0x000, // Module trace information
MODXOCAL = 0x004, // Module Crystal Oscillator Calibration
EXTINFO = 0x01c, // External Component description
EUI48L = 0x024, // EUI48 OUI and Unique identifier
EUI48H = 0x028, // OUI
CUSTOMINFO = 0x02c, // Custom information
MEMINFO = 0x030, // Flash page size and misc. chip information
UNIQUEL = 0x03c, // Low 32 bits of device unique number
UNIQUEH = 0x040, // High 32 bits of device unique number
MSIZE = 0x044, // Flash and SRAM Memory size in kB
PART = 0x048, // Part description
DEVINFOREV = 0x04c, // Device information page revision
EMUTEMP = 0x050, // EMU Temperature Calibration Information
ADC0CAL0 = 0x05c, // ADC0 calibration register 0
ADC0CAL1 = 0x060, // ADC0 calibration register 1
ADC0CAL2 = 0x064, // ADC0 calibration register 2
ADC0CAL3 = 0x068, // ADC0 calibration register 3
HFRCOCAL0 = 0x07c, // HFRCO Calibration Register (4 MHz)
HFRCOCAL3 = 0x088, // HFRCO Calibration Register (7 MHz)
HFRCOCAL6 = 0x094, // HFRCO Calibration Register (13 MHz)
HFRCOCAL7 = 0x098, // HFRCO Calibration Register (16 MHz)
HFRCOCAL8 = 0x09c, // HFRCO Calibration Register (19 MHz)
HFRCOCAL10 = 0x0a4, // HFRCO Calibration Register (26 MHz)
HFRCOCAL11 = 0x0a8, // HFRCO Calibration Register (32 MHz)
HFRCOCAL12 = 0x0ac, // HFRCO Calibration Register (38 MHz)
AUXHFRCOCAL0 = 0x0dc, // AUXHFRCO Calibration Register (4 MHz)
AUXHFRCOCAL3 = 0x0e8, // AUXHFRCO Calibration Register (7 MHz)
AUXHFRCOCAL6 = 0x0f4, // AUXHFRCO Calibration Register (13 MHz)
AUXHFRCOCAL7 = 0x0f8, // AUXHFRCO Calibration Register (16 MHz)
AUXHFRCOCAL8 = 0x0fc, // AUXHFRCO Calibration Register (19 MHz)
AUXHFRCOCAL10 = 0x104, // AUXHFRCO Calibration Register (26 MHz)
AUXHFRCOCAL11 = 0x108, // AUXHFRCO Calibration Register (32 MHz)
AUXHFRCOCAL12 = 0x10c, // AUXHFRCO Calibration Register (38 MHz)
VMONCAL0 = 0x13c, // VMON Calibration Register 0
VMONCAL1 = 0x140, // VMON Calibration Register 1
VMONCAL2 = 0x144, // VMON Calibration Register 2
IDAC0CAL0 = 0x154, // IDAC0 Calibration Register 0
IDAC0CAL1 = 0x158, // IDAC0 Calibration Register 1
DCDCLNVCTRL0 = 0x164, // DCDC Low-noise VREF Trim Register 0
DCDCLPVCTRL0 = 0x168, // DCDC Low-power VREF Trim Register 0
DCDCLPVCTRL1 = 0x16c, // DCDC Low-power VREF Trim Register 1
DCDCLPVCTRL2 = 0x170, // DCDC Low-power VREF Trim Register 2
DCDCLPVCTRL3 = 0x174, // DCDC Low-power VREF Trim Register 3
DCDCLPCMPHYSSEL0 = 0x178, // DCDC LPCMPHYSSEL Trim Register 0
DCDCLPCMPHYSSEL1 = 0x17c, // DCDC LPCMPHYSSEL Trim Register 1
VDAC0MAINCAL = 0x180, // VDAC0 Cals for Main Path
VDAC0ALTCAL = 0x184, // VDAC0 Cals for Alternate Path
VDAC0CH1CAL = 0x188, // VDAC0 CH1 Error Cal
OPA0CAL0 = 0x18c, // OPA0 Calibration Register for DRIVESTRENGTH 0, INCBW=1
OPA0CAL1 = 0x190, // OPA0 Calibration Register for DRIVESTRENGTH 1, INCBW=1
OPA0CAL2 = 0x194, // OPA0 Calibration Register for DRIVESTRENGTH 2, INCBW=1
OPA0CAL3 = 0x198, // OPA0 Calibration Register for DRIVESTRENGTH 3, INCBW=1
OPA1CAL0 = 0x19c, // OPA1 Calibration Register for DRIVESTRENGTH 0, INCBW=1
OPA1CAL1 = 0x1a0, // OPA1 Calibration Register for DRIVESTRENGTH 1, INCBW=1
OPA1CAL2 = 0x1a4, // OPA1 Calibration Register for DRIVESTRENGTH 2, INCBW=1
OPA1CAL3 = 0x1a8, // OPA1 Calibration Register for DRIVESTRENGTH 3, INCBW=1
OPA2CAL0 = 0x1ac, // OPA2 Calibration Register for DRIVESTRENGTH 0, INCBW=1
OPA2CAL1 = 0x1b0, // OPA2 Calibration Register for DRIVESTRENGTH 1, INCBW=1
OPA2CAL2 = 0x1b4, // OPA2 Calibration Register for DRIVESTRENGTH 2, INCBW=1
OPA2CAL3 = 0x1b8, // OPA2 Calibration Register for DRIVESTRENGTH 3, INCBW=1
CSENGAINCAL = 0x1bc, // Cap Sense Gain Adjustment
OPA0CAL4 = 0x1cc, // OPA0 Calibration Register for DRIVESTRENGTH 0, INCBW=0
OPA0CAL5 = 0x1d0, // OPA0 Calibration Register for DRIVESTRENGTH 1, INCBW=0
OPA0CAL6 = 0x1d4, // OPA0 Calibration Register for DRIVESTRENGTH 2, INCBW=0
OPA0CAL7 = 0x1d8, // OPA0 Calibration Register for DRIVESTRENGTH 3, INCBW=0
OPA1CAL4 = 0x1dc, // OPA1 Calibration Register for DRIVESTRENGTH 0, INCBW=0
OPA1CAL5 = 0x1e0, // OPA1 Calibration Register for DRIVESTRENGTH 1, INCBW=0
OPA1CAL6 = 0x1e4, // OPA1 Calibration Register for DRIVESTRENGTH 2, INCBW=0
OPA1CAL7 = 0x1e8, // OPA1 Calibration Register for DRIVESTRENGTH 3, INCBW=0
OPA2CAL4 = 0x1ec, // OPA2 Calibration Register for DRIVESTRENGTH 0, INCBW=0
OPA2CAL5 = 0x1f0, // OPA2 Calibration Register for DRIVESTRENGTH 1, INCBW=0
OPA2CAL6 = 0x1f4, // OPA2 Calibration Register for DRIVESTRENGTH 2, INCBW=0
OPA2CAL7 = 0x1f8, // OPA2 Calibration Register for DRIVESTRENGTH 3, INCBW=0
}
}
}
| 55.292208 | 124 | 0.582501 | [
"MIT"
] | basilfx/EFM2RIOT | dist-development/contrib/emul8/EFR32FG13PDeviceInformation.cs | 8,515 | C# |
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX - License - Identifier: Apache - 2.0
// snippet-start:[dynamodb.dotnet35.06_UpdatingItem]
using System;
using System.Threading.Tasks;
using Amazon.DynamoDBv2.Model;
namespace GettingStarted
{
public static partial class DdbIntro
{
public static async Task<bool> UpdatingMovie_async(UpdateItemRequest updateRequest, bool report)
{
UpdateItemResponse updateResponse = null;
OperationSucceeded = false;
OperationFailed = false;
if (report)
{
Console.WriteLine(" -- Trying to update a movie item...");
updateRequest.ReturnValues = "ALL_NEW";
}
try
{
updateResponse = await Client.UpdateItemAsync(updateRequest);
Console.WriteLine(" -- SUCCEEDED in updating the movie item!");
}
catch (Exception ex)
{
Console.WriteLine(" -- FAILED to update the movie item, because:\n {0}.", ex.Message);
if (updateResponse != null)
Console.WriteLine(" -- The status code was " + updateResponse.HttpStatusCode.ToString());
OperationFailed = true; return (false);
}
if (report)
{
Console.WriteLine(" Here is the updated movie information:");
Console.WriteLine(MovieAttributesToJson(updateResponse.Attributes));
}
OperationSucceeded = true;
return (true);
}
}
}
// snippet-end:[dynamodb.dotnet35.06_UpdatingItem] | 34.04 | 113 | 0.571093 | [
"Apache-2.0"
] | 1n5an1ty/aws-doc-sdk-examples | dotnet3.5/dynamodb/GettingStarted/06_UpdatingItem.cs | 1,704 | C# |
// Fill out your copyright notice in the Description page of Project Settings.
using UnrealBuildTool;
using System.Collections.Generic;
public class PacmanEditorTarget : TargetRules
{
public PacmanEditorTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Editor;
DefaultBuildSettings = BuildSettingsVersion.V2;
ExtraModuleNames.AddRange( new string[] { "Pacman" } );
}
}
| 25.4375 | 79 | 0.744472 | [
"MIT"
] | michal-z/Pacman | Source/PacmanEditor.Target.cs | 407 | C# |
using System;
using System.Collections.Generic;
using System.ServiceModel;
using Fhi.HelseId.Web.Hpr.Core;
using HprServiceReference;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
namespace Fhi.HelseId.Web.Hpr
{
public interface IHprFactory
{
IHPR2ServiceChannel? ServiceProxy { get; }
[Obsolete("Use CreateHprService")]
IHprService CreateHprRepository();
IHprService CreateHprService();
}
public interface IGodkjenteHprKategoriListe
{
IEnumerable<OId9060> Godkjenninger { get; }
}
/// <summary>
/// Lag subklasse og sett opp for injection
/// Legg til i denne listen de kategoriene som skal være godkjent
/// Mulige verdier finnes i filen Kodekonstaner.g.cs
/// Eks.: Verdi for Lege er: Kodekonstanter.OId9060Lege
/// </summary>
public abstract class GodkjenteHprKategoriListe : IGodkjenteHprKategoriListe
{
private readonly List<OId9060> godkjenninger = new List<OId9060>();
protected void Add(OId9060 godkjent) => godkjenninger.Add(godkjent);
public IEnumerable<OId9060> Godkjenninger => godkjenninger;
}
public class HprFactory : IHprFactory
{
private readonly IGodkjenteHprKategoriListe godkjenninger;
private readonly ILogger<HprFactory> logger;
public IHPR2ServiceChannel? ServiceProxy { get; }
public HprFactory(IOptions<HprKonfigurasjon> hprKonfigurasjon, IGodkjenteHprKategoriListe godkjenninger, ILogger<HprFactory> logger)
{
this.godkjenninger = godkjenninger;
this.logger = logger;
var config = hprKonfigurasjon.Value;
this.logger.LogDebug("Access til HPR: {Url}", config.Url);
if (!config.UseHpr)
{
this.logger.LogInformation("HprFactory: Hpr er avslått, se konfigurasjon");
return;
}
var userName = config.Brukernavn;
var passord = config.Passord;
var httpBinding = new WSHttpBinding(SecurityMode.Transport);
httpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
var channelFactory = new ChannelFactory<IHPR2ServiceChannel>(httpBinding, new EndpointAddress(new Uri(config.Url)));
channelFactory.Credentials.UserName.UserName = userName;
channelFactory.Credentials.UserName.Password = passord;
ServiceProxy = channelFactory.CreateChannel();
ServiceProxy.Open();
}
public IHprService CreateHprService() => new HprService(this, logger).LeggTilGodkjenteHelsepersonellkategorier(godkjenninger);
[Obsolete("Use CreateHprService")]
public IHprService CreateHprRepository() => CreateHprService();
}
}
| 36.179487 | 140 | 0.681432 | [
"MIT"
] | folkehelseinstituttet/fhi.helseid | Fhi.HelseId/Web/Hpr/HprFactory.cs | 2,826 | C# |
namespace SellMe.Web.ViewModels.InputModels.Ads
{
public class AdDetailsInputModel
{
public int Id { get; set; }
}
}
| 17.25 | 48 | 0.644928 | [
"MIT"
] | kriskok95/SellMe | Web/SellMe.Web.ViewModels/InputModels/Ads/AdDetailsInputModel.cs | 140 | C# |
//---------------------------------------------------------
// <auto-generated>
// This code was generated by a tool. Changes to this
// file may cause incorrect behavior and will be lost
// if the code is regenerated.
//
// Generated on 2020 October 09 05:40:44 UTC
// </auto-generated>
//---------------------------------------------------------
using System;
using System.CodeDom.Compiler;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using static go.builtin;
using fmt = go.fmt_package;
using io = go.io_package;
using reflect = go.reflect_package;
using unicode = go.unicode_package;
using utf8 = go.unicode.utf8_package;
using go;
#nullable enable
namespace go {
namespace cmd {
namespace compile {
namespace @internal
{
public static partial class syntax_package
{
[GeneratedCode("go2cs", "0.1.0.0")]
private partial struct localError
{
// Constructors
public localError(NilType _)
{
this.err = default;
}
public localError(error err = default)
{
this.err = err;
}
// Enable comparisons between nil and localError struct
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator ==(localError value, NilType nil) => value.Equals(default(localError));
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator !=(localError value, NilType nil) => !(value == nil);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator ==(NilType nil, localError value) => value == nil;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool operator !=(NilType nil, localError value) => value != nil;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator localError(NilType nil) => default(localError);
}
[GeneratedCode("go2cs", "0.1.0.0")]
private static localError localError_cast(dynamic value)
{
return new localError(value.err);
}
}
}}}} | 32.57971 | 111 | 0.607651 | [
"MIT"
] | GridProtectionAlliance/go2cs | src/go-src-converted/cmd/compile/internal/syntax/dumper_localErrorStruct.cs | 2,248 | C# |
using System;
namespace Popcron.Sheets
{
[Serializable]
public class Response
{
public object kind;
}
}
| 11.818182 | 27 | 0.615385 | [
"MIT"
] | popcron/sheets | Popcron.Sheets/Responses/Response.cs | 132 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
public partial class addDetails : System.Web.UI.Page
{
connection con = new connection();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
try
{
con.open_connection();
string st = "insert into add_details1 values ('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "')";
SqlCommand cmd = new SqlCommand(st, con.con_pass());
cmd.ExecuteNonQuery();
con.close_connection();
Response.Write("<script>alert('Details Added Successfully') </script>");
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
}
catch (Exception ex)
{
Response.Write("<script>alert('Section Already Register') </script>");
}
}
} | 29.888889 | 132 | 0.593866 | [
"MIT"
] | upmasharma/OnlineLawSystem | addDetails.aspx.cs | 1,078 | C# |
using System;
using DATReader.DatStore;
namespace DATReader.DatClean
{
public static partial class DatClean
{
public static void MakeDatSingleLevel(DatHeader tDatHeader)
{
DatBase[] db = tDatHeader.BaseDir.ToArray();
tDatHeader.Dir = "noautodir";
tDatHeader.BaseDir.ChildrenClear();
DatDir root = new DatDir(DatFileType.UnSet)
{
Name = tDatHeader.Name,
DGame = new DatGame { Description = tDatHeader.Description }
};
tDatHeader.BaseDir.ChildAdd(root);
foreach (DatBase set in db)
{
string dirName = set.Name;
if (!(set is DatDir romSet))
continue;
DatBase[] dbr = romSet.ToArray();
foreach (DatBase rom in dbr)
{
rom.Name = dirName + "\\" + rom.Name;
root.ChildAdd(rom);
}
}
}
public static void DirectoryExpand(DatDir dDir, bool checkFilename = false)
{
DatBase[] arrDir = dDir.ToArray();
bool foundSubDir = false;
foreach (DatBase db in arrDir)
{
if (!checkFilename && !(db is DatDir))
continue;
if (!db.Name.Contains("\\"))
continue;
foundSubDir = true;
break;
}
if (foundSubDir)
{
dDir.ChildrenClear();
foreach (DatBase db in arrDir)
{
if (!checkFilename && !(db is DatDir))
{
dDir.ChildAdd(db);
continue;
}
if (!db.Name.Contains("\\"))
{
dDir.ChildAdd(db);
continue;
}
string dirName = db.Name;
int split = dirName.IndexOf("\\", StringComparison.Ordinal);
string part0 = dirName.Substring(0, split);
string part1 = dirName.Substring(split + 1);
db.Name = part1;
DatDir dirFind = new DatDir(db.DatFileType) { Name = part0 };
if (dDir.ChildNameSearch(dirFind, out int index) != 0)
{
dDir.ChildAdd(dirFind);
}
else
{
dirFind = (DatDir)dDir.Child(index);
}
dirFind.ChildAdd(db);
}
arrDir = dDir.ToArray();
}
foreach (DatBase db in arrDir)
{
if (!(db is DatDir dbDir))
continue;
DirectoryExpand(dbDir, checkFilename);
}
}
}
}
| 32.208333 | 84 | 0.402652 | [
"MIT"
] | eingrossfilou/RVWorld | DATReader/DatClean/DatClean.cs | 3,094 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AccountingSystems.Controllers;
using Microsoft.AspNetCore.Mvc;
namespace AccountingSystems.Web.Controllers
{
public class ARReportController : AccountingSystemsControllerBase
{
public IActionResult Index()
{
return View();
}
}
} | 22.411765 | 69 | 0.71916 | [
"MIT"
] | CorinthDev-Github/Invoice-and-Accounting-System | aspnet-core/src/AccountingSystems.Web.Mvc/Controllers/ARReportController.cs | 383 | C# |
// *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
namespace Pulumi.AzureNative.ServiceFabric.V20160901.Outputs
{
[OutputType]
public sealed class ClientCertificateThumbprintResponse
{
/// <summary>
/// Certificate thumbprint
/// </summary>
public readonly string CertificateThumbprint;
/// <summary>
/// Is this certificate used for admin access from the client, if false, it is used or query only access
/// </summary>
public readonly bool IsAdmin;
[OutputConstructor]
private ClientCertificateThumbprintResponse(
string certificateThumbprint,
bool isAdmin)
{
CertificateThumbprint = certificateThumbprint;
IsAdmin = isAdmin;
}
}
}
| 29.027778 | 112 | 0.660287 | [
"Apache-2.0"
] | pulumi-bot/pulumi-azure-native | sdk/dotnet/ServiceFabric/V20160901/Outputs/ClientCertificateThumbprintResponse.cs | 1,045 | C# |
using Claw.Documents;
using Claw.Validation;
using System;
using System.Collections.Generic;
namespace Claw.Commands
{
/// <summary>
/// Represents an action command. This can be a macro or normal key strike.
/// </summary>
public class ActionCommand : Command
{
internal const string ACTION_BLOCK_CHILD_NODE = "actionblock";
#region Validation
private static readonly string[] REQUIRED_ATTRIBUTES = {
NameAttribute,
};
private static readonly string[] OPTIONAL_ATTRIBUTES = {
IconAttribute,
};
private static readonly string[] REQUIRED_CHILD_NODES = { };
private static readonly string[] OPTIONAL_CHILD_NODES = {
ACTION_BLOCK_CHILD_NODE,
};
internal override string[] RequiredAttributes
{
get { return REQUIRED_ATTRIBUTES; }
}
internal override string[] OptionalAttributes
{
get { return OPTIONAL_ATTRIBUTES; }
}
internal override string[] RequiredChildNodes
{
get { return REQUIRED_CHILD_NODES; }
}
internal override string[] OptionalChildNodes
{
get { return OPTIONAL_CHILD_NODES; }
}
#endregion
private LinkedList<ActionBlock> actionBlocks = new LinkedList<ActionBlock>();
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase", Justification = "Profile files need lowercase strings.")]
protected override string NodeName
{
get { return CommandList.ACTION_COMMAND_CHILD_NODE.ToLowerInvariant(); }
}
/// <summary>
/// Creates a new ActionCommand.
/// </summary>
/// <param name="commandName">The name of the command.</param>
public ActionCommand(string commandName)
: base(commandName)
{ }
/// <summary>
/// Creates a new ActionCommand.
/// </summary>
/// <param name="validator">The validator to use for validation.</param>
/// <param name="node">The "actioncommand" node.</param>
internal ActionCommand(NodeValidator validator, Node node)
: base(validator, node)
{
foreach (var child in node.Children)
{
if (child.Name.ToUpperInvariant() == "ACTIONBLOCK")
{
actionBlocks.AddLast(new ActionBlock(validator, child));
}
}
}
internal override void FillNode(Node node)
{
foreach (ActionBlock block in actionBlocks)
{
node.Children.AddLast(block.CreateNodes());
}
}
}
}
| 30.358696 | 179 | 0.586824 | [
"MIT"
] | UserXXX/Claw | ClawLib/Commands/ActionCommand.cs | 2,795 | C# |
namespace vein.cmd;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
using compilation;
using project;
using Spectre.Console;
using Spectre.Console.Cli;
public class RestoreCommand : AsyncCommandWithProject<RestoreCommandSettings>
{
public ProgressContext ProgressContext { get; set; }
public static readonly Uri VEIN_GALLERY = new Uri("https://api.vein.gallery/");
public ShardRegistryQuery query = new ShardRegistryQuery(VEIN_GALLERY)
.WithStorage(new ShardStorage());
public override async Task<int> ExecuteAsync(CommandContext context, RestoreCommandSettings settings,
VeinProject project)
{
if (ProgressContext == null)
return await AnsiConsole
.Progress()
.AutoClear(false)
.AutoRefresh(true)
.HideCompleted(true)
.Columns(
new ProgressBarColumn(),
new PercentageColumn(),
new SpinnerColumn { Spinner = Spinner.Known.Dots8Bit, CompletedText = "✅", FailedText = "❌" },
new TaskDescriptionColumn { Alignment = Justify.Left })
.StartAsync(async ctx => await new RestoreCommand() { ProgressContext = ctx }
.ExecuteAsync(context, new RestoreCommandSettings() { Project = settings.Project }, project));
var task = ProgressContext.AddTask($"Restore [orange]'{project.Name}'[/] project.");
var graph = await CollectDependencyGraphAsync(project, task);
var failed = false;
task.IsIndeterminate(false);
task.MaxValue(graph.Count);
await Parallel.ForEachAsync(graph, async (target, token) =>
{
try
{
await query.DownloadShardAsync(target, token);
}
catch (Exception e)
{
failed = true;
Log.Error($"[red]Failed[/] sync [orange]'{target.Name}@{target.Version}'[/] shard.");
Log.Error($"{e.Message}");
throw;
}
task.VeinStatus($"Shard package [orange]'{target.Name}@{target.Version}'[/] has been synced.");
task.Increment(1);
});
if (failed)
{
Log.Error($"[red]Failed[/] sync [orange]'{project.Name}'[/] project.");
return -1;
}
Log.Info($"[green]Success[/] sync [orange]'{project.Name}'[/] project.");
return 0;
}
private async Task<List<RegistryPackage>> CollectDependencyGraphAsync(VeinProject project, ProgressTask task)
{
task.IsIndeterminate(true);
var list = new List<RegistryPackage>();
foreach (var dependency in project.Dependencies.Packages.ToList())
await FetchAsync(list, task, dependency);
return list;
}
private async Task FetchAsync(List<RegistryPackage> container, ProgressTask task, PackageReference @ref)
{
task.VeinStatus($"Fetch '{@ref.Name}@{@ref.Version}'...");
var q = await query.FindByName(@ref.Name, $"{@ref.Version}");
foreach (var dependency in q.Dependencies)
await FetchAsync(container, task, dependency);
container.Add(q);
}
}
public class RestoreCommandSettings : CommandSettings, IProjectSettingProvider
{
[Description("Path to project")]
[CommandOption("--project")]
public string Project { get; set; }
}
| 36.5 | 114 | 0.609304 | [
"MIT"
] | 0xF6/mana_lang | compiler/cmd/RestoreCommand.cs | 3,508 | C# |
using OpenTK.Mathematics;
namespace StarSystemSimulator.Graphics
{
public class Point
{
public readonly Vector3 Position;
public Color4 Color;
readonly Matrix4 objectMatrix;
public Point(Vector3 position, Color4 color, float size = 0.01f)
{
Position = position;
Color = color;
objectMatrix = Matrix4.CreateScale(size) * Matrix4.CreateTranslation(position);
}
public void Render()
{
MasterRenderer.DefaultManager.UniformModelView(Camera.InverseScaleMatrix * objectMatrix);
MasterRenderer.DefaultManager.UniformColor(Color);
PointRenderable.Render();
}
}
}
| 21.428571 | 92 | 0.751667 | [
"MIT"
] | abc013/StarSystemSimulator | StarSystemSimulator/Graphics/Point.cs | 602 | C# |
namespace MassTransit.GrpcTransport.Fabric
{
using System;
using System.Threading;
using System.Threading.Channels;
using System.Threading.Tasks;
using Context;
using Contexts;
using GreenPipes;
using GreenPipes.Internals.Extensions;
using Util;
public class GrpcQueue :
IGrpcQueue
{
readonly Channel<DeliveryContext<GrpcTransportMessage>> _channel;
readonly TaskCompletionSource<IGrpcQueueConsumer> _consumer;
readonly ConsumerCollection<IGrpcQueueConsumer> _consumers;
readonly CancellationTokenSource _cancel;
readonly Task _dispatcher;
readonly string _name;
readonly IMessageFabricObserver _observer;
public GrpcQueue(IMessageFabricObserver observer, string name)
{
_observer = observer;
_name = name;
_consumers = new ConsumerCollection<IGrpcQueueConsumer>();
_consumer = TaskUtil.GetTask<IGrpcQueueConsumer>();
_cancel = new CancellationTokenSource();
var outputOptions = new UnboundedChannelOptions
{
SingleWriter = false,
SingleReader = true,
AllowSynchronousContinuations = false
};
_channel = Channel.CreateUnbounded<DeliveryContext<GrpcTransportMessage>>(outputOptions);
_dispatcher = Task.Run(() => StartDispatcher(_cancel.Token));
}
public ConnectHandle ConnectConsumer(NodeContext nodeContext, IGrpcQueueConsumer consumer)
{
try
{
var handle = _consumers.Connect(consumer);
handle = _observer.ConsumerConnected(nodeContext, handle, _name);
_consumer.TrySetResult(consumer);
return handle;
}
catch (Exception exception)
{
throw new ConfigurationException($"Only a single consumer can be connected to a queue: {_name}", exception);
}
}
public async Task Deliver(DeliveryContext<GrpcTransportMessage> context)
{
if (context.WasAlreadyDelivered(this))
return;
if (context.Message.EnqueueTime.HasValue)
DeliverWithDelay(context);
else
await _channel.Writer.WriteAsync(context, context.CancellationToken).ConfigureAwait(false);
}
public Task Send(GrpcTransportMessage message, CancellationToken cancellationToken)
{
var deliveryContext = new GrpcDeliveryContext(message, cancellationToken);
return Deliver(deliveryContext);
}
public async ValueTask DisposeAsync()
{
_cancel.Cancel();
_channel.Writer.Complete();
await _channel.Reader.Completion.ConfigureAwait(false);
_cancel.Cancel();
await _dispatcher.ConfigureAwait(false);
}
void DeliverWithDelay(DeliveryContext<GrpcTransportMessage> context)
{
Task.Run(async () =>
{
var delay = context.Message.EnqueueTime.Value - DateTime.UtcNow;
if (delay > TimeSpan.Zero)
await Task.Delay(delay, context.CancellationToken).ConfigureAwait(false);
await _channel.Writer.WriteAsync(context, context.CancellationToken).ConfigureAwait(false);
}, context.CancellationToken);
}
async Task StartDispatcher(CancellationToken cancellationToken)
{
try
{
// convert to convergent channels
await _consumer.Task.OrCanceled(cancellationToken).ConfigureAwait(false);
while (await _channel.Reader.WaitToReadAsync(cancellationToken).ConfigureAwait(false))
{
DeliveryContext<GrpcTransportMessage> context = await _channel.Reader.ReadAsync(cancellationToken).ConfigureAwait(false);
try
{
var consumer = _consumers.Next();
if (consumer != null)
await consumer.Consume(context.Message, context.CancellationToken).ConfigureAwait(false);
}
catch (Exception exception)
{
LogContext.Warning?.Log(exception, "Failed to dispatch message");
}
}
}
catch (OperationCanceledException)
{
}
catch (Exception exception)
{
LogContext.Warning?.Log(exception, "Queue dispatcher faulted: {Queue}", _name);
}
}
public override string ToString()
{
return $"Queue({_name})";
}
}
}
| 33.363014 | 141 | 0.585095 | [
"ECL-2.0",
"Apache-2.0"
] | zbarrier/MassTransit | src/Transports/MassTransit.GrpcTransport/Fabric/GrpcQueue.cs | 4,873 | C# |
// File initially copied from
// https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/4d9b3e3bb785a55f73b3029a843f0c0b73cc9ea7/StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/Helpers/DocumentBasedFixAllProvider.cs
// Original copyright statement:
// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CodeFixes;
namespace Meziantou.Analyzer
{
/// <summary>
/// Provides a base class to write a <see cref="FixAllProvider"/> that fixes documents independently.
/// </summary>
internal abstract class DocumentBasedFixAllProvider : FixAllProvider
{
protected abstract string CodeActionTitle { get; }
public override Task<CodeAction?> GetFixAsync(FixAllContext fixAllContext)
{
return Task.FromResult(fixAllContext.Scope switch
{
FixAllScope.Document => CodeAction.Create(
CodeActionTitle,
cancellationToken => GetDocumentFixesAsync(fixAllContext.WithCancellationToken(cancellationToken)),
nameof(DocumentBasedFixAllProvider)),
FixAllScope.Project => CodeAction.Create(
CodeActionTitle,
cancellationToken => GetProjectFixesAsync(fixAllContext.WithCancellationToken(cancellationToken), fixAllContext.Project),
nameof(DocumentBasedFixAllProvider)),
FixAllScope.Solution => CodeAction.Create(
CodeActionTitle,
cancellationToken => GetSolutionFixesAsync(fixAllContext.WithCancellationToken(cancellationToken)),
nameof(DocumentBasedFixAllProvider)),
_ => null,
});
}
/// <summary>
/// Fixes all occurrences of a diagnostic in a specific document.
/// </summary>
/// <param name="fixAllContext">The context for the Fix All operation.</param>
/// <param name="document">The document to fix.</param>
/// <param name="diagnostics">The diagnostics to fix in the document.</param>
/// <returns>
/// <para>The new <see cref="SyntaxNode"/> representing the root of the fixed document.</para>
/// <para>-or-</para>
/// <para><see langword="null"/>, if no changes were made to the document.</para>
/// </returns>
protected abstract Task<SyntaxNode?> FixAllInDocumentAsync(FixAllContext fixAllContext, Document document, ImmutableArray<Diagnostic> diagnostics);
private async Task<Document> GetDocumentFixesAsync(FixAllContext fixAllContext)
{
var document = fixAllContext.Document!;
var documentDiagnosticsToFix = await FixAllContextHelper.GetDocumentDiagnosticsToFixAsync(fixAllContext).ConfigureAwait(false);
if (!documentDiagnosticsToFix.TryGetValue(document, out var diagnostics))
{
return document;
}
var newRoot = await FixAllInDocumentAsync(fixAllContext, document, diagnostics).ConfigureAwait(false);
if (newRoot == null)
{
return document;
}
return document.WithSyntaxRoot(newRoot);
}
private async Task<Solution> GetSolutionFixesAsync(FixAllContext fixAllContext, ImmutableArray<Document> documents)
{
var documentDiagnosticsToFix = await FixAllContextHelper.GetDocumentDiagnosticsToFixAsync(fixAllContext).ConfigureAwait(false);
var solution = fixAllContext.Solution;
var newDocuments = new List<Task<SyntaxNode?>>(documents.Length);
foreach (var document in documents)
{
if (!documentDiagnosticsToFix.TryGetValue(document, out var diagnostics))
{
newDocuments.Add(document.GetSyntaxRootAsync(fixAllContext.CancellationToken));
continue;
}
newDocuments.Add(FixAllInDocumentAsync(fixAllContext, document, diagnostics));
}
for (var i = 0; i < documents.Length; i++)
{
var newDocumentRoot = await newDocuments[i].ConfigureAwait(false);
if (newDocumentRoot == null)
continue;
solution = solution.WithDocumentSyntaxRoot(documents[i].Id, newDocumentRoot);
}
return solution;
}
private Task<Solution> GetProjectFixesAsync(FixAllContext fixAllContext, Project project)
{
return GetSolutionFixesAsync(fixAllContext, project.Documents.ToImmutableArray());
}
private Task<Solution> GetSolutionFixesAsync(FixAllContext fixAllContext)
{
var documents = fixAllContext.Solution.Projects.SelectMany(i => i.Documents).ToImmutableArray();
return GetSolutionFixesAsync(fixAllContext, documents);
}
}
}
| 47.391304 | 189 | 0.627339 | [
"MIT"
] | jannesrsa/Meziantou.Analyzer | src/Meziantou.Analyzer/Internals/DocumentBasedFixAllProvider.cs | 5,452 | C# |
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.IO;
using System.Text;
using Microsoft.Data.Sqlite.Properties;
using SQLitePCL;
namespace Microsoft.Data.Sqlite
{
/// <summary>
/// Provides methods for reading the result of a command executed against a SQLite database.
/// </summary>
public class SqliteDataReader : DbDataReader
{
private readonly SqliteCommand _command;
private readonly bool _closeConnection;
private readonly Queue<(sqlite3_stmt stmt, bool)> _stmtQueue;
private sqlite3_stmt _stmt;
private SqliteDataRecord _record;
private bool _hasRows;
private bool _stepped;
private bool _done;
private bool _closed;
internal SqliteDataReader(
SqliteCommand command,
Queue<(sqlite3_stmt, bool)> stmtQueue,
int recordsAffected,
bool closeConnection)
{
if (stmtQueue.Count != 0)
{
(_stmt, _hasRows) = stmtQueue.Dequeue();
_record = new SqliteDataRecord(_stmt);
}
_command = command;
_stmtQueue = stmtQueue;
RecordsAffected = recordsAffected;
_closeConnection = closeConnection;
}
/// <summary>
/// Gets the depth of nesting for the current row. Always zero.
/// </summary>
/// <value>The depth of nesting for the current row.</value>
public override int Depth
=> 0;
/// <summary>
/// Gets the number of columns in the current row.
/// </summary>
/// <value>The number of columns in the current row.</value>
public override int FieldCount
=> _closed
? throw new InvalidOperationException(Resources.DataReaderClosed(nameof(FieldCount)))
: _record.FieldCount;
/// <summary>
/// Gets a handle to underlying prepared statement.
/// </summary>
/// <value>A handle to underlying prepared statement.</value>
/// <seealso href="http://sqlite.org/c3ref/stmt.html">Prepared Statement Object</seealso>
public virtual sqlite3_stmt Handle
=> _stmt;
/// <summary>
/// Gets a value indicating whether the data reader contains any rows.
/// </summary>
/// <value>A value indicating whether the data reader contains any rows.</value>
public override bool HasRows
=> _hasRows;
/// <summary>
/// Gets a value indicating whether the data reader is closed.
/// </summary>
/// <value>A value indicating whether the data reader is closed.</value>
public override bool IsClosed
=> _closed;
/// <summary>
/// Gets the number of rows inserted, updated, or deleted. -1 for SELECT statements.
/// </summary>
/// <value>The number of rows inserted, updated, or deleted.</value>
public override int RecordsAffected { get; }
/// <summary>
/// Gets the value of the specified column.
/// </summary>
/// <param name="name">The name of the column. The value is case-sensitive.</param>
/// <returns>The value.</returns>
public override object this[string name]
=> _record[name];
/// <summary>
/// Gets the value of the specified column.
/// </summary>
/// <param name="ordinal">The zero-based column ordinal.</param>
/// <returns>The value.</returns>
public override object this[int ordinal]
=> _record[ordinal];
/// <summary>
/// Gets an enumerator that can be used to iterate through the rows in the data reader.
/// </summary>
/// <returns>The enumerator.</returns>
public override IEnumerator GetEnumerator()
=> new DbEnumerator(this, closeReader: false);
/// <summary>
/// Advances to the next row in the result set.
/// </summary>
/// <returns>true if there are more rows; otherwise, false.</returns>
public override bool Read()
{
if (_closed)
{
throw new InvalidOperationException(Resources.DataReaderClosed(nameof(Read)));
}
if (!_stepped)
{
_stepped = true;
return _hasRows;
}
var rc = raw.sqlite3_step(_stmt);
SqliteException.ThrowExceptionForRC(rc, _command.Connection.Handle);
_record.Clear();
_done = rc == raw.SQLITE_DONE;
return !_done;
}
/// <summary>
/// Advances to the next result set for batched statements.
/// </summary>
/// <returns>true if there are more result sets; otherwise, false.</returns>
public override bool NextResult()
{
if (_stmtQueue.Count == 0)
{
return false;
}
raw.sqlite3_reset(_stmt);
(_stmt, _hasRows) = _stmtQueue.Dequeue();
_record = new SqliteDataRecord(_stmt);
_stepped = false;
_done = false;
return true;
}
/// <summary>
/// Closes the data reader.
/// </summary>
public override void Close()
=> Dispose(true);
/// <summary>
/// Releases any resources used by the data reader and closes it.
/// </summary>
/// <param name="disposing">
/// true to release managed and unmanaged resources; false to release only unmanaged resources.
/// </param>
protected override void Dispose(bool disposing)
{
if (!disposing)
{
return;
}
_command.DataReader = null;
if (_stmt != null)
{
raw.sqlite3_reset(_stmt);
_stmt = null;
_record = null;
}
while (_stmtQueue.Count != 0)
{
raw.sqlite3_reset(_stmtQueue.Dequeue().stmt);
}
_closed = true;
if (_closeConnection)
{
_command.Connection.Close();
}
}
/// <summary>
/// Gets the name of the specified column.
/// </summary>
/// <param name="ordinal">The zero-based column ordinal.</param>
/// <returns>The name of the column.</returns>
public override string GetName(int ordinal)
{
if (_closed)
{
throw new InvalidOperationException(Resources.DataReaderClosed(nameof(GetName)));
}
return _record.GetName(ordinal);
}
/// <summary>
/// Gets the ordinal of the specified column.
/// </summary>
/// <param name="name">The name of the column.</param>
/// <returns>The zero-based column ordinal.</returns>
public override int GetOrdinal(string name)
=> _record.GetOrdinal(name);
/// <summary>
/// Gets the declared data type name of the specified column. The storage class is returned for computed
/// columns.
/// </summary>
/// <param name="ordinal">The zero-based column ordinal.</param>
/// <returns>The data type name of the column.</returns>
/// <remarks>Due to SQLite's dynamic type system, this may not reflect the actual type of the value.</remarks>
/// <seealso href="http://sqlite.org/datatype3.html">Datatypes In SQLite Version 3</seealso>
public override string GetDataTypeName(int ordinal)
{
if (_closed)
{
throw new InvalidOperationException(Resources.DataReaderClosed(nameof(GetDataTypeName)));
}
return _record.GetDataTypeName(ordinal);
}
/// <summary>
/// Gets the data type of the specified column.
/// </summary>
/// <param name="ordinal">The zero-based column ordinal.</param>
/// <returns>The data type of the column.</returns>
public override Type GetFieldType(int ordinal)
{
if (_closed)
{
throw new InvalidOperationException(Resources.DataReaderClosed(nameof(GetFieldType)));
}
return _record.GetFieldType(ordinal);
}
/// <summary>
/// Gets a value indicating whether the specified column is <see cref="DBNull" />.
/// </summary>
/// <param name="ordinal">The zero-based column ordinal.</param>
/// <returns>true if the specified column is <see cref="DBNull" />; otherwise, false.</returns>
public override bool IsDBNull(int ordinal)
=> _closed
? throw new InvalidOperationException(Resources.DataReaderClosed(nameof(IsDBNull)))
: !_stepped || _done
? throw new InvalidOperationException(Resources.NoData)
: _record.IsDBNull(ordinal);
/// <summary>
/// Gets the value of the specified column as a <see cref="bool" />.
/// </summary>
/// <param name="ordinal">The zero-based column ordinal.</param>
/// <returns>The value of the column.</returns>
public override bool GetBoolean(int ordinal)
=> _record.GetBoolean(ordinal);
/// <summary>
/// Gets the value of the specified column as a <see cref="byte" />.
/// </summary>
/// <param name="ordinal">The zero-based column ordinal.</param>
/// <returns>The value of the column.</returns>
public override byte GetByte(int ordinal)
=> _record.GetByte(ordinal);
/// <summary>
/// Gets the value of the specified column as a <see cref="char" />.
/// </summary>
/// <param name="ordinal">The zero-based column ordinal.</param>
/// <returns>The value of the column.</returns>
public override char GetChar(int ordinal)
=> _record.GetChar(ordinal);
/// <summary>
/// Gets the value of the specified column as a <see cref="DateTime" />.
/// </summary>
/// <param name="ordinal">The zero-based column ordinal.</param>
/// <returns>The value of the column.</returns>
public override DateTime GetDateTime(int ordinal)
=> _record.GetDateTime(ordinal);
/// <summary>
/// Gets the value of the specified column as a <see cref="DateTimeOffset" />.
/// </summary>
/// <param name="ordinal">The zero-based column ordinal.</param>
/// <returns>The value of the column.</returns>
public virtual DateTimeOffset GetDateTimeOffset(int ordinal)
=> _record.GetDateTimeOffset(ordinal);
/// <summary>
/// Gets the value of the specified column as a <see cref="TimeSpan" />.
/// </summary>
/// <param name="ordinal">The zero-based column ordinal.</param>
/// <returns>The value of the column.</returns>
public virtual TimeSpan GetTimeSpan(int ordinal)
=> _record.GetTimeSpan(ordinal);
/// <summary>
/// Gets the value of the specified column as a <see cref="decimal" />.
/// </summary>
/// <param name="ordinal">The zero-based column ordinal.</param>
/// <returns>The value of the column.</returns>
public override decimal GetDecimal(int ordinal)
=> _record.GetDecimal(ordinal);
/// <summary>
/// Gets the value of the specified column as a <see cref="double" />.
/// </summary>
/// <param name="ordinal">The zero-based column ordinal.</param>
/// <returns>The value of the column.</returns>
public override double GetDouble(int ordinal)
=> _record.GetDouble(ordinal);
/// <summary>
/// Gets the value of the specified column as a <see cref="float" />.
/// </summary>
/// <param name="ordinal">The zero-based column ordinal.</param>
/// <returns>The value of the column.</returns>
public override float GetFloat(int ordinal)
=> _record.GetFloat(ordinal);
/// <summary>
/// Gets the value of the specified column as a <see cref="Guid" />.
/// </summary>
/// <param name="ordinal">The zero-based column ordinal.</param>
/// <returns>The value of the column.</returns>
public override Guid GetGuid(int ordinal)
=> _record.GetGuid(ordinal);
/// <summary>
/// Gets the value of the specified column as a <see cref="short" />.
/// </summary>
/// <param name="ordinal">The zero-based column ordinal.</param>
/// <returns>The value of the column.</returns>
public override short GetInt16(int ordinal)
=> _record.GetInt16(ordinal);
/// <summary>
/// Gets the value of the specified column as a <see cref="int" />.
/// </summary>
/// <param name="ordinal">The zero-based column ordinal.</param>
/// <returns>The value of the column.</returns>
public override int GetInt32(int ordinal)
=> _record.GetInt32(ordinal);
/// <summary>
/// Gets the value of the specified column as a <see cref="long" />.
/// </summary>
/// <param name="ordinal">The zero-based column ordinal.</param>
/// <returns>The value of the column.</returns>
public override long GetInt64(int ordinal)
=> _record.GetInt64(ordinal);
/// <summary>
/// Gets the value of the specified column as a <see cref="string" />.
/// </summary>
/// <param name="ordinal">The zero-based column ordinal.</param>
/// <returns>The value of the column.</returns>
public override string GetString(int ordinal)
=> _record.GetString(ordinal);
/// <summary>
/// Reads a stream of bytes from the specified column. Not supported.
/// </summary>
/// <param name="ordinal">The zero-based column ordinal.</param>
/// <param name="dataOffset">The index from which to begin the read operation.</param>
/// <param name="buffer">The buffer into which the data is copied.</param>
/// <param name="bufferOffset">The index to which the data will be copied.</param>
/// <param name="length">The maximum number of bytes to read.</param>
/// <returns>The actual number of bytes read.</returns>
public override long GetBytes(int ordinal, long dataOffset, byte[] buffer, int bufferOffset, int length)
=> _record.GetBytes(ordinal, dataOffset, buffer, bufferOffset, length);
/// <summary>
/// Reads a stream of characters from the specified column. Not supported.
/// </summary>
/// <param name="ordinal">The zero-based column ordinal.</param>
/// <param name="dataOffset">The index from which to begin the read operation.</param>
/// <param name="buffer">The buffer into which the data is copied.</param>
/// <param name="bufferOffset">The index to which the data will be copied.</param>
/// <param name="length">The maximum number of characters to read.</param>
/// <returns>The actual number of characters read.</returns>
public override long GetChars(int ordinal, long dataOffset, char[] buffer, int bufferOffset, int length)
=> _record.GetChars(ordinal, dataOffset, buffer, bufferOffset, length);
/// <summary>
/// Retrieves data as a Stream.
/// </summary>
/// <param name="ordinal">The zero-based column ordinal.</param>
/// <returns>The returned object.</returns>
public override Stream GetStream(int ordinal)
=> _record.GetStream(ordinal);
/// <summary>
/// Gets the value of the specified column.
/// </summary>
/// <typeparam name="T">The type of the value.</typeparam>
/// <param name="ordinal">The zero-based column ordinal.</param>
/// <returns>The value of the column.</returns>
public override T GetFieldValue<T>(int ordinal)
{
if (typeof(T) == typeof(DBNull)
&& (!_stepped || _done))
{
throw new InvalidOperationException(Resources.NoData);
}
return _record.GetFieldValue<T>(ordinal);
}
/// <summary>
/// Gets the value of the specified column.
/// </summary>
/// <param name="ordinal">The zero-based column ordinal.</param>
/// <returns>The value of the column.</returns>
public override object GetValue(int ordinal)
{
if (_closed)
{
throw new InvalidOperationException(Resources.DataReaderClosed(nameof(GetValue)));
}
if (!_stepped || _done)
{
throw new InvalidOperationException(Resources.NoData);
}
return _record.GetValue(ordinal);
}
/// <summary>
/// Gets the column values of the current row.
/// </summary>
/// <param name="values">An array into which the values are copied.</param>
/// <returns>The number of values copied into the array.</returns>
public override int GetValues(object[] values)
=> _record.GetValues(values);
/// <summary>
/// Returns a System.Data.DataTable that describes the column metadata of the System.Data.Common.DbDataReader.
/// </summary>
/// <returns>A System.Data.DataTable that describes the column metadata.</returns>
public override DataTable GetSchemaTable()
{
var schemaTable = new DataTable("SchemaTable");
var ColumnName = new DataColumn(SchemaTableColumn.ColumnName, typeof(string));
var ColumnOrdinal = new DataColumn(SchemaTableColumn.ColumnOrdinal, typeof(int));
var ColumnSize = new DataColumn(SchemaTableColumn.ColumnSize, typeof(int));
var NumericPrecision = new DataColumn(SchemaTableColumn.NumericPrecision, typeof(short));
var NumericScale = new DataColumn(SchemaTableColumn.NumericScale, typeof(short));
var DataType = new DataColumn(SchemaTableColumn.DataType, typeof(Type));
var DataTypeName = new DataColumn("DataTypeName", typeof(string));
var IsLong = new DataColumn(SchemaTableColumn.IsLong, typeof(bool));
var AllowDBNull = new DataColumn(SchemaTableColumn.AllowDBNull, typeof(bool));
var IsUnique = new DataColumn(SchemaTableColumn.IsUnique, typeof(bool));
var IsKey = new DataColumn(SchemaTableColumn.IsKey, typeof(bool));
var IsAutoIncrement = new DataColumn(SchemaTableOptionalColumn.IsAutoIncrement, typeof(bool));
var BaseCatalogName = new DataColumn(SchemaTableOptionalColumn.BaseCatalogName, typeof(string));
var BaseSchemaName = new DataColumn(SchemaTableColumn.BaseSchemaName, typeof(string));
var BaseTableName = new DataColumn(SchemaTableColumn.BaseTableName, typeof(string));
var BaseColumnName = new DataColumn(SchemaTableColumn.BaseColumnName, typeof(string));
var BaseServerName = new DataColumn(SchemaTableOptionalColumn.BaseServerName, typeof(string));
var IsAliased = new DataColumn(SchemaTableColumn.IsAliased, typeof(bool));
var IsExpression = new DataColumn(SchemaTableColumn.IsExpression, typeof(bool));
var columns = schemaTable.Columns;
columns.Add(ColumnName);
columns.Add(ColumnOrdinal);
columns.Add(ColumnSize);
columns.Add(NumericPrecision);
columns.Add(NumericScale);
columns.Add(IsUnique);
columns.Add(IsKey);
columns.Add(BaseServerName);
columns.Add(BaseCatalogName);
columns.Add(BaseColumnName);
columns.Add(BaseSchemaName);
columns.Add(BaseTableName);
columns.Add(DataType);
columns.Add(DataTypeName);
columns.Add(AllowDBNull);
columns.Add(IsAliased);
columns.Add(IsExpression);
columns.Add(IsAutoIncrement);
columns.Add(IsLong);
for (var i = 0; i < FieldCount; i++)
{
var schemaRow = schemaTable.NewRow();
schemaRow[ColumnName] = GetName(i);
schemaRow[ColumnOrdinal] = i;
schemaRow[ColumnSize] = DBNull.Value;
schemaRow[NumericPrecision] = DBNull.Value;
schemaRow[NumericScale] = DBNull.Value;
schemaRow[BaseServerName] = _command.Connection.DataSource;
var databaseName = raw.sqlite3_column_database_name(_stmt, i);
schemaRow[BaseCatalogName] = databaseName;
var columnName = raw.sqlite3_column_origin_name(_stmt, i);
schemaRow[BaseColumnName] = columnName;
schemaRow[BaseSchemaName] = DBNull.Value;
var tableName = raw.sqlite3_column_table_name(_stmt, i);
schemaRow[BaseTableName] = tableName;
schemaRow[DataType] = GetFieldType(i);
schemaRow[DataTypeName] = GetDataTypeName(i);
schemaRow[IsAliased] = columnName != GetName(i);
schemaRow[IsExpression] = columnName == null;
schemaRow[IsLong] = DBNull.Value;
if (!string.IsNullOrEmpty(tableName)
&& !string.IsNullOrEmpty(columnName))
{
using (var command = _command.Connection.CreateCommand())
{
command.CommandText = new StringBuilder()
.AppendLine("SELECT COUNT(*)")
.AppendLine("FROM pragma_index_list($table) i, pragma_index_info(i.name) c")
.AppendLine("WHERE \"unique\" = 1 AND c.name = $column AND")
.AppendLine("NOT EXISTS (SELECT * FROM pragma_index_info(i.name) c2 WHERE c2.name != c.name);").ToString();
command.Parameters.AddWithValue("$table", tableName);
command.Parameters.AddWithValue("$column", columnName);
var cnt = (long)command.ExecuteScalar();
schemaRow[IsUnique] = cnt != 0;
command.Parameters.Clear();
var columnType = "typeof(\"" + columnName.Replace("\"", "\"\"") + "\")";
command.CommandText = new StringBuilder()
.AppendLine($"SELECT {columnType}")
.AppendLine($"FROM \"{tableName}\"")
.AppendLine($"WHERE {columnType} != 'null'")
.AppendLine($"GROUP BY {columnType}")
.AppendLine("ORDER BY count() DESC")
.AppendLine("LIMIT 1;").ToString();
var type = (string)command.ExecuteScalar();
schemaRow[DataType] = SqliteDataRecord.GetFieldType(type);
}
if (!string.IsNullOrEmpty(databaseName))
{
var rc = raw.sqlite3_table_column_metadata(_command.Connection.Handle, databaseName, tableName, columnName, out var dataType, out var collSeq, out var notNull, out var primaryKey, out var autoInc);
SqliteException.ThrowExceptionForRC(rc, _command.Connection.Handle);
schemaRow[IsKey] = primaryKey != 0;
schemaRow[AllowDBNull] = notNull == 0;
schemaRow[IsAutoIncrement] = autoInc != 0;
}
}
schemaTable.Rows.Add(schemaRow);
}
return schemaTable;
}
}
}
| 42.035836 | 221 | 0.57013 | [
"Apache-2.0"
] | aspnet/DataCommon.SQLite | src/Microsoft.Data.Sqlite.Core/SqliteDataReader.cs | 24,635 | C# |
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Abp.Authorization;
using Abp.Configuration;
using Abp.Domain.Uow;
using DevPP.Authorization.Roles;
using DevPP.Authorization.Users;
using DevPP.MultiTenancy;
namespace DevPP.Identity
{
public class SignInManager : AbpSignInManager<Tenant, Role, User>
{
public SignInManager(
UserManager userManager,
IHttpContextAccessor contextAccessor,
UserClaimsPrincipalFactory claimsFactory,
IOptions<IdentityOptions> optionsAccessor,
ILogger<SignInManager<User>> logger,
IUnitOfWorkManager unitOfWorkManager,
ISettingManager settingManager,
IAuthenticationSchemeProvider schemes)
: base(
userManager,
contextAccessor,
claimsFactory,
optionsAccessor,
logger,
unitOfWorkManager,
settingManager,
schemes)
{
}
}
}
| 30.051282 | 69 | 0.646758 | [
"MIT"
] | ThinkAcademy-BR/DevPP | aspnet-core/src/DevPP.Core/Identity/SignInManager.cs | 1,174 | C# |
using UnityEngine;
public class ManagerScript : MonoBehaviour
{
public static ManagerScript Instance { get; private set; }
public static int Counter { get; private set; }
// Use this for initialization
void Start()
{
Instance = this;
}
public void IncrementCounter()
{
Counter++;
UIScript.Instance.UpdatePointsText();
}
public void RestartGame()
{
PlayGamesScript.AddScoreToLeaderboard(GPGSIds.leaderboard_testscores, Counter);
Counter = 0;
UIScript.Instance.UpdatePointsText();
}
} | 20.892857 | 87 | 0.644444 | [
"MIT"
] | Bhasfe/BoggyBall | Assets/Scripts/ManagerScript.cs | 587 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Program
{
static void Main()
{
int hours = int.Parse(Console.ReadLine());
int minutes = int.Parse(Console.ReadLine());
minutes += 30;
if (minutes >= 60)
{
minutes -= 60;
hours++;
}
if (hours >= 24)
{
hours -= 24;
}
Console.WriteLine($"{hours}:{minutes:00}");
}
}
| 18.464286 | 52 | 0.512573 | [
"MIT"
] | radoslavvv/Programming-Fundamentals-Extended-May-2017 | Labs/02.CSharpConditionalStatementsAndLoops/03.BackInThirtyMinutes/03.BackInThirtyMinutes.cs | 519 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
namespace LadderDemo.GumRuntimes.DefaultForms
{
public partial class DialogBoxRuntime
{
partial void CustomInitialize ()
{
}
}
}
| 16.714286 | 45 | 0.675214 | [
"MIT"
] | coldacid/FlatRedBall | Samples/Platformer/LadderDemo/LadderDemo/GumRuntimes/DefaultForms/DialogBoxRuntime.cs | 234 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace MiliasBalint_Beadando
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
/// <summary>
/// Egy statikus lista, amelyben a 2 számla található
/// </summary>
static List<Szamla> szamlak = new List<Szamla>();
/// <summary>
/// Ez a MainWindow konstruktora, amely megjeleníti az ablakot
/// </summary>
public MainWindow()
{
InitializeComponent();
Szamla egy = new Szamla("Beta",2500);
Szamla ketto = new Szamla("Alfa",3500);
szamlak.Add(egy);
szamlak.Add(ketto);
E1.Text = Convert.ToString(szamlak[0].Egyenleg);
E2.Text = Convert.ToString(szamlak[1].Egyenleg);
T1.Text = Convert.ToString(szamlak[0].Tulaj);
T2.Text = Convert.ToString(szamlak[1].Tulaj);
}
//Szamla 1
/// <summary>
/// Ez a metódus tartozik a bal oldali Feltöltés gombhoz. Ellenőrzés után frissíti a számla (1) egyenlegét a beírt összeggel
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void F1_Click(object sender, RoutedEventArgs e)
{
try
{
int szam = Convert.ToInt32(B1.Text);
if (szam<0)
{
Uzenet hiba = new Uzenet("A megadott szám nem lehet negatív!");
hiba.Show();
}
else
{
szamlak[0].Egyenleg = szamlak[0].Egyenleg+szam;
E1.Text = Convert.ToString(szamlak[0].Egyenleg);
}
}
catch (FormatException exc)
{
Uzenet hiba = new Uzenet(exc.Message);
hiba.Show();
}
catch (OverflowException exc)
{
Uzenet hiba = new Uzenet(exc.Message);
hiba.Show();
}
}
/// <summary>
/// Ez a metódus tartozik a bal oldali Utalás gombhoz. Ellenőrzés után az 1-es számláról átutalja az adott összeget a 2-esre.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void U1_Click(object sender, RoutedEventArgs e)
{
try
{
int szam = Convert.ToInt32(B1.Text);
if (szam < 0)
{
Uzenet hiba = new Uzenet("A megadott szám nem lehet negatív!");
hiba.Show();
}
else if (szamlak[0].Egyenleg - szam < 0)
{
Uzenet hiba = new Uzenet("Nincs ennyi pénz a számláján!");
hiba.Show();
}
else
{
szamlak[0].Egyenleg -= szam;
E1.Text = Convert.ToString(szamlak[0].Egyenleg);
szamlak[1].Egyenleg += szam;
E2.Text = Convert.ToString(szamlak[1].Egyenleg);
}
}
catch (FormatException exc)
{
Uzenet hiba = new Uzenet(exc.Message);
hiba.Show();
}
catch (OverflowException exc)
{
Uzenet hiba = new Uzenet(exc.Message);
hiba.Show();
}
}
/// <summary>
/// Ez a metódus tartozik a bal oldali Kivétel gombhoz. A bemenet ellenőrzése után az adott összeggel csökkenti az 1-es számla egyenlegét
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void K1_Click(object sender, RoutedEventArgs e)
{
try
{
int szam = Convert.ToInt32(B1.Text);
if (szam < 0)
{
Uzenet hiba = new Uzenet("A megadott szám nem lehet negatív!");
hiba.Show();
}
else if (szamlak[0].Egyenleg - szam < 0)
{
Uzenet hiba = new Uzenet("Nincs ennyi pénz a számláján!");
hiba.Show();
}
else
{
szamlak[0].Egyenleg -= szam;
E1.Text = Convert.ToString(szamlak[0].Egyenleg);
}
}
catch (FormatException exc)
{
Uzenet hiba = new Uzenet(exc.Message);
hiba.Show();
}
catch (OverflowException exc)
{
Uzenet hiba = new Uzenet(exc.Message);
hiba.Show();
}
}
/// <summary>
/// Ez a metódus tartozik a bal oldali Tulaj név váltás gombhoz. Ellenőrzi, hogy írt-e valamit a felhasználó a bemeneti blokkba és
/// ha igen akkor beállítja az új nevet az 1-es számlán
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void NV1_Click(object sender, RoutedEventArgs e)
{
if (B1.Text!="")
{
szamlak[0].Tulaj = B1.Text;
T1.Text = Convert.ToString(szamlak[0].Tulaj);
}
else
{
Uzenet hiba = new Uzenet("Nem adhat meg üres bemenetet!");
hiba.Show();
}
}
//Szamla 2
/// <summary>
/// Ez a metódus tartozik a jobb oldali Feltöltés gombhoz. Ellenőrzés után frissíti a számla (2) egyenlegét a beírt összeggel
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void F2_Click(object sender, RoutedEventArgs e)
{
try
{
int szam = Convert.ToInt32(B2.Text);
if (szam < 0)
{
Uzenet hiba = new Uzenet("A megadott szám nem lehet negatív!");
hiba.Show();
}
else
{
szamlak[1].Egyenleg = szamlak[1].Egyenleg + szam;
E2.Text = Convert.ToString(szamlak[1].Egyenleg);
}
}
catch (FormatException exc)
{
Uzenet hiba = new Uzenet(exc.Message);
hiba.Show();
}
catch (OverflowException exc)
{
Uzenet hiba = new Uzenet(exc.Message);
hiba.Show();
}
}
/// <summary>
/// Ez a metódus tartozik a jobb oldali Utalás gombhoz. Ellenőrzés után az 1-es számláról átutalja az adott összeget a 2-esre.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void U2_Click(object sender, RoutedEventArgs e)
{
try
{
int szam = Convert.ToInt32(B2.Text);
if (szam < 0)
{
Uzenet hiba = new Uzenet("A megadott szám nem lehet negatív!");
hiba.Show();
}
else if (szamlak[1].Egyenleg - szam < 0)
{
Uzenet hiba = new Uzenet("Nincs ennyi pénz a számláján!");
hiba.Show();
}
else
{
szamlak[0].Egyenleg += szam;
E1.Text = Convert.ToString(szamlak[0].Egyenleg);
szamlak[1].Egyenleg -= szam;
E2.Text = Convert.ToString(szamlak[1].Egyenleg);
}
}
catch (FormatException exc)
{
Uzenet hiba = new Uzenet(exc.Message);
hiba.Show();
}
catch (OverflowException exc)
{
Uzenet hiba = new Uzenet(exc.Message);
hiba.Show();
}
}
/// <summary>
/// Ez a metódus tartozik a jobb oldali Kivétel gombhoz. A bemenet ellenőrzése után az adott összeggel csökkenti a 2-es számla egyenlegét
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void K2_Click(object sender, RoutedEventArgs e)
{
try
{
int szam = Convert.ToInt32(B2.Text);
if (szam < 0)
{
Uzenet hiba = new Uzenet("A megadott szám nem lehet negatív!");
hiba.Show();
}
else if (szamlak[1].Egyenleg - szam < 0)
{
Uzenet hiba = new Uzenet("Nincs ennyi pénz a számláján!");
hiba.Show();
}
else
{
szamlak[1].Egyenleg -= szam;
E2.Text = Convert.ToString(szamlak[1].Egyenleg);
}
}
catch (FormatException exc)
{
Uzenet hiba = new Uzenet(exc.Message);
hiba.Show();
}
catch (OverflowException exc)
{
Uzenet hiba = new Uzenet(exc.Message);
hiba.Show();
}
}
/// <summary>
/// Ez a metódus tartozik a jobb oldali Tulaj név váltás gombhoz. Ellenőrzi, hogy írt-e valamit a felhasználó a bemeneti blokkba és
/// ha igen akkor beállítja az új nevet a 2-es számlán
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void NV2_Click(object sender, RoutedEventArgs e)
{
if (B2.Text != "")
{
szamlak[1].Tulaj = B2.Text;
T2.Text = Convert.ToString(szamlak[1].Tulaj);
}
else
{
Uzenet hiba = new Uzenet("Nem adhat meg üres bemenetet!");
hiba.Show();
}
}
}
}
| 32.794479 | 145 | 0.455617 | [
"Apache-2.0"
] | MiliasBalint/Beadando | MiliasBalint_Beadando/MiliasBalint_Beadando/MainWindow.xaml.cs | 10,815 | C# |
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Drawing.Text;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using AYN.Data.Common.Repositories;
using AYN.Data.Models;
using AYN.Services.Data.Interfaces;
using AYN.Services.Mapping;
using AYN.Web.ViewModels.Administration.Users;
using AYN.Web.ViewModels.Users;
using Microsoft.EntityFrameworkCore;
namespace AYN.Services.Data.Implementations;
public class UsersService : IUsersService
{
private readonly IDeletableEntityRepository<ApplicationUser> applicationUserRepository;
private readonly IDeletableEntityRepository<FollowerFollowee> followerFolloweesRepository;
private readonly ICloudinaryService cloudinaryService;
public UsersService(
IDeletableEntityRepository<ApplicationUser> applicationUserRepository,
IDeletableEntityRepository<FollowerFollowee> followerFolloweesRepository,
ICloudinaryService cloudinaryService)
{
this.applicationUserRepository = applicationUserRepository;
this.followerFolloweesRepository = followerFolloweesRepository;
this.cloudinaryService = cloudinaryService;
}
public async Task<IEnumerable<T>> GetAll<T>()
=> await this.applicationUserRepository
.All()
.OrderBy(au => au.FirstName)
.ThenBy(au => au.LastName)
.To<T>()
.ToListAsync();
public async Task<T> GetProfileDetails<T>(string id)
=> await this.applicationUserRepository
.All()
.Where(au => au.Id == id)
.Include(au => au.Followers)
.Include(au => au.Followings)
.Include(au => au.Posts)
.Include(au => au.PostReacts)
.To<T>()
.FirstOrDefaultAsync();
public async Task Follow(string followerId, string followeeId)
{
var followerFollowee = new FollowerFollowee
{
FollowerId = followerId,
FolloweeId = followeeId,
};
await this.followerFolloweesRepository.AddAsync(followerFollowee);
await this.followerFolloweesRepository.SaveChangesAsync();
}
public async Task Unfollow(string followerId, string followeeId)
{
var followerFollowee = this.followerFolloweesRepository
.All()
.FirstOrDefault(ff => ff.FollowerId == followerId &&
ff.FolloweeId == followeeId);
this.followerFolloweesRepository.HardDelete(followerFollowee);
await this.followerFolloweesRepository.SaveChangesAsync();
}
public async Task<IEnumerable<T>> GetFollowers<T>(string userId)
=> await this.followerFolloweesRepository
.All()
.Where(ff => ff.FolloweeId == userId)
.To<T>()
.ToListAsync();
public async Task<IEnumerable<T>> GetFollowings<T>(string userId)
=> await this.followerFolloweesRepository
.All()
.Where(ff => ff.FollowerId == userId)
.To<T>()
.ToListAsync();
public bool IsFollower(string followerId, string followeeId)
=> this.followerFolloweesRepository
.All()
.Any(ff => ff.FollowerId == followerId &&
ff.FolloweeId == followeeId);
public bool IsUserExisting(string userId)
=> this.applicationUserRepository
.All()
.Any(au => au.Id == userId);
public async Task<string> GenerateDefaultAvatar(string firstName, string lastName)
{
var text = $"{firstName[0]}{lastName[0]}".ToUpper();
return await this.ProcessDefaultImage(text, 192, 192, "Arial", 40, FontStyle.Bold);
}
public async Task<string> GenerateDefaultThumbnail(string firstName, string lastName)
{
var text = $"AYN - All you need!{Environment.NewLine}{firstName} {lastName}".ToUpper();
return await this.ProcessDefaultImage(text, 1110, 350, "Arial", 40, FontStyle.Bold);
}
public async Task<T> GetByIdAsync<T>(string id)
=> await this.applicationUserRepository
.All()
.Where(a => a.Id == id)
.To<T>()
.FirstOrDefaultAsync();
public async Task EditAsync(EditUserViewModel model, string wwwRootPath)
{
var user = this.applicationUserRepository
.All()
.FirstOrDefault(au => au.Id == model.EditUserGeneralInfoViewModel.Id);
if (model.EditUserGeneralInfoViewModel.Avatar is not null)
{
await using var ms = new MemoryStream();
await model.EditUserGeneralInfoViewModel.Avatar.CopyToAsync(ms);
var destinationData = ms.ToArray();
var avatarUrl = await this.cloudinaryService.UploadPictureAsync(destinationData, "avatar", "UsersImages", 192, 192);
user.AvatarImageUrl = avatarUrl;
}
if (model.EditUserGeneralInfoViewModel.Thumbnail is not null)
{
await using var ms = new MemoryStream();
await model.EditUserGeneralInfoViewModel.Thumbnail.CopyToAsync(ms);
var destinationData = ms.ToArray();
var thumbnailUrl = await this.cloudinaryService.UploadPictureAsync(destinationData, "thumbnail", "UsersImages", 1110, 350);
user.ThumbnailImageUrl = thumbnailUrl;
}
if (user?.FirstName != model.EditUserGeneralInfoViewModel.FirstName ||
user?.LastName != model.EditUserGeneralInfoViewModel.LastName)
{
await this.GenerateDefaultAvatar(model.EditUserGeneralInfoViewModel.FirstName, model.EditUserGeneralInfoViewModel.LastName);
await this.GenerateDefaultThumbnail(model.EditUserGeneralInfoViewModel.FirstName, model.EditUserGeneralInfoViewModel.LastName);
}
user.FirstName = model.EditUserGeneralInfoViewModel.FirstName;
user.MiddleName = model.EditUserGeneralInfoViewModel.MiddleName;
user.LastName = model.EditUserGeneralInfoViewModel.LastName;
user.About = model.EditUserGeneralInfoViewModel.About;
user.FacebookUrl = model.EditUserGeneralInfoViewModel.FacebookUrl;
user.InstagramUrl = model.EditUserGeneralInfoViewModel.InstagramUrl;
user.TikTokUrl = model.EditUserGeneralInfoViewModel.TikTokUrl;
user.TwitterUrl = model.EditUserGeneralInfoViewModel.TwitterUrl;
user.WebsiteUrl = model.EditUserGeneralInfoViewModel.WebsiteUrl;
user.TownId = model.EditUserGeneralInfoViewModel.TownId;
user.BirthDay = model.EditUserGeneralInfoViewModel.BirthDay;
user.Gender = model.EditUserGeneralInfoViewModel.Gender;
user.PhoneNumber = model.EditUserGeneralInfoViewModel.PhoneNumber;
this.applicationUserRepository.Update(user);
await this.applicationUserRepository.SaveChangesAsync();
}
public async Task<IEnumerable<T>> GetSuggestionPeople<T>(string userId, string openedUserId)
=> await this.applicationUserRepository
.All()
.Where(au => au.Town.Name == this.applicationUserRepository
.All()
.FirstOrDefault(au => au.Id == userId).Town.Name &&
au.Id != userId &&
au.Followings.All(f => f.FollowerId != userId) &&
au.Id != openedUserId)
.To<T>()
.ToListAsync();
public Tuple<int, int, int> GetCounts()
{
var registeredUsersCount = this.applicationUserRepository
.AllWithDeleted()
.Count();
var bannedUsersCount = this.applicationUserRepository
.All()
.Count(au => au.IsBanned);
var nonBannedUsers = this.applicationUserRepository
.All()
.Count(au => !au.IsBanned);
return new Tuple<int, int, int>(registeredUsersCount, bannedUsersCount, nonBannedUsers);
}
public async Task Ban(BanUserInputModel input, string userId)
{
var user = this.applicationUserRepository
.All()
.FirstOrDefault(au => au.Id == userId);
user.IsBanned = true;
user.BannedOn = DateTime.UtcNow;
user.BlockReason = input.BanReason;
this.applicationUserRepository.Update(user);
await this.applicationUserRepository.SaveChangesAsync();
}
public async Task Unban(string userId)
{
var user = this.applicationUserRepository
.All()
.FirstOrDefault(au => au.Id == userId);
user.IsBanned = false;
user.BannedOn = null;
user.BlockReason = null;
this.applicationUserRepository.Update(user);
await this.applicationUserRepository.SaveChangesAsync();
}
public string GetIdByUsername(string username)
=> this.applicationUserRepository
.All()
.FirstOrDefault(a => a.UserName.ToLower() == username.ToLower())
?.Id;
public bool IsEmailTaken(string email)
=> this.applicationUserRepository
.All()
.Any(au => au.Email == email);
private async Task<string> ProcessDefaultImage(string text, int width, int height, string fontName, int emSize, FontStyle fontStyle)
{
if (string.IsNullOrEmpty(text))
{
throw new ArgumentException($"'{nameof(text)}' cannot be null or empty.", nameof(text));
}
if (string.IsNullOrEmpty(fontName))
{
throw new ArgumentException($"'{nameof(fontName)}' cannot be null or empty.", nameof(fontName));
}
var backgroundColors = new List<string> { "3C79B2", "FF8F88", "6FB9FF", "C0CC44", "AFB28C" };
var backgroundColor = backgroundColors[new Random().Next(0, backgroundColors.Count - 1)];
var bmp = new Bitmap(width, height);
var sf = new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center };
var font = new Font(fontName, emSize, fontStyle, GraphicsUnit.Pixel);
var graphics = Graphics.FromImage(bmp);
graphics.Clear((Color)new ColorConverter().ConvertFromString("#" + backgroundColor));
graphics.SmoothingMode = SmoothingMode.AntiAlias;
graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
graphics.DrawString(text, font, new SolidBrush(Color.WhiteSmoke), new RectangleF(0, 0, width, height), sf);
graphics.Flush();
await using var ms = new MemoryStream();
bmp.Save(ms, ImageFormat.Jpeg);
var destinationData = ms.ToArray();
return await this.cloudinaryService.UploadPictureAsync(destinationData, "Avatar", "UsersImages", width, height);
}
}
| 38.155477 | 139 | 0.652528 | [
"MIT"
] | georgidelchev/AYN- | Services/AYN.Services.Data/Implementations/UsersService.cs | 10,800 | C# |
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
namespace AspNetCoreIdentity
{
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.Build();
}
}
| 23.346154 | 61 | 0.667216 | [
"MIT"
] | 4L4M1N/aspnet-core-identity | AspNetCoreIdentity/Program.cs | 607 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Ploeh.Samples.Dependency.Lifetime
{
public class XferProductRepository : ProductRepository
{
}
}
| 17.25 | 58 | 0.763285 | [
"MIT"
] | owolp/Telerik-Academy | Module-2/Design-Patterns/Materials/DI.NET/Lifetime/Lifetime/XferProductRepository.cs | 209 | C# |
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Advertisements;
public class AdManager : MonoBehaviour, IUnityAdsListener
{
[SerializeField] private bool testMode = true;
public static AdManager Instance;
private GameOverHandler gameOverHandler;
#if UNITY_ANDROID
private string gameId = "4294549";
#elif UNITY_IOS
private string gameId = "4294548";
#endif
private void Awake()
{
if (Instance != null && Instance != this)
{
Destroy(gameObject);
}
else
{
Instance = this;
DontDestroyOnLoad(gameObject);
Advertisement.AddListener(this);
Advertisement.Initialize(gameId,testMode);
}
}
public void ShowAd(GameOverHandler gameOverHandler)
{
this.gameOverHandler = gameOverHandler;
Advertisement.Show("rewardedVideo");
}
public void OnUnityAdsReady(string placementId)
{
Debug.Log("Unity Ads Ready " + placementId);
}
public void OnUnityAdsDidError(string message)
{
Debug.LogError("Unity Ads Error " + message);
}
public void OnUnityAdsDidStart(string placementId)
{
Debug.Log("Unity Ads Started " + placementId);
}
public void OnUnityAdsDidFinish(string placementId, ShowResult showResult)
{
switch (showResult)
{
case ShowResult.Finished:
gameOverHandler.ContinueGame();
break;
case ShowResult.Skipped:
Debug.LogWarning("Ad Skipped");
break;
case ShowResult.Failed:
Debug.LogWarning("Ad Failed");
break;
}
}
}
| 26.102941 | 78 | 0.610704 | [
"MIT"
] | OmerKilicc/Asteroid-Avoider | Assets/Scripts/AdManager.cs | 1,775 | C# |
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
using System.Collections.Generic;
public class RewindTestTarget : TargetRules
{
public RewindTestTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Game;
ExtraModuleNames.Add("RewindTest");
}
}
| 21.214286 | 60 | 0.767677 | [
"Apache-2.0"
] | ultratroll/RewindTime | RewindTest/Source/RewindTest.Target.cs | 297 | C# |
namespace CinemaWorld.Data.Models.Enumerations
{
using System.ComponentModel.DataAnnotations;
public enum Resolution
{
Unknown = 0,
HD = 1,
SD = 2,
[Display(Name = "4K")]
FourK = 3,
}
}
| 17.428571 | 48 | 0.553279 | [
"MIT"
] | stanislavstoyanov99/CinemaWorld | src/Data/CinemaWorld.Data.Models/Enumerations/Resolution.cs | 246 | C# |
namespace KSoft.Blam.Blob.Transport
{
partial class BlobTransportStream
{
struct StreamHeader
: IO.IEndianStreamSerializable
{
const int kVersion = 1;
const int kFlags = BlobChunkHeader.kFlagIsHeader;
internal const int kSizeOfData = sizeof(short) + (TypeExtensionsBlam.kTagStringLength+1) +
sizeof(short); // padding
internal static readonly Values.GroupTagData32 kSignature =
new Values.GroupTagData32("_blf", "blob_header");
static readonly BlobChunkHeader kChunkSignature =
new BlobChunkHeader(kSignature, kVersion, kSizeOfData, kFlags);
const short kEndianSignature = -2;
BlobChunkHeader Header;
short EndianSignature;
public string FileType;
public StreamHeader(string fileType)
{
Header = kChunkSignature;
EndianSignature = kEndianSignature;
FileType = fileType;
}
#region Verify
BlobChunkVerificationResultInfo VerifyEndian(out bool requiresByteswap)
{
requiresByteswap = false;
var result = BlobChunkVerificationResultInfo.ValidResult;
if (EndianSignature != kEndianSignature)
{
requiresByteswap = Bitwise.ByteSwap.SwapInt16(EndianSignature) == kEndianSignature;
if (!requiresByteswap) // the signature didn't match, even after byte swapping it
result = new BlobChunkVerificationResultInfo(BlobChunkVerificationResult.InvalidEndian,
BlobChunkVerificationResultContext.Header, EndianSignature);
}
return result;
}
public BlobChunkVerificationResultInfo Verify(out bool requiresByteswap)
{
var result = VerifyEndian(out requiresByteswap);
return result .And(Header, c => c.VerifySignature(kChunkSignature.Signature))
.And(Header, c => c.VerifyVersion(kChunkSignature.Version))
.And(Header, c => c.VerifyDataSize(kSizeOfData));
}
#endregion
internal void ByteSwap()
{
Header.ByteSwap();
Bitwise.ByteSwap.Swap(ref EndianSignature);
}
#region IEndianStreamSerializable Members
public void Serialize(IO.EndianStream s)
{
s.Stream(ref Header);
s.Stream(ref EndianSignature);
s.Stream(ref FileType, TypeExtensionsBlam.kTagStringEncoding);
s.Pad16();
}
#endregion
};
};
} | 30.293333 | 94 | 0.707746 | [
"MIT"
] | KornnerStudios/KSoft.Blam | KSoft.Blam/Blob/Transport/BlobTransportStreamHeader.cs | 2,274 | C# |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System.ComponentModel;
namespace WebApp.Config
{
public enum RenderManagerType
{
[Description("Deadline 10")]
Deadline = 0,
[Description("Qube 6.10")]
Qube610 = 1,
[Description("Qube 7.0")]
Qube70 = 2,
[Description("Tractor 2")]
Tractor2 = 3,
[Description("OpenCue")]
OpenCue = 4,
[Description("Bring Your Own Scheduler")]
BYOS = 5,
}
}
| 19.137931 | 61 | 0.571171 | [
"MIT"
] | Azure/azure-render-farm-manager | src/AzureRenderHub/AzureRenderHub.WebApp/Config/RenderManagerType.cs | 557 | C# |
using System;
using System.Collections.Generic;
using Xunit;
using Moq;
using SpatialLite.Core;
using SpatialLite.Core.Geometries;
using SpatialLite.Osm.Geometries;
using SpatialLite.Osm;
namespace Tests.SpatialLite.Osm.Geometries {
public class WayTests {
List<Node> _nodes = new List<Node>(new Node[] {
new Node(1, 1.1, 2.2),
new Node(2, 10.1, -20.2),
new Node(3, -30.1, 40.2) });
WayInfo _wayEmptyInfo = new WayInfo(10, new TagsCollection(), new List<long>(), new EntityMetadata());
WayInfo _wayInfo = new WayInfo(10, new TagsCollection(), new long[] { 1, 2, 3 }, new EntityMetadata());
IEntityCollection<IOsmGeometry> _nodesEntityCollection;
public WayTests() {
Mock<IEntityCollection<IOsmGeometry>> _nodesCollectionM = new Mock<IEntityCollection<IOsmGeometry>>();
_nodesCollectionM.SetupGet(c => c[1, EntityType.Node]).Returns(_nodes[0]);
_nodesCollectionM.SetupGet(c => c[2, EntityType.Node]).Returns(_nodes[1]);
_nodesCollectionM.SetupGet(c => c[3, EntityType.Node]).Returns(_nodes[2]);
_nodesEntityCollection = _nodesCollectionM.Object;
}
[Fact]
public void Constructor_ID_CreatesNewEmptyWayAndInitializesProperties() {
int id = 11;
Way target = new Way(id);
Assert.Equal(id, target.ID);
Assert.Empty(target.Nodes);
Assert.Empty(target.Tags);
Assert.Null(target.Metadata);
}
[Fact]
public void Constructor_ID_Nodes_CreatesWayAddsNodesAndInitializesProperties() {
int id = 11;
Way target = new Way(id, _nodes);
Assert.Equal(id, target.ID);
Assert.Equal(_nodes.Count, target.Nodes.Count);
for (int i = 0; i < _nodes.Count; i++) {
Assert.Same(_nodes[i], target.Nodes[i]);
}
Assert.Empty(target.Tags);
Assert.Null(target.Metadata);
}
[Fact]
public void Constructor_ID_Nodes_Tags_CreatesWayAddsNodesAndInitializesProperties() {
int id = 11;
TagsCollection tags = new TagsCollection();
Way target = new Way(id, _nodes, tags);
Assert.Equal(id, target.ID);
Assert.Equal(_nodes.Count, target.Nodes.Count);
for (int i = 0; i < _nodes.Count; i++) {
Assert.Same(_nodes[i], target.Nodes[i]);
}
Assert.Same(tags, target.Tags);
Assert.Null(target.Metadata);
}
[Fact]
public void FromWayInfo_SetsProperties() {
Way target = Way.FromWayInfo(_wayEmptyInfo, _nodesEntityCollection, true);
Assert.Equal(_wayEmptyInfo.ID, target.ID);
Assert.Same(_wayEmptyInfo.Tags, target.Tags);
Assert.Same(_wayEmptyInfo.Metadata, target.Metadata);
Assert.Empty(target.Nodes);
}
[Fact]
public void FromWayInfo_SetsNodes() {
Way target = Way.FromWayInfo(_wayInfo, _nodesEntityCollection, true);
Assert.Equal(_wayInfo.Nodes.Count, target.Nodes.Count);
for (int i = 0; i < _wayInfo.Nodes.Count; i++) {
Assert.Equal(_wayInfo.Nodes[i], target.Nodes[i].ID);
}
}
[Fact]
public void FromWayInfo_ThrowsArgumentExceptionIfReferencedNodeIsNotInCollectionAndMissingNodesAsErrorsIsTrue() {
_wayInfo.Nodes[0] = 10000;
Assert.Throws<ArgumentException>(() => Way.FromWayInfo(_wayInfo, _nodesEntityCollection, true));
}
[Fact]
public void FromWayInfo_ReturnsNullIfReferencedNodeIsNotInCollectionAndMissingNodesAsErrorsIsFalse() {
_wayInfo.Nodes[0] = 10000;
Assert.Null(Way.FromWayInfo(_wayInfo, _nodesEntityCollection, false));
}
[Fact]
public void WhenWayIsInitializedFromWayInfo_CoordinatesReturnsNodesCoordinates() {
Way target = Way.FromWayInfo(_wayInfo, _nodesEntityCollection, true);
Assert.Equal(_wayInfo.Nodes.Count, target.Nodes.Count);
Assert.Equal(_nodes[0].Position, target.Coordinates[0]);
Assert.Equal(_nodes[0].Position, target.Coordinates[0]);
Assert.Equal(_nodes[0].Position, target.Coordinates[0]);
}
[Fact]
public void Coordinates_GetsPositionOfNodes() {
int id = 11;
Way target = new Way(id, _nodes);
Assert.Equal(_nodes.Count, target.Coordinates.Count);
for (int i = 0; i < _nodes.Count; i++) {
Assert.Equal(_nodes[i].Position, target.Coordinates[i]);
}
}
[Fact]
public void Coordinates_GetsPositionOfNodesIfWayCastedToLineString() {
int id = 11;
Way way = new Way(id, _nodes);
LineString target = (LineString)way;
Assert.Equal(_nodes.Count, target.Coordinates.Count);
for (int i = 0; i < _nodes.Count; i++) {
Assert.Equal(_nodes[i].Position, target.Coordinates[i]);
}
}
[Fact]
public void EntityType_Returns_Way() {
Way target = new Way(10);
Assert.Equal(EntityType.Way, target.EntityType);
}
}
}
| 35.618421 | 122 | 0.591799 | [
"MIT"
] | lukaskabrt/SpatialLITE | src/Tests.SpatialLite.Osm/Geometries/WayTests.cs | 5,416 | C# |
/*
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License. See License.txt in the project root for license information.
*/
namespace Site.Areas.KnowledgeBase.ViewModels
{
public class RelatedArticle
{
public RelatedArticle(string title, string url)
{
Title = title;
Url = url;
}
public string Title { get; private set; }
public string Url { get; private set; }
}
}
| 19.363636 | 94 | 0.711268 | [
"MIT"
] | Adoxio/xRM-Portals-Community-Edition | Samples/MasterPortal/Areas/KnowledgeBase/ViewModels/RelatedArticle.cs | 426 | C# |
// --------------------------------------------------------------------------------------------------------------------
// <auto-generated>
// Generated using OBeautifulCode.CodeGen.ModelObject (1.0.0.0)
// </auto-generated>
// --------------------------------------------------------------------------------------------------------------------
namespace OBeautifulCode.CodeGen.ModelObject.Test.Test
{
using global::System;
using global::System.CodeDom.Compiler;
using global::System.Collections.Concurrent;
using global::System.Collections.Generic;
using global::System.Collections.ObjectModel;
using global::System.Diagnostics.CodeAnalysis;
using global::System.Globalization;
using global::System.Linq;
using global::System.Reflection;
using global::FakeItEasy;
using global::OBeautifulCode.Assertion.Recipes;
using global::OBeautifulCode.AutoFakeItEasy;
using global::OBeautifulCode.CodeGen.ModelObject.Recipes;
using global::OBeautifulCode.Equality.Recipes;
using global::OBeautifulCode.Math.Recipes;
using global::OBeautifulCode.Reflection.Recipes;
using global::OBeautifulCode.Representation.System;
using global::OBeautifulCode.Serialization;
using global::OBeautifulCode.Serialization.Recipes;
using global::OBeautifulCode.Type;
using global::Xunit;
using static global::System.FormattableString;
public static partial class ModelComparingPublicSetNoneChild1Test
{
private static readonly ComparableTestScenarios<ModelComparingPublicSetNoneChild1> ComparableTestScenarios = new ComparableTestScenarios<ModelComparingPublicSetNoneChild1>();
[SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
[SuppressMessage("Microsoft.Naming", "CA1724:TypeNamesShouldNotMatchNamespaces")]
public static class Structural
{
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void ModelComparingPublicSetNoneChild1___Should_implement_IComparableForRelativeSortOrder_of_ModelComparingPublicSetNoneChild1___When_reflecting()
{
// Arrange
var type = typeof(ModelComparingPublicSetNoneChild1);
var expectedModelMethods = typeof(IComparableForRelativeSortOrder<ModelComparingPublicSetNoneChild1>).GetInterfaceDeclaredAndImplementedMethods();
var expectedModelMethodHashes = expectedModelMethods.Select(_ => _.GetSignatureHash());
// Act
var actualInterfaces = type.GetInterfaces();
var actualModelMethods = type.GetMethodsFiltered(MemberRelationships.DeclaredOrInherited, MemberOwners.Instance, MemberAccessModifiers.Public).ToList();
var actualModelMethodHashes = actualModelMethods.Select(_ => _.GetSignatureHash());
// Assert
actualInterfaces.AsTest().Must().ContainElement(typeof(IComparableForRelativeSortOrder<ModelComparingPublicSetNoneChild1>));
expectedModelMethodHashes.Except(actualModelMethodHashes).AsTest().Must().BeEmptyEnumerable();
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void ModelComparingPublicSetNoneChild1___Should_be_attributed_with_Serializable____When_reflecting()
{
// Arrange
var type = typeof(ModelComparingPublicSetNoneChild1);
// Act
var actualAttributes = type.GetCustomAttributes(typeof(SerializableAttribute), false);
// Assert
actualAttributes.AsTest().Must().NotBeEmptyEnumerable();
}
}
[SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")]
[SuppressMessage("Microsoft.Naming", "CA1724:TypeNamesShouldNotMatchNamespaces")]
public static class Comparability
{
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void LessThanOperator___Should_return_false___When_both_sides_of_operator_are_null()
{
// Arrange
ModelComparingPublicSetNoneChild1 systemUnderTest1 = null;
ModelComparingPublicSetNoneChild1 systemUnderTest2 = null;
// Act
var actual = systemUnderTest1 < systemUnderTest2;
// Assert
actual.AsTest().Must().BeFalse();
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void LessThanOperator___Should_return_true___When_parameter_left_is_null_and_parameter_right_is_not_null()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actual = null < scenario.ReferenceObject;
// Assert
actual.AsTest().Must().BeTrue(because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void LessThanOperator___Should_return_false___When_parameter_right_is_null_and_parameter_left_is_not_null()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actual = scenario.ReferenceObject < null;
// Assert
actual.AsTest().Must().BeFalse(because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void LessThanOperator___Should_return_false___When_same_object_is_on_both_sides_of_operator()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
#pragma warning disable CS1718 // Comparison made to same variable
var actual = scenario.ReferenceObject < scenario.ReferenceObject;
#pragma warning restore CS1718 // Comparison made to same variable
// Assert
actual.AsTest().Must().BeFalse(because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void LessThanOperator___Should_return_false___When_parameter_left_and_right_are_equal_but_not_the_same_object()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actuals1 = scenario.ObjectsThatAreEqualToButNotTheSameAsReferenceObject.Select(_ => _ < scenario.ReferenceObject).ToList();
var actuals2 = scenario.ObjectsThatAreEqualToButNotTheSameAsReferenceObject.Select(_ => scenario.ReferenceObject < _ ).ToList();
// Assert
actuals1.AsTest().Must().Each().BeFalse(because: scenario.Id);
actuals2.AsTest().Must().Each().BeFalse(because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void LessThanOperator___Should_return_true___When_parameter_left_is_less_than_parameter_right()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actuals1 = scenario.ObjectsThatAreLessThanReferenceObject.Select(_ => _ < scenario.ReferenceObject).ToList();
var actuals2 = scenario.ObjectsThatAreGreaterThanReferenceObject.Select(_ => scenario.ReferenceObject < _ ).ToList();
// Assert
actuals1.AsTest().Must().Each().BeTrue(because: scenario.Id);
actuals2.AsTest().Must().Each().BeTrue(because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void LessThanOperator___Should_return_false___When_parameter_left_is_greater_than_parameter_right()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actuals1 = scenario.ObjectsThatAreGreaterThanReferenceObject.Select(_ => _ < scenario.ReferenceObject).ToList();
var actuals2 = scenario.ObjectsThatAreLessThanReferenceObject.Select(_ => scenario.ReferenceObject < _ ).ToList();
// Assert
actuals1.AsTest().Must().Each().BeFalse(because: scenario.Id);
actuals2.AsTest().Must().Each().BeFalse(because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void LessThanOperator___Should_throw_ArgumentException___When_objects_being_compared_are_of_different_types()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actuals1 = scenario.ObjectsThatDeriveFromScenarioTypeButAreNotOfTheSameTypeAsReferenceObject.Select(_ => Record.Exception(() => _ < scenario.ReferenceObject)).ToList();
var actuals2 = scenario.ObjectsThatDeriveFromScenarioTypeButAreNotOfTheSameTypeAsReferenceObject.Select(_ => Record.Exception(() => scenario.ReferenceObject < _ )).ToList();
// Assert
actuals1.AsTest().Must().Each().BeOfType<ArgumentException>(because: scenario.Id);
actuals1.Select(_ => _.Message).AsTest().Must().Each().StartWith("Attempting to compare objects of different types.");
actuals2.AsTest().Must().Each().BeOfType<ArgumentException>(because: scenario.Id);
actuals2.Select(_ => _.Message).AsTest().Must().Each().StartWith("Attempting to compare objects of different types.");
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void GreaterThanOperator___Should_return_false___When_both_sides_of_operator_are_null()
{
// Arrange
ModelComparingPublicSetNoneChild1 systemUnderTest1 = null;
ModelComparingPublicSetNoneChild1 systemUnderTest2 = null;
// Act
var actual = systemUnderTest1 > systemUnderTest2;
// Assert
actual.AsTest().Must().BeFalse();
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void GreaterThanOperator___Should_return_false___When_parameter_left_is_null_and_parameter_right_is_not_null()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actual = null > scenario.ReferenceObject;
// Assert
actual.AsTest().Must().BeFalse(because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void GreaterThanOperator___Should_return_true___When_parameter_right_is_null_and_parameter_left_is_not_null()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actual = scenario.ReferenceObject > null;
// Assert
actual.AsTest().Must().BeTrue(because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void GreaterThanOperator___Should_return_false___When_same_object_is_on_both_sides_of_operator()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
#pragma warning disable CS1718 // Comparison made to same variable
var actual = scenario.ReferenceObject > scenario.ReferenceObject;
#pragma warning restore CS1718 // Comparison made to same variable
// Assert
actual.AsTest().Must().BeFalse(because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void GreaterThanOperator___Should_return_false___When_parameter_left_and_right_are_equal_but_not_the_same_object()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actuals1 = scenario.ObjectsThatAreEqualToButNotTheSameAsReferenceObject.Select(_ => _ > scenario.ReferenceObject).ToList();
var actuals2 = scenario.ObjectsThatAreEqualToButNotTheSameAsReferenceObject.Select(_ => scenario.ReferenceObject > _ ).ToList();
// Assert
actuals1.AsTest().Must().Each().BeFalse(because: scenario.Id);
actuals2.AsTest().Must().Each().BeFalse(because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void GreaterThanOperator___Should_return_false___When_parameter_left_is_less_than_parameter_right()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actuals1 = scenario.ObjectsThatAreLessThanReferenceObject.Select(_ => _ > scenario.ReferenceObject).ToList();
var actuals2 = scenario.ObjectsThatAreGreaterThanReferenceObject.Select(_ => scenario.ReferenceObject > _ ).ToList();
// Assert
actuals1.AsTest().Must().Each().BeFalse(because: scenario.Id);
actuals2.AsTest().Must().Each().BeFalse(because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void GreaterThanOperator___Should_return_true___When_parameter_left_is_greater_than_parameter_right()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actuals1 = scenario.ObjectsThatAreGreaterThanReferenceObject.Select(_ => _ > scenario.ReferenceObject).ToList();
var actuals2 = scenario.ObjectsThatAreLessThanReferenceObject.Select(_ => scenario.ReferenceObject > _ ).ToList();
// Assert
actuals1.AsTest().Must().Each().BeTrue(because: scenario.Id);
actuals2.AsTest().Must().Each().BeTrue(because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void GreaterThanOperator___Should_throw_ArgumentException___When_objects_being_compared_are_of_different_types()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actuals1 = scenario.ObjectsThatDeriveFromScenarioTypeButAreNotOfTheSameTypeAsReferenceObject.Select(_ => Record.Exception(() => _ > scenario.ReferenceObject)).ToList();
var actuals2 = scenario.ObjectsThatDeriveFromScenarioTypeButAreNotOfTheSameTypeAsReferenceObject.Select(_ => Record.Exception(() => scenario.ReferenceObject > _ )).ToList();
// Assert
actuals1.AsTest().Must().Each().BeOfType<ArgumentException>(because: scenario.Id);
actuals1.Select(_ => _.Message).AsTest().Must().Each().StartWith("Attempting to compare objects of different types.");
actuals2.AsTest().Must().Each().BeOfType<ArgumentException>(because: scenario.Id);
actuals2.Select(_ => _.Message).AsTest().Must().Each().StartWith("Attempting to compare objects of different types.");
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void LessThanOrEqualToOperator___Should_return_true___When_both_sides_of_operator_are_null()
{
// Arrange
ModelComparingPublicSetNoneChild1 systemUnderTest1 = null;
ModelComparingPublicSetNoneChild1 systemUnderTest2 = null;
// Act
var actual = systemUnderTest1 <= systemUnderTest2;
// Assert
actual.AsTest().Must().BeTrue();
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void LessThanOrEqualToOperator___Should_return_true___When_parameter_left_is_null_and_parameter_right_is_not_null()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actual = null <= scenario.ReferenceObject;
// Assert
actual.AsTest().Must().BeTrue(because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void LessThanOrEqualToOperator___Should_return_false___When_parameter_right_is_null_and_parameter_left_is_not_null()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actual = scenario.ReferenceObject <= null;
// Assert
actual.AsTest().Must().BeFalse(because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void LessThanOrEqualToOperator___Should_return_true___When_same_object_is_on_both_sides_of_operator()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
#pragma warning disable CS1718 // Comparison made to same variable
var actual = scenario.ReferenceObject <= scenario.ReferenceObject;
#pragma warning restore CS1718 // Comparison made to same variable
// Assert
actual.AsTest().Must().BeTrue(because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void LessThanOrEqualToOperator___Should_return_true___When_parameter_left_and_right_are_equal_but_not_the_same_object()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actuals1 = scenario.ObjectsThatAreEqualToButNotTheSameAsReferenceObject.Select(_ => _ <= scenario.ReferenceObject).ToList();
var actuals2 = scenario.ObjectsThatAreEqualToButNotTheSameAsReferenceObject.Select(_ => scenario.ReferenceObject <= _ ).ToList();
// Assert
actuals1.AsTest().Must().Each().BeTrue(because: scenario.Id);
actuals2.AsTest().Must().Each().BeTrue(because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void LessThanOrEqualToOperator___Should_return_true___When_parameter_left_is_less_than_parameter_right()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actuals1 = scenario.ObjectsThatAreLessThanReferenceObject.Select(_ => _ <= scenario.ReferenceObject).ToList();
var actuals2 = scenario.ObjectsThatAreGreaterThanReferenceObject.Select(_ => scenario.ReferenceObject <= _ ).ToList();
// Assert
actuals1.AsTest().Must().Each().BeTrue(because: scenario.Id);
actuals2.AsTest().Must().Each().BeTrue(because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void LessThanOrEqualToOperator___Should_return_false___When_parameter_left_is_greater_than_parameter_right()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actuals1 = scenario.ObjectsThatAreGreaterThanReferenceObject.Select(_ => _ <= scenario.ReferenceObject).ToList();
var actuals2 = scenario.ObjectsThatAreLessThanReferenceObject.Select(_ => scenario.ReferenceObject <= _ ).ToList();
// Assert
actuals1.AsTest().Must().Each().BeFalse(because: scenario.Id);
actuals2.AsTest().Must().Each().BeFalse(because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void LessThanOrEqualToOperator___Should_throw_ArgumentException___When_objects_being_compared_are_of_different_types()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actuals1 = scenario.ObjectsThatDeriveFromScenarioTypeButAreNotOfTheSameTypeAsReferenceObject.Select(_ => Record.Exception(() => _ <= scenario.ReferenceObject)).ToList();
var actuals2 = scenario.ObjectsThatDeriveFromScenarioTypeButAreNotOfTheSameTypeAsReferenceObject.Select(_ => Record.Exception(() => scenario.ReferenceObject <= _ )).ToList();
// Assert
actuals1.AsTest().Must().Each().BeOfType<ArgumentException>(because: scenario.Id);
actuals1.Select(_ => _.Message).AsTest().Must().Each().StartWith("Attempting to compare objects of different types.");
actuals2.AsTest().Must().Each().BeOfType<ArgumentException>(because: scenario.Id);
actuals2.Select(_ => _.Message).AsTest().Must().Each().StartWith("Attempting to compare objects of different types.");
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void GreaterThanOrEqualToOperator___Should_return_true___When_both_sides_of_operator_are_null()
{
// Arrange
ModelComparingPublicSetNoneChild1 systemUnderTest1 = null;
ModelComparingPublicSetNoneChild1 systemUnderTest2 = null;
// Act
var actual = systemUnderTest1 >= systemUnderTest2;
// Assert
actual.AsTest().Must().BeTrue();
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void GreaterThanOrEqualToOperator___Should_return_false___When_parameter_left_is_null_and_parameter_right_is_not_null()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actual = null >= scenario.ReferenceObject;
// Assert
actual.AsTest().Must().BeFalse(because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void GreaterThanOrEqualToOperator___Should_return_true___When_parameter_right_is_null_and_parameter_left_is_not_null()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actual = scenario.ReferenceObject >= null;
// Assert
actual.AsTest().Must().BeTrue(because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void GreaterThanOrEqualToOperator___Should_return_true___When_same_object_is_on_both_sides_of_operator()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
#pragma warning disable CS1718 // Comparison made to same variable
var actual = scenario.ReferenceObject >= scenario.ReferenceObject;
#pragma warning restore CS1718 // Comparison made to same variable
// Assert
actual.AsTest().Must().BeTrue(because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void GreaterThanOrEqualToOperator___Should_return_true___When_parameter_left_and_right_are_equal_but_not_the_same_object()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actuals1 = scenario.ObjectsThatAreEqualToButNotTheSameAsReferenceObject.Select(_ => _ >= scenario.ReferenceObject).ToList();
var actuals2 = scenario.ObjectsThatAreEqualToButNotTheSameAsReferenceObject.Select(_ => scenario.ReferenceObject >= _ ).ToList();
// Assert
actuals1.AsTest().Must().Each().BeTrue(because: scenario.Id);
actuals2.AsTest().Must().Each().BeTrue(because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void GreaterThanOrEqualToOperator___Should_return_false___When_parameter_left_is_less_than_parameter_right()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actuals1 = scenario.ObjectsThatAreLessThanReferenceObject.Select(_ => _ >= scenario.ReferenceObject).ToList();
var actuals2 = scenario.ObjectsThatAreGreaterThanReferenceObject.Select(_ => scenario.ReferenceObject >= _ ).ToList();
// Assert
actuals1.AsTest().Must().Each().BeFalse(because: scenario.Id);
actuals2.AsTest().Must().Each().BeFalse(because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void GreaterThanOrEqualToOperator___Should_return_true___When_parameter_left_is_greater_than_parameter_right()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actuals1 = scenario.ObjectsThatAreGreaterThanReferenceObject.Select(_ => _ >= scenario.ReferenceObject).ToList();
var actuals2 = scenario.ObjectsThatAreLessThanReferenceObject.Select(_ => scenario.ReferenceObject >= _ ).ToList();
// Assert
actuals1.AsTest().Must().Each().BeTrue(because: scenario.Id);
actuals2.AsTest().Must().Each().BeTrue(because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void GreaterThanOrEqualToOperator___Should_throw_ArgumentException___When_objects_being_compared_are_of_different_types()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actuals1 = scenario.ObjectsThatDeriveFromScenarioTypeButAreNotOfTheSameTypeAsReferenceObject.Select(_ => Record.Exception(() => _ >= scenario.ReferenceObject)).ToList();
var actuals2 = scenario.ObjectsThatDeriveFromScenarioTypeButAreNotOfTheSameTypeAsReferenceObject.Select(_ => Record.Exception(() => scenario.ReferenceObject >= _ )).ToList();
// Assert
actuals1.AsTest().Must().Each().BeOfType<ArgumentException>(because: scenario.Id);
actuals1.Select(_ => _.Message).AsTest().Must().Each().StartWith("Attempting to compare objects of different types.");
actuals2.AsTest().Must().Each().BeOfType<ArgumentException>(because: scenario.Id);
actuals2.Select(_ => _.Message).AsTest().Must().Each().StartWith("Attempting to compare objects of different types.");
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void CompareTo_with_ModelComparingPublicSetNoneParent___Should_return_1___When_parameter_other_is_null()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach (var scenario in scenarios)
{
// Arrange
ModelComparingPublicSetNoneParent other = null;
// Act
var actual = scenario.ReferenceObject.CompareTo((ModelComparingPublicSetNoneParent)other);
// Assert
actual.AsTest().Must().BeEqualTo(1, because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void CompareTo_with_ModelComparingPublicSetNoneParent___Should_return_0___When_parameter_other_is_same_object()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actual = scenario.ReferenceObject.CompareTo((ModelComparingPublicSetNoneParent)scenario.ReferenceObject);
// Assert
actual.AsTest().Must().BeEqualTo(0, because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void CompareTo_with_ModelComparingPublicSetNoneParent___Should_return_0___When_objects_being_compared_are_equal()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actuals = scenario.ObjectsThatAreEqualToButNotTheSameAsReferenceObject.Select(_ => scenario.ReferenceObject.CompareTo((ModelComparingPublicSetNoneParent)_)).ToList();
// Assert
actuals.AsTest().Must().Each().BeEqualTo(0, because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void CompareTo_with_ModelComparingPublicSetNoneParent___Should_return_negative_1___When_object_is_less_than_parameter_other()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actuals1 = scenario.ObjectsThatAreLessThanReferenceObject.Select(_ => _.CompareTo((ModelComparingPublicSetNoneParent)scenario.ReferenceObject)).ToList();
var actuals2 = scenario.ObjectsThatAreGreaterThanReferenceObject.Select(_ => scenario.ReferenceObject.CompareTo((ModelComparingPublicSetNoneParent)_)).ToList();
// Assert
actuals1.AsTest().Must().Each().BeEqualTo(-1, because: scenario.Id);
actuals2.AsTest().Must().Each().BeEqualTo(-1, because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void CompareTo_with_ModelComparingPublicSetNoneParent___Should_return_1___When_object_is_greater_than_parameter_other()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actuals1 = scenario.ObjectsThatAreGreaterThanReferenceObject.Select(_ => _.CompareTo((ModelComparingPublicSetNoneParent)scenario.ReferenceObject)).ToList();
var actuals2 = scenario.ObjectsThatAreLessThanReferenceObject.Select(_ => scenario.ReferenceObject.CompareTo((ModelComparingPublicSetNoneParent)_)).ToList();
// Assert
actuals1.AsTest().Must().Each().BeEqualTo(1, because: scenario.Id);
actuals2.AsTest().Must().Each().BeEqualTo(1, because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void CompareTo_with_ModelComparingPublicSetNoneParent___Should_throw_ArgumentException___When_objects_being_compared_are_of_different_types()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actuals = scenario.ObjectsThatDeriveFromScenarioTypeButAreNotOfTheSameTypeAsReferenceObject.Select(_ => Record.Exception(() => scenario.ReferenceObject.CompareTo((ModelComparingPublicSetNoneParent)_))).ToList();
// Assert
actuals.AsTest().Must().Each().BeOfType<ArgumentException>(because: scenario.Id);
actuals.Select(_ => _.Message).AsTest().Must().Each().StartWith("Attempting to compare objects of different types.");
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void CompareTo_with_ModelComparingPublicSetNoneChild1___Should_return_1___When_parameter_other_is_null()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach (var scenario in scenarios)
{
// Arrange
ModelComparingPublicSetNoneChild1 other = null;
// Act
var actual = scenario.ReferenceObject.CompareTo(other);
// Assert
actual.AsTest().Must().BeEqualTo(1, because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void CompareTo_with_ModelComparingPublicSetNoneChild1___Should_return_0___When_parameter_other_is_same_object()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actual = scenario.ReferenceObject.CompareTo(scenario.ReferenceObject);
// Assert
actual.AsTest().Must().BeEqualTo(0, because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void CompareTo_with_ModelComparingPublicSetNoneChild1___Should_return_0___When_objects_being_compared_are_equal()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actuals = scenario.ObjectsThatAreEqualToButNotTheSameAsReferenceObject.Select(_ => scenario.ReferenceObject.CompareTo(_)).ToList();
// Assert
actuals.AsTest().Must().Each().BeEqualTo(0, because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void CompareTo_with_ModelComparingPublicSetNoneChild1___Should_return_negative_1___When_object_is_less_than_parameter_other()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actuals1 = scenario.ObjectsThatAreLessThanReferenceObject.Select(_ => _.CompareTo(scenario.ReferenceObject)).ToList();
var actuals2 = scenario.ObjectsThatAreGreaterThanReferenceObject.Select(_ => scenario.ReferenceObject.CompareTo(_)).ToList();
// Assert
actuals1.AsTest().Must().Each().BeEqualTo(-1, because: scenario.Id);
actuals2.AsTest().Must().Each().BeEqualTo(-1, because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void CompareTo_with_ModelComparingPublicSetNoneChild1___Should_return_1___When_object_is_greater_than_parameter_other()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actuals1 = scenario.ObjectsThatAreGreaterThanReferenceObject.Select(_ => _.CompareTo(scenario.ReferenceObject)).ToList();
var actuals2 = scenario.ObjectsThatAreLessThanReferenceObject.Select(_ => scenario.ReferenceObject.CompareTo(_)).ToList();
// Assert
actuals1.AsTest().Must().Each().BeEqualTo(1, because: scenario.Id);
actuals2.AsTest().Must().Each().BeEqualTo(1, because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void CompareTo_with_ModelComparingPublicSetNoneChild1___Should_throw_ArgumentException___When_objects_being_compared_are_of_different_types()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actuals = scenario.ObjectsThatDeriveFromScenarioTypeButAreNotOfTheSameTypeAsReferenceObject.Select(_ => Record.Exception(() => scenario.ReferenceObject.CompareTo(_))).ToList();
// Assert
actuals.AsTest().Must().Each().BeOfType<ArgumentException>(because: scenario.Id);
actuals.Select(_ => _.Message).AsTest().Must().Each().StartWith("Attempting to compare objects of different types.");
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void CompareTo_with_Object___Should_return_1___When_parameter_obj_is_null()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach (var scenario in scenarios)
{
// Arrange, Act
var actual = scenario.ReferenceObject.CompareTo((object)null);
// Assert
actual.AsTest().Must().BeEqualTo(1, because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void CompareTo_with_Object___Should_return_0___When_parameter_obj_is_same_object()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actual = scenario.ReferenceObject.CompareTo((object)scenario.ReferenceObject);
// Assert
actual.AsTest().Must().BeEqualTo(0, because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void CompareTo_with_Object___Should_return_0___When_objects_being_compared_are_equal()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actuals = scenario.ObjectsThatAreEqualToButNotTheSameAsReferenceObject.Select(_ => scenario.ReferenceObject.CompareTo((object)_)).ToList();
// Assert
actuals.AsTest().Must().Each().BeEqualTo(0, because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void CompareTo_with_Object___Should_return_negative_1___When_object_is_less_than_parameter_obj()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actuals1 = scenario.ObjectsThatAreLessThanReferenceObject.Select(_ => _.CompareTo((object)scenario.ReferenceObject)).ToList();
var actuals2 = scenario.ObjectsThatAreGreaterThanReferenceObject.Select(_ => scenario.ReferenceObject.CompareTo((object)_)).ToList();
// Assert
actuals1.AsTest().Must().Each().BeEqualTo(-1, because: scenario.Id);
actuals2.AsTest().Must().Each().BeEqualTo(-1, because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void CompareTo_with_Object___Should_return_1___When_object_is_greater_than_parameter_obj()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actuals1 = scenario.ObjectsThatAreGreaterThanReferenceObject.Select(_ => _.CompareTo((object)scenario.ReferenceObject)).ToList();
var actuals2 = scenario.ObjectsThatAreLessThanReferenceObject.Select(_ => scenario.ReferenceObject.CompareTo((object)_)).ToList();
// Assert
actuals1.AsTest().Must().Each().BeEqualTo(1, because: scenario.Id);
actuals2.AsTest().Must().Each().BeEqualTo(1, because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void CompareTo_with_Object___Should_throw_ArgumentException___When_objects_being_compared_are_of_different_types()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actuals1 = scenario.ObjectsThatDeriveFromScenarioTypeButAreNotOfTheSameTypeAsReferenceObject.Select(_ => Record.Exception(() => scenario.ReferenceObject.CompareTo((object)_))).ToList();
var actuals2 = scenario.ObjectsThatAreNotOfTheSameTypeAsReferenceObject.Select(_ => Record.Exception(() => scenario.ReferenceObject.CompareTo((object)_))).ToList();
// Assert
actuals1.AsTest().Must().Each().BeOfType<ArgumentException>(because: scenario.Id);
actuals1.Select(_ => _.Message).AsTest().Must().Each().StartWith("Attempting to compare objects of different types.");
actuals2.AsTest().Must().Each().BeOfType<ArgumentException>(because: scenario.Id);
actuals2.Select(_ => _.Message).AsTest().Must().Each().StartWith("Attempting to compare objects of different types.");
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void CompareToForRelativeSortOrder_with_ModelComparingPublicSetNoneParent___Should_return_RelativeSortOrder_ThisInstanceFollowsTheOtherInstance___When_parameter_other_is_null()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach (var scenario in scenarios)
{
// Arrange
ModelComparingPublicSetNoneParent other = null;
// Act
var actual = scenario.ReferenceObject.CompareToForRelativeSortOrder(other);
// Assert
actual.AsTest().Must().BeEqualTo(RelativeSortOrder.ThisInstanceFollowsTheOtherInstance, because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void CompareToForRelativeSortOrder_with_ModelComparingPublicSetNoneParent___Should_return_RelativeSortOrder_ThisInstanceOccursInTheSamePositionAsTheOtherInstance___When_parameter_other_is_same_object()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actual = scenario.ReferenceObject.CompareToForRelativeSortOrder((ModelComparingPublicSetNoneParent)scenario.ReferenceObject);
// Assert
actual.AsTest().Must().BeEqualTo(RelativeSortOrder.ThisInstanceOccursInTheSamePositionAsTheOtherInstance, because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void CompareToForRelativeSortOrder_with_ModelComparingPublicSetNoneParent___Should_return_RelativeSortOrder_ThisInstanceOccursInTheSamePositionAsTheOtherInstance___When_objects_being_compared_are_equal()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actuals = scenario.ObjectsThatAreEqualToButNotTheSameAsReferenceObject.Select(_ => scenario.ReferenceObject.CompareToForRelativeSortOrder((ModelComparingPublicSetNoneParent)_)).ToList();
// Assert
actuals.AsTest().Must().Each().BeEqualTo(RelativeSortOrder.ThisInstanceOccursInTheSamePositionAsTheOtherInstance, because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void CompareToForRelativeSortOrder_with_ModelComparingPublicSetNoneParent___Should_return_RelativeSortOrder_ThisInstancePrecedesTheOtherInstance___When_object_is_less_than_parameter_other()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actuals1 = scenario.ObjectsThatAreLessThanReferenceObject.Select(_ => _.CompareToForRelativeSortOrder((ModelComparingPublicSetNoneParent)scenario.ReferenceObject)).ToList();
var actuals2 = scenario.ObjectsThatAreGreaterThanReferenceObject.Select(_ => scenario.ReferenceObject.CompareToForRelativeSortOrder((ModelComparingPublicSetNoneParent)_)).ToList();
// Assert
actuals1.AsTest().Must().Each().BeEqualTo(RelativeSortOrder.ThisInstancePrecedesTheOtherInstance, because: scenario.Id);
actuals2.AsTest().Must().Each().BeEqualTo(RelativeSortOrder.ThisInstancePrecedesTheOtherInstance, because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void CompareToForRelativeSortOrder_with_ModelComparingPublicSetNoneParent___Should_return_RelativeSortOrder_ThisInstanceFollowsTheOtherInstance___When_object_is_greater_than_parameter_other()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actuals1 = scenario.ObjectsThatAreGreaterThanReferenceObject.Select(_ => _.CompareToForRelativeSortOrder((ModelComparingPublicSetNoneParent)scenario.ReferenceObject)).ToList();
var actuals2 = scenario.ObjectsThatAreLessThanReferenceObject.Select(_ => scenario.ReferenceObject.CompareToForRelativeSortOrder((ModelComparingPublicSetNoneParent)_)).ToList();
// Assert
actuals1.AsTest().Must().Each().BeEqualTo(RelativeSortOrder.ThisInstanceFollowsTheOtherInstance, because: scenario.Id);
actuals2.AsTest().Must().Each().BeEqualTo(RelativeSortOrder.ThisInstanceFollowsTheOtherInstance, because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void CompareToForRelativeSortOrder_with_ModelComparingPublicSetNoneParent___Should_throw_ArgumentException___When_objects_being_compared_are_of_different_types()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actuals = scenario.ObjectsThatDeriveFromScenarioTypeButAreNotOfTheSameTypeAsReferenceObject.Select(_ => Record.Exception(() => scenario.ReferenceObject.CompareToForRelativeSortOrder((ModelComparingPublicSetNoneParent)_))).ToList();
// Assert
actuals.AsTest().Must().Each().BeOfType<ArgumentException>(because: scenario.Id);
actuals.Select(_ => _.Message).AsTest().Must().Each().StartWith("Attempting to compare objects of different types.");
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void CompareToForRelativeSortOrder_with_ModelComparingPublicSetNoneChild1___Should_return_RelativeSortOrder_ThisInstanceFollowsTheOtherInstance___When_parameter_other_is_null()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach (var scenario in scenarios)
{
// Arrange
ModelComparingPublicSetNoneChild1 other = null;
// Act
var actual = scenario.ReferenceObject.CompareToForRelativeSortOrder(other);
// Assert
actual.AsTest().Must().BeEqualTo(RelativeSortOrder.ThisInstanceFollowsTheOtherInstance, because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void CompareToForRelativeSortOrder_with_ModelComparingPublicSetNoneChild1___Should_return_RelativeSortOrder_ThisInstanceOccursInTheSamePositionAsTheOtherInstance___When_parameter_other_is_same_object()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actual = scenario.ReferenceObject.CompareToForRelativeSortOrder(scenario.ReferenceObject);
// Assert
actual.AsTest().Must().BeEqualTo(RelativeSortOrder.ThisInstanceOccursInTheSamePositionAsTheOtherInstance, because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void CompareToForRelativeSortOrder_with_ModelComparingPublicSetNoneChild1___Should_return_RelativeSortOrder_ThisInstanceOccursInTheSamePositionAsTheOtherInstance___When_objects_being_compared_are_equal()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actuals = scenario.ObjectsThatAreEqualToButNotTheSameAsReferenceObject.Select(_ => scenario.ReferenceObject.CompareToForRelativeSortOrder(_)).ToList();
// Assert
actuals.AsTest().Must().Each().BeEqualTo(RelativeSortOrder.ThisInstanceOccursInTheSamePositionAsTheOtherInstance, because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void CompareToForRelativeSortOrder_with_ModelComparingPublicSetNoneChild1___Should_return_RelativeSortOrder_ThisInstancePrecedesTheOtherInstance___When_object_is_less_than_parameter_other()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actuals1 = scenario.ObjectsThatAreLessThanReferenceObject.Select(_ => _.CompareToForRelativeSortOrder(scenario.ReferenceObject)).ToList();
var actuals2 = scenario.ObjectsThatAreGreaterThanReferenceObject.Select(_ => scenario.ReferenceObject.CompareToForRelativeSortOrder(_)).ToList();
// Assert
actuals1.AsTest().Must().Each().BeEqualTo(RelativeSortOrder.ThisInstancePrecedesTheOtherInstance, because: scenario.Id);
actuals2.AsTest().Must().Each().BeEqualTo(RelativeSortOrder.ThisInstancePrecedesTheOtherInstance, because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void CompareToForRelativeSortOrder_with_ModelComparingPublicSetNoneChild1___Should_return_RelativeSortOrder_ThisInstanceFollowsTheOtherInstance___When_object_is_greater_than_parameter_other()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actuals1 = scenario.ObjectsThatAreGreaterThanReferenceObject.Select(_ => _.CompareToForRelativeSortOrder(scenario.ReferenceObject)).ToList();
var actuals2 = scenario.ObjectsThatAreLessThanReferenceObject.Select(_ => scenario.ReferenceObject.CompareToForRelativeSortOrder(_)).ToList();
// Assert
actuals1.AsTest().Must().Each().BeEqualTo(RelativeSortOrder.ThisInstanceFollowsTheOtherInstance, because: scenario.Id);
actuals2.AsTest().Must().Each().BeEqualTo(RelativeSortOrder.ThisInstanceFollowsTheOtherInstance, because: scenario.Id);
}
}
[Fact]
[SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly")]
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1715:IdentifiersShouldHaveCorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords")]
[SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")]
[SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames")]
[SuppressMessage("Microsoft.Naming", "CA1722:IdentifiersShouldNotHaveIncorrectPrefix")]
[SuppressMessage("Microsoft.Naming", "CA1725:ParameterNamesShouldMatchBaseDeclaration")]
[SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms")]
[SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly")]
public static void CompareToForRelativeSortOrder_with_ModelComparingPublicSetNoneChild1___Should_throw_ArgumentException___When_objects_being_compared_are_of_different_types()
{
var scenarios = ComparableTestScenarios.ValidateAndPrepareForTesting();
foreach(var scenario in scenarios)
{
// Arrange, Act
var actuals = scenario.ObjectsThatDeriveFromScenarioTypeButAreNotOfTheSameTypeAsReferenceObject.Select(_ => Record.Exception(() => scenario.ReferenceObject.CompareToForRelativeSortOrder(_))).ToList();
// Assert
actuals.AsTest().Must().Each().BeOfType<ArgumentException>(because: scenario.Id);
actuals.Select(_ => _.Message).AsTest().Must().Each().StartWith("Attempting to compare objects of different types.");
}
}
}
}
} | 69.639607 | 255 | 0.684533 | [
"MIT"
] | OBeautifulCode/OBeautifulCode.CodeGen | OBeautifulCode.CodeGen.ModelObject.Test/ModelTests/Scripted/Comparing/PublicSet/None/ModelComparingPublicSetNoneChild1Test.designer.cs | 134,685 | C# |
using PanteonRemoteTest.Abstract.Managers;
using PanteonRemoteTest.Controllers;
using PanteonRemoteTest.ScriptableObjects;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace PanteonRemoteTest.Managers
{
public class GameManager : SingletonObject<GameManager>
{
[SerializeField] GameData[] _levelData;
public event Action OnPlayerWin;
public event Action OnPlayerLose;
public event Action OnPaintDone;
public event Action OnGameReady;
public event Action OnGameOver;
public event Action OnGameStart;
public event Action OnPaintingGameReady;
public event Action OnPaintingGameStart;
public event Action OnPaintingGameOver;
//public GameData LevelData => _levelData[CurrentLevel];
public GameData[] LevelConfig => _levelData;
public bool IsGameOver { get; private set; }
[HideInInspector]
public enum GameStates {
Prepare,
Playing,
Finish,
PaintingPrepare,
PaintingGame,
PaintingGameFinish,
}
public GameStates GameState { get; private set; }
private void Awake()
{
MakeThisSingleton(this);
}
private void Start()
{
InitializeLevel();
}
public void InitializeLevel()
{
IsGameOver = false;
ReadyGame();
SpawnController spawnController = FindObjectOfType<SpawnController>();
spawnController.CreateGameArea();
}
/*EVENTS*/
public void PaintDone()
{
GameState = GameStates.PaintingGameFinish;
OnPaintDone?.Invoke();
}
public void PaintingGameOver()
{
OnPaintingGameOver?.Invoke();
InitializeLevel();
}
public void InitializePaintingGame()
{
//Boyamaya başla
IsGameOver = false;
GameState = GameStates.PaintingGame;
OnPaintingGameStart?.Invoke();
}
public void GetPaintingGameReady()
{
//Platformun Çıkışı (Spawn Controller)
//kamera Geçişi (CameraController)
//Player platforma doğru yürür(Character Controller)(PlayerMove)
//input Disabled(InputReader)
//Player pozisyonu istenen pozisyonda ise InitializePaintingGame (playerController)
GameState = GameStates.PaintingPrepare;
OnPaintingGameReady?.Invoke();
}
public void ReadyGame()
{
GameState = GameStates.Prepare;
OnGameReady?.Invoke();
}
public void StartGame()
{
//Hareketi VER
GameState = GameStates.Playing;
OnGameStart?.Invoke();
}
public void PlayerLoseGame()
{
if (IsGameOver) return;
if (GameState != GameStates.Playing) return;
GameState = GameStates.Finish;
OnPlayerLose?.Invoke();
GameOver();
}
public void PlayerWinGame()
{
if (IsGameOver) return;
GameState = GameStates.Finish;
OnPlayerWin?.Invoke();
GameOver();
}
void GameOver()
{
IsGameOver = true;
OnGameOver?.Invoke();
}
/*EVENTS*/
}
} | 26.62406 | 95 | 0.572155 | [
"Unlicense"
] | OsmanDDursun/PanteonTest | PanteonTest/Assets/GameFolders/Scripts/Concretes/Managers/GameManager.cs | 3,554 | C# |
using System;
using System.Text;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Data;
using DTcms.DBUtility;
using DTcms.Common;
namespace DTcms.DAL
{
public partial class Order
{
public bool Exists(int Id)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("select count(1) from mtms_Order");
strSql.Append(" where ");
strSql.Append(" Id = @Id ");
SqlParameter[] parameters = {
new SqlParameter("@Id", SqlDbType.Int,4)
};
parameters[0].Value = Id;
return DbHelperSQL.Exists(strSql.ToString(), parameters);
}
/// <summary>
/// 增加一条数据
/// </summary>
public int Add(Model.Order model)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("insert into mtms_Order(");
strSql.Append("Code,AcceptOrderTime,ArrivedTime,Shipper,ShipperLinkMan,ShipperLinkTel,Receiver,ReceiverLinkMan,ReceiverLinkTel,ContractNumber,LoadingAddress,UnloadingAddress,Goods,Unit,IsCharteredCar,Quantity,DispatchedCount,Haulway,LoadingCapacityRunning,NoLoadingCapacityRunning,BillNumber,WeighbridgeNumber,Formula,UnitPrice,TotalPrice,SettleAccountsWay,Status,Remarks");
strSql.Append(") values (");
strSql.Append("@Code,@AcceptOrderTime,@ArrivedTime,@Shipper,@ShipperLinkMan,@ShipperLinkTel,@Receiver,@ReceiverLinkMan,@ReceiverLinkTel,@ContractNumber,@LoadingAddress,@UnloadingAddress,@Goods,@Unit,@IsCharteredCar,@Quantity,@DispatchedCount,@Haulway,@LoadingCapacityRunning,@NoLoadingCapacityRunning,@BillNumber,@WeighbridgeNumber,@Formula,@UnitPrice,@TotalPrice,@SettleAccountsWay,@Status,@Remarks");
strSql.Append(") ");
strSql.Append(";select @@IDENTITY");
SqlParameter[] parameters = {
new SqlParameter("@Code", SqlDbType.VarChar,254) ,
new SqlParameter("@AcceptOrderTime", SqlDbType.DateTime) ,
new SqlParameter("@ArrivedTime", SqlDbType.DateTime) ,
new SqlParameter("@Shipper", SqlDbType.VarChar,254) ,
new SqlParameter("@ShipperLinkMan", SqlDbType.VarChar,254) ,
new SqlParameter("@ShipperLinkTel", SqlDbType.VarChar,254) ,
new SqlParameter("@Receiver", SqlDbType.VarChar,254) ,
new SqlParameter("@ReceiverLinkMan", SqlDbType.VarChar,254) ,
new SqlParameter("@ReceiverLinkTel", SqlDbType.VarChar,254) ,
new SqlParameter("@ContractNumber", SqlDbType.VarChar,254) ,
new SqlParameter("@LoadingAddress", SqlDbType.VarChar,254) ,
new SqlParameter("@UnloadingAddress", SqlDbType.VarChar,254) ,
new SqlParameter("@Goods", SqlDbType.VarChar,254) ,
new SqlParameter("@Unit", SqlDbType.VarChar,254) ,
new SqlParameter("@IsCharteredCar", SqlDbType.SmallInt,2) ,
new SqlParameter("@Quantity", SqlDbType.Decimal,9) ,
new SqlParameter("@DispatchedCount", SqlDbType.Decimal,9) ,
new SqlParameter("@Haulway", SqlDbType.VarChar,254) ,
new SqlParameter("@LoadingCapacityRunning", SqlDbType.Decimal,9) ,
new SqlParameter("@NoLoadingCapacityRunning", SqlDbType.Decimal,9) ,
new SqlParameter("@BillNumber", SqlDbType.VarChar,254) ,
new SqlParameter("@WeighbridgeNumber", SqlDbType.VarChar,254) ,
new SqlParameter("@Formula", SqlDbType.VarChar,254) ,
new SqlParameter("@UnitPrice", SqlDbType.Decimal,9) ,
new SqlParameter("@TotalPrice", SqlDbType.Decimal,9) ,
new SqlParameter("@SettleAccountsWay", SqlDbType.VarChar,254) ,
new SqlParameter("@Status", SqlDbType.Int,4) ,
new SqlParameter("@Remarks", SqlDbType.VarChar,254)
};
parameters[0].Value = model.Code;
parameters[1].Value = model.AcceptOrderTime;
parameters[2].Value = model.ArrivedTime;
parameters[3].Value = model.Shipper;
parameters[4].Value = model.ShipperLinkMan;
parameters[5].Value = model.ShipperLinkTel;
parameters[6].Value = model.Receiver;
parameters[7].Value = model.ReceiverLinkMan;
parameters[8].Value = model.ReceiverLinkTel;
parameters[9].Value = model.ContractNumber;
parameters[10].Value = model.LoadingAddress;
parameters[11].Value = model.UnloadingAddress;
parameters[12].Value = model.Goods;
parameters[13].Value = model.Unit;
parameters[14].Value = model.IsCharteredCar;
parameters[15].Value = model.Quantity;
parameters[16].Value = model.DispatchedCount;
parameters[17].Value = model.Haulway;
parameters[18].Value = model.LoadingCapacityRunning;
parameters[19].Value = model.NoLoadingCapacityRunning;
parameters[20].Value = model.BillNumber;
parameters[21].Value = model.WeighbridgeNumber;
parameters[22].Value = model.Formula;
parameters[23].Value = model.UnitPrice;
parameters[24].Value = model.TotalPrice;
parameters[25].Value = model.SettleAccountsWay;
parameters[26].Value = model.Status;
parameters[27].Value = model.Remarks;
object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
if (obj == null)
{
return 0;
}
else
{
return Convert.ToInt32(obj);
}
}
/// <summary>
/// 更新一条数据
/// </summary>
public bool Update(Model.Order model)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("update mtms_Order set ");
strSql.Append(" Code = @Code , ");
strSql.Append(" AcceptOrderTime = @AcceptOrderTime , ");
strSql.Append(" ArrivedTime = @ArrivedTime , ");
strSql.Append(" Shipper = @Shipper , ");
strSql.Append(" ShipperLinkMan = @ShipperLinkMan , ");
strSql.Append(" ShipperLinkTel = @ShipperLinkTel , ");
strSql.Append(" Receiver = @Receiver , ");
strSql.Append(" ReceiverLinkMan = @ReceiverLinkMan , ");
strSql.Append(" ReceiverLinkTel = @ReceiverLinkTel , ");
strSql.Append(" ContractNumber = @ContractNumber , ");
strSql.Append(" LoadingAddress = @LoadingAddress , ");
strSql.Append(" UnloadingAddress = @UnloadingAddress , ");
strSql.Append(" Goods = @Goods , ");
strSql.Append(" Unit = @Unit , ");
strSql.Append(" IsCharteredCar = @IsCharteredCar , ");
strSql.Append(" Quantity = @Quantity , ");
strSql.Append(" DispatchedCount = @DispatchedCount , ");
strSql.Append(" Haulway = @Haulway , ");
strSql.Append(" LoadingCapacityRunning = @LoadingCapacityRunning , ");
strSql.Append(" NoLoadingCapacityRunning = @NoLoadingCapacityRunning , ");
strSql.Append(" BillNumber = @BillNumber , ");
strSql.Append(" WeighbridgeNumber = @WeighbridgeNumber , ");
strSql.Append(" Formula = @Formula , ");
strSql.Append(" UnitPrice = @UnitPrice , ");
strSql.Append(" TotalPrice = @TotalPrice , ");
strSql.Append(" SettleAccountsWay = @SettleAccountsWay , ");
strSql.Append(" Status = @Status , ");
strSql.Append(" Remarks = @Remarks ");
strSql.Append(" where Id=@Id ");
SqlParameter[] parameters = {
new SqlParameter("@Id", SqlDbType.Int,4) ,
new SqlParameter("@Code", SqlDbType.VarChar,254) ,
new SqlParameter("@AcceptOrderTime", SqlDbType.DateTime) ,
new SqlParameter("@ArrivedTime", SqlDbType.DateTime) ,
new SqlParameter("@Shipper", SqlDbType.VarChar,254) ,
new SqlParameter("@ShipperLinkMan", SqlDbType.VarChar,254) ,
new SqlParameter("@ShipperLinkTel", SqlDbType.VarChar,254) ,
new SqlParameter("@Receiver", SqlDbType.VarChar,254) ,
new SqlParameter("@ReceiverLinkMan", SqlDbType.VarChar,254) ,
new SqlParameter("@ReceiverLinkTel", SqlDbType.VarChar,254) ,
new SqlParameter("@ContractNumber", SqlDbType.VarChar,254) ,
new SqlParameter("@LoadingAddress", SqlDbType.VarChar,254) ,
new SqlParameter("@UnloadingAddress", SqlDbType.VarChar,254) ,
new SqlParameter("@Goods", SqlDbType.VarChar,254) ,
new SqlParameter("@Unit", SqlDbType.VarChar,254) ,
new SqlParameter("@IsCharteredCar", SqlDbType.SmallInt,2) ,
new SqlParameter("@Quantity", SqlDbType.Decimal,9) ,
new SqlParameter("@DispatchedCount", SqlDbType.Decimal,9) ,
new SqlParameter("@Haulway", SqlDbType.VarChar,254) ,
new SqlParameter("@LoadingCapacityRunning", SqlDbType.Decimal,9) ,
new SqlParameter("@NoLoadingCapacityRunning", SqlDbType.Decimal,9) ,
new SqlParameter("@BillNumber", SqlDbType.VarChar,254) ,
new SqlParameter("@WeighbridgeNumber", SqlDbType.VarChar,254) ,
new SqlParameter("@Formula", SqlDbType.VarChar,254) ,
new SqlParameter("@UnitPrice", SqlDbType.Decimal,9) ,
new SqlParameter("@TotalPrice", SqlDbType.Decimal,9) ,
new SqlParameter("@SettleAccountsWay", SqlDbType.VarChar,254) ,
new SqlParameter("@Status", SqlDbType.Int,4) ,
new SqlParameter("@Remarks", SqlDbType.VarChar,254)
};
parameters[0].Value = model.Id;
parameters[1].Value = model.Code;
parameters[2].Value = model.AcceptOrderTime;
parameters[3].Value = model.ArrivedTime;
parameters[4].Value = model.Shipper;
parameters[5].Value = model.ShipperLinkMan;
parameters[6].Value = model.ShipperLinkTel;
parameters[7].Value = model.Receiver;
parameters[8].Value = model.ReceiverLinkMan;
parameters[9].Value = model.ReceiverLinkTel;
parameters[10].Value = model.ContractNumber;
parameters[11].Value = model.LoadingAddress;
parameters[12].Value = model.UnloadingAddress;
parameters[13].Value = model.Goods;
parameters[14].Value = model.Unit;
parameters[15].Value = model.IsCharteredCar;
parameters[16].Value = model.Quantity;
parameters[17].Value = model.DispatchedCount;
parameters[18].Value = model.Haulway;
parameters[19].Value = model.LoadingCapacityRunning;
parameters[20].Value = model.NoLoadingCapacityRunning;
parameters[21].Value = model.BillNumber;
parameters[22].Value = model.WeighbridgeNumber;
parameters[23].Value = model.Formula;
parameters[24].Value = model.UnitPrice;
parameters[25].Value = model.TotalPrice;
parameters[26].Value = model.SettleAccountsWay;
parameters[27].Value = model.Status;
parameters[28].Value = model.Remarks;
int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
if (rows > 0)
{
return true;
}
else
{
return false;
}
}
public int UpdateField(SqlConnection conn, SqlTransaction trans, int id, string strValue)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("update mtms_Order set " + strValue);
strSql.Append(" where Id=" + id);
return DbHelperSQL.ExecuteSql(conn, trans, strSql.ToString());
}
public bool AddDispatchCount(int id, decimal dispatchCount, int status)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("update mtms_Order set ");
strSql.Append(" Status = @Status, ");
//strSql.Append(" DispatchedCount += @DispatchCount ");
strSql.Append(" DispatchedCount =DispatchedCount+ @DispatchCount ");
strSql.Append(" where Id=@Id ");
SqlParameter[] parameters = {
new SqlParameter("@Id", SqlDbType.Int,4) ,
new SqlParameter("@DispatchCount", SqlDbType.Decimal,9),
new SqlParameter("@Status", SqlDbType.Int,4)
};
parameters[0].Value = id;
parameters[1].Value = dispatchCount;
parameters[2].Value = status;
int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
if (rows > 0)
{
return true;
}
else
{
return false;
}
}
/// <summary>
/// 删除一条数据
/// </summary>
public bool Delete(int Id)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("delete from mtms_Order ");
strSql.Append(" where Id=@Id");
SqlParameter[] parameters = {
new SqlParameter("@Id", SqlDbType.Int,4)
};
parameters[0].Value = Id;
int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
if (rows > 0)
{
return true;
}
else
{
return false;
}
}
/// <summary>
/// 批量删除一批数据
/// </summary>
public bool DeleteList(string Idlist)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("delete from mtms_Order ");
strSql.Append(" where ID in (" + Idlist + ") ");
int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
if (rows > 0)
{
return true;
}
else
{
return false;
}
}
/// <summary>
/// 得到一个对象实体
/// </summary>
public Model.Order GetModel(int Id)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("select Id, Code, AcceptOrderTime, ArrivedTime, Shipper, ShipperLinkMan, ShipperLinkTel, Receiver, ReceiverLinkMan, ReceiverLinkTel, ContractNumber, LoadingAddress, UnloadingAddress, Goods, Unit, IsCharteredCar, Quantity, DispatchedCount, Haulway, LoadingCapacityRunning, NoLoadingCapacityRunning, BillNumber, WeighbridgeNumber, Formula, UnitPrice, TotalPrice, SettleAccountsWay, Status, Remarks ");
strSql.Append(" from mtms_Order ");
strSql.Append(" where Id=@Id");
SqlParameter[] parameters = {
new SqlParameter("@Id", SqlDbType.Int,4)
};
parameters[0].Value = Id;
Model.Order model = new Model.Order();
DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
if (ds.Tables[0].Rows.Count > 0)
{
if (ds.Tables[0].Rows[0]["Id"].ToString() != "")
{
model.Id = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
}
model.Code = ds.Tables[0].Rows[0]["Code"].ToString();
if (ds.Tables[0].Rows[0]["AcceptOrderTime"].ToString() != "")
{
model.AcceptOrderTime = DateTime.Parse(ds.Tables[0].Rows[0]["AcceptOrderTime"].ToString());
}
if (ds.Tables[0].Rows[0]["ArrivedTime"].ToString() != "")
{
model.ArrivedTime = DateTime.Parse(ds.Tables[0].Rows[0]["ArrivedTime"].ToString());
}
model.Shipper = ds.Tables[0].Rows[0]["Shipper"].ToString();
model.ShipperLinkMan = ds.Tables[0].Rows[0]["ShipperLinkMan"].ToString();
model.ShipperLinkTel = ds.Tables[0].Rows[0]["ShipperLinkTel"].ToString();
model.Receiver = ds.Tables[0].Rows[0]["Receiver"].ToString();
model.ReceiverLinkMan = ds.Tables[0].Rows[0]["ReceiverLinkMan"].ToString();
model.ReceiverLinkTel = ds.Tables[0].Rows[0]["ReceiverLinkTel"].ToString();
model.ContractNumber = ds.Tables[0].Rows[0]["ContractNumber"].ToString();
model.LoadingAddress = ds.Tables[0].Rows[0]["LoadingAddress"].ToString();
model.UnloadingAddress = ds.Tables[0].Rows[0]["UnloadingAddress"].ToString();
model.Goods = ds.Tables[0].Rows[0]["Goods"].ToString();
model.Unit = ds.Tables[0].Rows[0]["Unit"].ToString();
if (ds.Tables[0].Rows[0]["IsCharteredCar"].ToString() != "")
{
model.IsCharteredCar = int.Parse(ds.Tables[0].Rows[0]["IsCharteredCar"].ToString());
}
if (ds.Tables[0].Rows[0]["Quantity"].ToString() != "")
{
model.Quantity = decimal.Parse(ds.Tables[0].Rows[0]["Quantity"].ToString());
}
if (ds.Tables[0].Rows[0]["DispatchedCount"].ToString() != "")
{
model.DispatchedCount = decimal.Parse(ds.Tables[0].Rows[0]["DispatchedCount"].ToString());
}
model.Haulway = ds.Tables[0].Rows[0]["Haulway"].ToString();
if (ds.Tables[0].Rows[0]["LoadingCapacityRunning"].ToString() != "")
{
model.LoadingCapacityRunning = decimal.Parse(ds.Tables[0].Rows[0]["LoadingCapacityRunning"].ToString());
}
if (ds.Tables[0].Rows[0]["NoLoadingCapacityRunning"].ToString() != "")
{
model.NoLoadingCapacityRunning = decimal.Parse(ds.Tables[0].Rows[0]["NoLoadingCapacityRunning"].ToString());
}
model.BillNumber = ds.Tables[0].Rows[0]["BillNumber"].ToString();
model.WeighbridgeNumber = ds.Tables[0].Rows[0]["WeighbridgeNumber"].ToString();
model.Formula = ds.Tables[0].Rows[0]["Formula"].ToString();
if (ds.Tables[0].Rows[0]["UnitPrice"].ToString() != "")
{
model.UnitPrice = decimal.Parse(ds.Tables[0].Rows[0]["UnitPrice"].ToString());
}
if (ds.Tables[0].Rows[0]["TotalPrice"].ToString() != "")
{
model.TotalPrice = decimal.Parse(ds.Tables[0].Rows[0]["TotalPrice"].ToString());
}
model.SettleAccountsWay = ds.Tables[0].Rows[0]["SettleAccountsWay"].ToString();
if (ds.Tables[0].Rows[0]["Status"].ToString() != "")
{
model.Status = int.Parse(ds.Tables[0].Rows[0]["Status"].ToString());
}
model.Remarks = ds.Tables[0].Rows[0]["Remarks"].ToString();
return model;
}
else
{
return null;
}
}
/// <summary>
/// 获得数据列表
/// </summary>
public DataSet GetList(string strWhere)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("select * ");
strSql.Append(" FROM mtms_Order ");
if (strWhere.Trim() != "")
{
strSql.Append(" where " + strWhere);
}
return DbHelperSQL.Query(strSql.ToString());
}
/// <summary>
/// 获得前几行数据
/// </summary>
public DataSet GetList(int Top, string strWhere, string filedOrder)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("select ");
if (Top > 0)
{
strSql.Append(" top " + Top.ToString());
}
strSql.Append(" * ");
strSql.Append(" FROM mtms_Order ");
if (strWhere.Trim() != "")
{
strSql.Append(" where " + strWhere);
}
strSql.Append(" order by " + filedOrder);
return DbHelperSQL.Query(strSql.ToString());
}
/// <summary>
/// 获得查询分页数据
/// </summary>
public DataSet GetList(int pageSize, int pageIndex, string strWhere, string filedOrder, out int recordCount)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("select * FROM mtms_Order");
if (strWhere.Trim() != "")
{
strSql.Append(" where " + strWhere);
}
recordCount = Convert.ToInt32(DbHelperSQL.GetSingle(PagingHelper.CreateCountingSql(strSql.ToString())));
return DbHelperSQL.Query(PagingHelper.CreatePagingSql(recordCount, pageSize, pageIndex, strSql.ToString(), filedOrder));
}
}
}
| 48.438445 | 426 | 0.530477 | [
"Apache-2.0"
] | LutherW/MTMS | Source/DTcms.DAL/Order.cs | 22,539 | C# |
// Generated on 12/11/2014 19:01:32
using System;
using System.Collections.Generic;
using System.Linq;
using BlueSheep.Common.Protocol.Types;
using BlueSheep.Common.IO;
using BlueSheep.Engine.Types;
namespace BlueSheep.Common.Protocol.Messages
{
public class GameRolePlayGameOverMessage : Message
{
public new const uint ID =746;
public override uint ProtocolID
{
get { return ID; }
}
public GameRolePlayGameOverMessage()
{
}
public override void Serialize(BigEndianWriter writer)
{
}
public override void Deserialize(BigEndianReader reader)
{
}
}
} | 16.6 | 64 | 0.586345 | [
"MIT"
] | Sadikk/BlueSheep | BlueSheep/Common/Protocol/messages/game/context/roleplay/death/GameRolePlayGameOverMessage.cs | 747 | C# |
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Unity.Entities;
using Unity.Transforms;
using AnimationBaker;
using AnimationBaker.Baked;
using AnimationBaker.Components;
using AnimationBaker.Interfaces;
using AnimationBaker.StateMachine;
using AnimationBaker.Systems;
using Example.Systems;
using NavJob.Components;
using NavJob.Systems;
namespace Example.StateMachine
{
public class StateMachineBootstrap : MonoBehaviour
{
[SerializeField]
private EntityArchetype Unit;
public StateGraph[] graphs;
EntityManager manager;
void Awake()
{
var world = new World("State Machine World");
world.GetOrCreateManager<NavAgentSystem>();
world.GetOrCreateManager<NavMeshQuerySystem>().UseCache = false;
world.GetOrCreateManager<NavAgentToPositionSyncSystem>();
world.GetOrCreateManager<NavAgentToRotationSyncSystem>();
world.GetOrCreateManager<SyncStateMachineUnitTransforms>();
world.GetOrCreateManager<ArcherDebugSystem>();
AnimatorBootstrap.Create<Archer>(world, graphs[0]);
AnimatorBootstrap.Create<Cerberus>(world, graphs[1]);
AnimatorBootstrap.Create<Diablous>(world, graphs[2]);
AnimatorBootstrap.Create<Knight>(world, graphs[3]);
AnimatorBootstrap.Create<Mage>(world, graphs[4]);
AnimatorBootstrap.Create<Sorceress>(world, graphs[5]);
manager = world.GetOrCreateManager<EntityManager>();
var allWorlds = new World[] { world };
ScriptBehaviourUpdateOrder.UpdatePlayerLoop(allWorlds);
World.Active = world;
Unit = manager.CreateArchetype(
typeof(Position),
typeof(Rotation),
typeof(SyncPositionFromNavAgent),
typeof(SyncRotationFromNavAgent),
typeof(StateMachineUnit),
typeof(NavAgent)
);
PlayerLoopManager.RegisterDomainUnload(DomainUnloadShutdown, 10000);
for (int i = 0; i < 100; i++)
{
Spawn<Archer>();
Spawn<Cerberus>();
Spawn<Mage>();
Spawn<Diablous>();
Spawn<Sorceress>();
Spawn<Knight>();
}
}
private void Spawn<T>() where T : struct, IUnitState
{
var position = new Vector3(
UnityEngine.Random.Range(10f, 90f),
0,
UnityEngine.Random.Range(10f, 90f)
);
var unit = manager.CreateEntity(Unit);
manager.SetComponentData<Position>(unit, new Position { Value = position });
manager.SetComponentData<Rotation>(unit, new Rotation { Value = Quaternion.identity });
manager.SetComponentData<StateMachineUnit>(unit, new StateMachineUnit { Matrix = Matrix4x4.TRS(position, Quaternion.identity, Vector3.one) });
manager.SetComponentData<NavAgent>(unit, new NavAgent(position, Quaternion.identity, 0.1f, 2f));
manager.AddComponent(unit, typeof(T));
}
static void DomainUnloadShutdown()
{
World.DisposeAllWorlds();
ScriptBehaviourUpdateOrder.UpdatePlayerLoop();
}
}
}
| 30.193548 | 145 | 0.74359 | [
"MIT"
] | zulfajuniadi/Animation-Texture-Baker | Assets/Example/Scripts/StateMachineBootstrap.cs | 2,810 | C# |
// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
using System.Collections.Generic;
using System.Linq;
using System.Web.Http.ModelBinding;
using System.Web.Http.ValueProviders;
namespace System.Web.Http.ApiExplorer
{
public class ParameterSourceController : ApiController
{
public void GetCompleTypeFromUri([FromUri]ComplexType value, string name)
{
}
public void PostSimpleTypeFromBody([FromBody] string name)
{
}
public void GetCustomFromUriAttribute([MyFromUriAttribute] ComplexType value, ComplexType bodyValue)
{
}
public void GetFromHeaderAttribute([FromHeaderAttribute] string value)
{
}
public class ComplexType
{
public int Id { get; set; }
public string Name { get; set; }
}
private class MyFromUriAttribute : ModelBinderAttribute, IUriValueProviderFactory
{
public override IEnumerable<ValueProviderFactory> GetValueProviderFactories(HttpConfiguration configuration)
{
var factories = from f in base.GetValueProviderFactories(configuration) where f is IUriValueProviderFactory select f;
return factories;
}
}
private class FromHeaderAttribute : ModelBinderAttribute
{
public override IEnumerable<ValueProviderFactory> GetValueProviderFactories(HttpConfiguration configuration)
{
var factories = new ValueProviderFactory[] { new HeaderValueProvider() };
return factories;
}
}
private class HeaderValueProvider : ValueProviderFactory
{
public override IValueProvider GetValueProvider(Controllers.HttpActionContext actionContext)
{
throw new NotImplementedException();
}
}
}
}
| 32.508197 | 133 | 0.650025 | [
"Apache-2.0"
] | Distrotech/mono | external/aspnetwebstack/test/System.Web.Http.Integration.Test/ApiExplorer/Controllers/ParameterSourceController.cs | 1,985 | C# |
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SharedFunctionalities")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SharedFunctionalities")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("1611e537-663b-4e03-9afd-4dd22c800496")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| 38.222222 | 84 | 0.744913 | [
"MIT"
] | Tvede-dk/c-winforms-componets-collection | winforms-collection/SharedFunctionalities/Properties/AssemblyInfo.cs | 1,379 | C# |
using FluentPOS.Modules.Identity.Core.Abstractions;
using FluentPOS.Modules.Identity.Core.Entities;
using FluentPOS.Modules.Identity.Core.Exceptions;
using FluentPOS.Shared.Core.Constants;
using FluentPOS.Shared.Core.Interfaces.Services;
using FluentPOS.Shared.Core.Settings;
using FluentPOS.Shared.Core.Wrapper;
using FluentPOS.Shared.DTOs.Identity;
using FluentPOS.Shared.DTOs.Mails;
using FluentPOS.Shared.DTOs.Sms;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.WebUtilities;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Encodings.Web;
using System.Threading.Tasks;
using FluentPOS.Modules.Identity.Core.Features.Users.Events;
namespace FluentPOS.Modules.Identity.Infrastructure.Services
{
public class IdentityService : IIdentityService
{
private readonly UserManager<FluentUser> _userManager;
private readonly IJobService _jobService;
private readonly IMailService _mailService;
private readonly MailSettings _mailSettings;
private readonly SmsSettings _smsSettings;
private readonly ISmsService _smsService;
private readonly IStringLocalizer<IdentityService> _localizer;
public IdentityService(
UserManager<FluentUser> userManager,
IJobService jobService,
IMailService mailService,
IOptions<MailSettings> mailSettings,
IOptions<SmsSettings> smsSettings,
ISmsService smsService,
IStringLocalizer<IdentityService> localizer)
{
_userManager = userManager;
_jobService = jobService;
_mailService = mailService;
_mailSettings = mailSettings.Value;
_smsSettings = smsSettings.Value;
_smsService = smsService;
_localizer = localizer;
}
public async Task<IResult> RegisterAsync(RegisterRequest request, string origin)
{
var userWithSameUserName = await _userManager.FindByNameAsync(request.UserName);
if (userWithSameUserName != null)
{
throw new IdentityException(string.Format(_localizer["Username {0} is already taken."], request.UserName));
}
var user = new FluentUser
{
Email = request.Email,
FirstName = request.FirstName,
LastName = request.LastName,
UserName = request.UserName,
PhoneNumber = request.PhoneNumber,
IsActive = true
};
if (!string.IsNullOrWhiteSpace(request.PhoneNumber))
{
var userWithSamePhoneNumber = await _userManager.Users.FirstOrDefaultAsync(x => x.PhoneNumber == request.PhoneNumber);
if (userWithSamePhoneNumber != null)
{
throw new IdentityException(string.Format(_localizer["Phone number {0} is already registered."], request.PhoneNumber));
}
}
var userWithSameEmail = await _userManager.FindByEmailAsync(request.Email);
if (userWithSameEmail == null)
{
user.AddDomainEvent(new UserRegisteredEvent(user));
var result = await _userManager.CreateAsync(user, request.Password);
if (result.Succeeded)
{
try
{
await _userManager.AddToRoleAsync(user, RoleConstants.Staff);
}
catch
{
}
if (!_mailSettings.EnableVerification && !_smsSettings.EnableVerification)
{
return await Result<string>.SuccessAsync(user.Id, message: string.Format(_localizer["User {0} Registered."], user.UserName));
}
var messages = new List<string> { string.Format(_localizer["User {0} Registered."], user.UserName) };
if (_mailSettings.EnableVerification)
{
// send verification email
var emailVerificationUri = await GetEmailVerificationUri(user, origin);
var mailRequest = new MailRequest
{
From = "mail@codewithmukesh.com",
To = user.Email,
Body = string.Format(_localizer["Please confirm your FluentPOS account by <a href='{0}'>clicking here</a>."], emailVerificationUri),
Subject = _localizer["Confirm Registration"]
};
_jobService.Enqueue(() => _mailService.SendAsync(mailRequest));
messages.Add(_localizer["Please check your Mailbox to verify!"]);
}
if (_smsSettings.EnableVerification)
{
// send verification sms
var mobilePhoneVerificationCode = await GetMobilePhoneVerificationCode(user);
var smsRequest = new SmsRequest
{
Number = user.PhoneNumber,
Message = string.Format(_localizer["Please confirm your FluentPOS account by this code: {0}"], mobilePhoneVerificationCode)
};
_jobService.Enqueue(() => _smsService.SendAsync(smsRequest));
messages.Add(_localizer["Please check your Phone for code in SMS to verify!"]);
}
return await Result<string>.SuccessAsync(user.Id, messages: messages);
}
else
{
throw new IdentityException(_localizer["Validation Errors Occurred."], result.Errors.Select(a => _localizer[a.Description].ToString()).ToList());
}
}
else
{
throw new IdentityException(string.Format(_localizer["Email {0} is already registered."], request.Email));
}
}
private async Task<string> GetEmailVerificationUri(FluentUser user, string origin)
{
var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);
code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code));
var route = "api/identity/confirm-email/";
var endpointUri = new Uri(string.Concat($"{origin}/", route));
var verificationUri = QueryHelpers.AddQueryString(endpointUri.ToString(), "userId", user.Id);
verificationUri = QueryHelpers.AddQueryString(verificationUri, "code", code);
return verificationUri;
}
private async Task<string> GetMobilePhoneVerificationCode(FluentUser user)
{
return await _userManager.GenerateChangePhoneNumberTokenAsync(user, user.PhoneNumber);
}
public async Task<IResult<string>> ConfirmEmailAsync(string userId, string code)
{
var user = await _userManager.FindByIdAsync(userId);
if (user == null)
{
throw new IdentityException(_localizer["An error occurred while confirming E-Mail."]);
}
code = Encoding.UTF8.GetString(WebEncoders.Base64UrlDecode(code));
var result = await _userManager.ConfirmEmailAsync(user, code);
if (result.Succeeded)
{
if (user.PhoneNumberConfirmed || !_smsSettings.EnableVerification)
{
return await Result<string>.SuccessAsync(user.Id, string.Format(_localizer["Account Confirmed for E-Mail {0}. You can now use the /api/identity/token endpoint to generate JWT."], user.Email));
}
else
{
return await Result<string>.SuccessAsync(user.Id, string.Format(_localizer["Account Confirmed for E-Mail {0}. You should confirm your Phone Number before using the /api/identity/token endpoint to generate JWT."], user.Email));
}
}
else
{
throw new IdentityException(string.Format(_localizer["An error occurred while confirming {0}"], user.Email));
}
}
public async Task<IResult<string>> ConfirmPhoneNumberAsync(string userId, string code)
{
var user = await _userManager.FindByIdAsync(userId);
if (user == null)
{
throw new IdentityException(_localizer["An error occurred while confirming Mobile Phone."]);
}
var result = await _userManager.ChangePhoneNumberAsync(user, user.PhoneNumber, code);
if (result.Succeeded)
{
if (user.EmailConfirmed)
{
return await Result<string>.SuccessAsync(user.Id, string.Format(_localizer["Account Confirmed for Phone Number {0}. You can now use the /api/identity/token endpoint to generate JWT."], user.PhoneNumber));
}
else
{
return await Result<string>.SuccessAsync(user.Id, string.Format(_localizer["Account Confirmed for Phone Number {0}. You should confirm your E-mail before using the /api/identity/token endpoint to generate JWT."], user.PhoneNumber));
}
}
else
{
throw new IdentityException(string.Format(_localizer["An error occurred while confirming {0}"], user.PhoneNumber));
}
}
public async Task<IResult> ForgotPasswordAsync(ForgotPasswordRequest request, string origin)
{
var user = await _userManager.FindByEmailAsync(request.Email);
if (user == null || !(await _userManager.IsEmailConfirmedAsync(user)))
{
// Don't reveal that the user does not exist or is not confirmed
throw new IdentityException(_localizer["An Error has occurred!"]);
}
// For more information on how to enable account confirmation and password reset please
// visit https://go.microsoft.com/fwlink/?LinkID=532713
var code = await _userManager.GeneratePasswordResetTokenAsync(user);
code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code));
var route = "account/reset-password";
var endpointUri = new Uri(string.Concat($"{origin}/", route));
var passwordResetUrl = QueryHelpers.AddQueryString(endpointUri.ToString(), "Token", code);
var mailRequest = new MailRequest
{
Body = string.Format(_localizer["Please reset your password by <a href='{0}>clicking here</a>."], HtmlEncoder.Default.Encode(passwordResetUrl)),
Subject = _localizer["Reset Password"],
To = request.Email
};
//BackgroundJob.Enqueue(() => _mailService.SendAsync(mailRequest));
return await Result.SuccessAsync(_localizer["Password Reset Mail has been sent to your authorized Email."]);
}
public async Task<IResult> ResetPasswordAsync(ResetPasswordRequest request)
{
var user = await _userManager.FindByEmailAsync(request.Email);
if (user == null)
{
// Don't reveal that the user does not exist
throw new IdentityException(_localizer["An Error has occurred!"]);
}
var result = await _userManager.ResetPasswordAsync(user, request.Token, request.Password);
if (result.Succeeded)
{
return await Result.SuccessAsync(_localizer["Password Reset Successful!"]);
}
else
{
throw new IdentityException(_localizer["An Error has occurred!"]);
}
}
}
} | 47.799213 | 252 | 0.594185 | [
"MIT"
] | abdul-qadirdeveloper/fluentpos | src/server/Modules/Identity/Modules.Identity.Infrastructure/Services/IdentityService.cs | 12,143 | C# |
namespace TestPlatform
{
partial class FormShowData
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormShowData));
this.label1 = new System.Windows.Forms.Label();
this.resultComboBox = new System.Windows.Forms.ComboBox();
this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.csvExportButton = new System.Windows.Forms.Button();
this.helpButton = new System.Windows.Forms.Button();
this.audioPathDataGridView = new System.Windows.Forms.DataGridView();
this.fileNameColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.filePathColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.label2 = new System.Windows.Forms.Label();
this.stopAudio = new System.Windows.Forms.Button();
this.playAudioButton = new System.Windows.Forms.Button();
this.closeButton = new System.Windows.Forms.Button();
this.exportAudioButton = new System.Windows.Forms.Button();
this.exportAllAudiosButton = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.audioPathDataGridView)).BeginInit();
this.SuspendLayout();
//
// label1
//
resources.ApplyResources(this.label1, "label1");
this.label1.Name = "label1";
//
// resultComboBox
//
this.resultComboBox.FormattingEnabled = true;
resources.ApplyResources(this.resultComboBox, "resultComboBox");
this.resultComboBox.Name = "resultComboBox";
this.resultComboBox.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
//
// dataGridView1
//
this.dataGridView1.AllowUserToAddRows = false;
this.dataGridView1.AllowUserToDeleteRows = false;
this.dataGridView1.AllowUserToResizeRows = false;
this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.dataGridView1.AutoSizeRowsMode = System.Windows.Forms.DataGridViewAutoSizeRowsMode.AllCells;
this.dataGridView1.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
resources.ApplyResources(this.dataGridView1, "dataGridView1");
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.ReadOnly = true;
this.dataGridView1.RowHeadersVisible = false;
this.dataGridView1.RowTemplate.Height = 24;
this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dataGridView1.ShowEditingIcon = false;
//
// csvExportButton
//
resources.ApplyResources(this.csvExportButton, "csvExportButton");
this.csvExportButton.Name = "csvExportButton";
this.csvExportButton.UseVisualStyleBackColor = true;
this.csvExportButton.Click += new System.EventHandler(this.exportCVSButton_Click);
//
// helpButton
//
this.helpButton.BackColor = System.Drawing.SystemColors.ControlLight;
this.helpButton.BackgroundImage = global::TestPlatform.Properties.Resources.helpButton;
resources.ApplyResources(this.helpButton, "helpButton");
this.helpButton.Name = "helpButton";
this.helpButton.UseVisualStyleBackColor = false;
this.helpButton.Click += new System.EventHandler(this.helpButton_Click);
//
// audioPathDataGridView
//
this.audioPathDataGridView.AllowUserToAddRows = false;
this.audioPathDataGridView.AllowUserToOrderColumns = true;
this.audioPathDataGridView.AllowUserToResizeRows = false;
this.audioPathDataGridView.BackgroundColor = System.Drawing.SystemColors.ControlLightLight;
this.audioPathDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.audioPathDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.fileNameColumn,
this.filePathColumn});
resources.ApplyResources(this.audioPathDataGridView, "audioPathDataGridView");
this.audioPathDataGridView.MultiSelect = false;
this.audioPathDataGridView.Name = "audioPathDataGridView";
this.audioPathDataGridView.ReadOnly = true;
this.audioPathDataGridView.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
this.audioPathDataGridView.RowHeadersVisible = false;
this.audioPathDataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
//
// fileNameColumn
//
this.fileNameColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;
this.fileNameColumn.FillWeight = 187.013F;
resources.ApplyResources(this.fileNameColumn, "fileNameColumn");
this.fileNameColumn.Name = "fileNameColumn";
this.fileNameColumn.ReadOnly = true;
//
// filePathColumn
//
this.filePathColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.filePathColumn.FillWeight = 12.98701F;
resources.ApplyResources(this.filePathColumn, "filePathColumn");
this.filePathColumn.Name = "filePathColumn";
this.filePathColumn.ReadOnly = true;
//
// label2
//
resources.ApplyResources(this.label2, "label2");
this.label2.Name = "label2";
//
// stopAudio
//
resources.ApplyResources(this.stopAudio, "stopAudio");
this.stopAudio.Name = "stopAudio";
this.stopAudio.UseVisualStyleBackColor = true;
this.stopAudio.Click += new System.EventHandler(this.stopAudio_Click);
//
// playAudioButton
//
resources.ApplyResources(this.playAudioButton, "playAudioButton");
this.playAudioButton.Name = "playAudioButton";
this.playAudioButton.UseVisualStyleBackColor = true;
this.playAudioButton.Click += new System.EventHandler(this.playAudioButton_Click);
//
// closeButton
//
this.closeButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
resources.ApplyResources(this.closeButton, "closeButton");
this.closeButton.Name = "closeButton";
this.closeButton.UseVisualStyleBackColor = true;
this.closeButton.Click += new System.EventHandler(this.closeButton_Click);
//
// exportAudioButton
//
resources.ApplyResources(this.exportAudioButton, "exportAudioButton");
this.exportAudioButton.Name = "exportAudioButton";
this.exportAudioButton.UseVisualStyleBackColor = true;
this.exportAudioButton.Click += new System.EventHandler(this.exportAudioButton_Click);
//
// exportAllAudiosButton
//
resources.ApplyResources(this.exportAllAudiosButton, "exportAllAudiosButton");
this.exportAllAudiosButton.Name = "exportAllAudiosButton";
this.exportAllAudiosButton.UseVisualStyleBackColor = true;
this.exportAllAudiosButton.Click += new System.EventHandler(this.exportAllAudiosButton_Click);
//
// FormShowData
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.exportAllAudiosButton);
this.Controls.Add(this.exportAudioButton);
this.Controls.Add(this.closeButton);
this.Controls.Add(this.stopAudio);
this.Controls.Add(this.playAudioButton);
this.Controls.Add(this.label2);
this.Controls.Add(this.audioPathDataGridView);
this.Controls.Add(this.helpButton);
this.Controls.Add(this.csvExportButton);
this.Controls.Add(this.dataGridView1);
this.Controls.Add(this.resultComboBox);
this.Controls.Add(this.label1);
this.Name = "FormShowData";
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.audioPathDataGridView)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ComboBox resultComboBox;
private System.Windows.Forms.DataGridView dataGridView1;
private System.Windows.Forms.Button csvExportButton;
private System.Windows.Forms.Button helpButton;
private System.Windows.Forms.DataGridView audioPathDataGridView;
private System.Windows.Forms.DataGridViewTextBoxColumn fileNameColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn filePathColumn;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button stopAudio;
private System.Windows.Forms.Button playAudioButton;
private System.Windows.Forms.Button closeButton;
private System.Windows.Forms.Button exportAudioButton;
private System.Windows.Forms.Button exportAllAudiosButton;
}
} | 52.271429 | 144 | 0.650724 | [
"MIT"
] | lab-neuro-comp/Test-Plataform | StroopTest/Views/StroopPages/FormShowData.Designer.cs | 10,979 | C# |
using System;
namespace Oqtane.Shared {
public class Constants {
public static readonly string Version = "3.0.3";
public const string ReleaseVersions = "1.0.0,1.0.1,1.0.2,1.0.3,1.0.4,2.0.0,2.0.1,2.0.2,2.1.0,2.2.0,2.3.0,2.3.1,3.0.0,3.0.1,3.0.2,3.0.3";
public const string PackageId = "Oqtane.Framework";
public const string UpdaterPackageId = "Oqtane.Updater";
public const string PackageRegistryUrl = "https://www.oqtane.net";
public const string DefaultDBType = "Oqtane.Database.SqlServer.SqlServerDatabase, Oqtane.Database.SqlServer";
public const string PageComponent = "Oqtane.UI.ThemeBuilder, Oqtane.Client";
public const string ContainerComponent = "Oqtane.UI.ContainerBuilder, Oqtane.Client";
public const string DefaultTheme = "Oqtane.Themes.OqtaneTheme.Default, Oqtane.Client";
[Obsolete("DefaultLayout is deprecated")]
public const string DefaultLayout = "";
public const string DefaultContainer = "Oqtane.Themes.OqtaneTheme.Container, Oqtane.Client";
public const string DefaultAdminContainer = "Oqtane.Themes.AdminContainer, Oqtane.Client";
public const string ActionToken = "{Action}";
public const string DefaultAction = "Index";
[Obsolete("Use PaneNames.Admin")]
public const string AdminPane = PaneNames.Admin;
public const string ModuleDelimiter = "*";
public const string UrlParametersDelimiter = "!";
// Default Module Actions are reserved and should not be used by modules
public static readonly string[] DefaultModuleActions = new[] { "Settings", "Import", "Export" };
public static readonly string DefaultModuleActionsTemplate = "Oqtane.Modules.Admin.Modules." + ActionToken + ", Oqtane.Client";
public const string AdminDashboardModule = "Oqtane.Modules.Admin.Dashboard, Oqtane.Client";
public const string PageManagementModule = "Oqtane.Modules.Admin.Pages, Oqtane.Client";
public const string ErrorModule = "Oqtane.Modules.Admin.Error.{Action}, Oqtane.Client";
public const string ModuleMessageComponent = "Oqtane.Modules.Controls.ModuleMessage, Oqtane.Client";
public const string DefaultSiteTemplate = "Oqtane.SiteTemplates.DefaultSiteTemplate, Oqtane.Server";
public const string ContentUrl = "/api/file/download/";
public const string ImageUrl = "/api/file/image/";
public const int UserFolderCapacity = 20; // megabytes
public const string PackagesFolder = "Packages";
[Obsolete("Use UserNames.Host instead.")]
public const string HostUser = UserNames.Host;
[Obsolete("Use TenantNames.Master instead")]
public const string MasterTenant = TenantNames.Master;
public const string DefaultSite = "Default Site";
const string RoleObsoleteMessage = "Use the corresponding member from Oqtane.Shared.RoleNames";
[Obsolete(RoleObsoleteMessage)]
public const string AllUsersRole = RoleNames.Everyone;
[Obsolete(RoleObsoleteMessage)]
public const string HostRole = RoleNames.Host;
[Obsolete(RoleObsoleteMessage)]
public const string AdminRole = RoleNames.Admin;
[Obsolete(RoleObsoleteMessage)]
public const string RegisteredRole = RoleNames.Registered;
public const string ImageFiles = "jpg,jpeg,jpe,gif,bmp,png,ico,webp";
public const string UploadableFiles = ImageFiles + ",mov,wmv,avi,mp4,mp3,doc,docx,xls,xlsx,ppt,pptx,pdf,txt,zip,nupkg,csv,json,xml,xslt,rss,html,htm,css";
public const string ReservedDevices = "CON,NUL,PRN,COM0,COM1,COM2,COM3,COM4,COM5,COM6,COM7,COM8,COM9,LPT0,LPT1,LPT2,LPT3,LPT4,LPT5,LPT6,LPT7,LPT8,LPT9,CONIN$,CONOUT$";
public static readonly char[] InvalidFileNameChars =
{
'\"', '<', '>', '|', '\0', (Char) 1, (Char) 2, (Char) 3, (Char) 4, (Char) 5, (Char) 6, (Char) 7, (Char) 8,
(Char) 9, (Char) 10, (Char) 11, (Char) 12, (Char) 13, (Char) 14, (Char) 15, (Char) 16, (Char) 17, (Char) 18,
(Char) 19, (Char) 20, (Char) 21, (Char) 22, (Char) 23, (Char) 24, (Char) 25, (Char) 26, (Char) 27,
(Char) 28, (Char) 29, (Char) 30, (Char) 31, ':', '*', '?', '\\', '/'
};
public static readonly string[] InvalidFileNameEndingChars = { ".", " " };
public static readonly string SatelliteAssemblyExtension = ".resources.dll";
public static readonly string DefaultCulture = "en";
public static readonly string AuthenticationScheme = "Identity.Application";
public static readonly string RequestVerificationToken = "__RequestVerificationToken";
public static readonly string AntiForgeryTokenHeaderName = "X-XSRF-TOKEN-HEADER";
public static readonly string AntiForgeryTokenCookieName = "X-XSRF-TOKEN-COOKIE";
public static readonly string DefaultVisitorFilter = "bot,crawler,slurp,spider,(none),??";
public static readonly string HttpContextAliasKey = "SiteState.Alias";
public static readonly string SiteToken = "{SiteToken}";
}
}
| 55.150538 | 175 | 0.68025 | [
"MIT"
] | QuasarTechnologies/oqtane.framework | Oqtane.Shared/Shared/Constants.cs | 5,129 | C# |
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Snapshot.cs" company="WildGums">
// Copyright (c) 2008 - 2016 WildGums. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace Orc.Snapshots
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Catel;
using Catel.Logging;
using Ionic.Zip;
using CompressionLevel = Ionic.Zlib.CompressionLevel;
public class Snapshot : ISnapshot
{
private static readonly ILog Log = LogManager.GetCurrentClassLogger();
private const string InternalFileExtension = ".dat";
private readonly Dictionary<string, byte[]> _data = new Dictionary<string, byte[]>();
private string[] _dataKeys = Array.Empty<string>();
private string _contentHash;
private byte[] _allData;
private bool _isDirty = true;
#region Constructors
public Snapshot()
{
}
#endregion
#region Properties
public string Title { get; set; }
public string Category { get; set; }
public DateTime Created { get; set; }
public string[] Keys
{
get { return _dataKeys; }
}
#endregion
#region Methods
public override string ToString()
{
return $"{Title} (Category = {Category})";
}
public async Task<string> GetContentHashAsync()
{
if (string.IsNullOrWhiteSpace(_contentHash))
{
await GetAllBytesAsync();
}
return _contentHash;
}
public async Task InitializeFromBytesAsync(byte[] bytes)
{
Argument.IsNotNull(() => bytes);
_data.Clear();
var data = await LoadSnapshotDataAsync(bytes);
foreach (var dataItem in data)
{
_data[dataItem.Key] = dataItem.Value;
}
_dataKeys = _data.Keys.ToArray();
_contentHash = null;
_isDirty = true;
}
public async Task<byte[]> GetAllBytesAsync()
{
if (_isDirty)
{
Log.Debug($"Data for '{this}' is outdated, generating new data");
_allData = await SaveSnapshotDataAsync(_data.ToList());
_contentHash = Md5Helper.ComputeMd5(_allData);
}
return _allData;
}
public byte[] GetData(string key)
{
Argument.IsNotNullOrWhitespace(() => key);
lock (_data)
{
byte[] data;
if (!_data.TryGetValue(key, out data))
{
Log.Warning($"Key '{key}' not found in snapshot");
}
return data;
}
}
public void SetData(string key, byte[] data)
{
Argument.IsNotNullOrWhitespace(() => key);
lock (_data)
{
_data[key] = data;
_contentHash = null;
_isDirty = true;
}
}
public void ClearData(string key)
{
SetData(key, null);
}
protected virtual async Task<List<KeyValuePair<string, byte[]>>> LoadSnapshotDataAsync(byte[] bytes)
{
var data = new List<KeyValuePair<string, byte[]>>();
_contentHash = string.Empty;
using (var memoryStream = new MemoryStream(bytes))
{
using (var zipFile = ZipFile.Read(memoryStream))
{
foreach (var entry in zipFile.Entries)
{
var fileName = entry.FileName;
var key = fileName.Substring(0, fileName.Length - InternalFileExtension.Length).Replace("/", "\\");
var dataBytes = entry.GetBytes();
data.Add(new KeyValuePair<string, byte[]>(key, dataBytes));
}
}
}
return data;
}
protected virtual async Task<byte[]> SaveSnapshotDataAsync(List<KeyValuePair<string, byte[]>> data)
{
using (var memoryStream = new MemoryStream())
{
// Note: unfortunately not yet fully async, we could rewrite this to ZipOutputStream if that would make sense
using (var zip = new ZipFile())
{
zip.CompressionLevel = CompressionLevel.BestSpeed;
foreach (var dataItem in data)
{
var bytes = dataItem.Value;
// Even store empty data
if (bytes is null)
{
bytes = new byte[] { };
}
zip.AddEntry($"{dataItem.Key}{InternalFileExtension}", bytes);
}
zip.Save(memoryStream);
}
var allBytes = memoryStream.ToArray();
return allBytes;
}
}
#endregion
}
}
| 28.719577 | 125 | 0.47255 | [
"MIT"
] | WildGums/Orc.Snapshots | src/Orc.Snapshots/Models/Snapshot.cs | 5,430 | C# |
namespace DiscordBot{
public interface ILogger
{
void LogLine(string line);
}
} | 16.5 | 34 | 0.626263 | [
"MIT"
] | joefroh/JetsDiscordBot | DiscordBot/ILogger.cs | 99 | C# |
using System.Collections.Generic;
using Newtonsoft.Json;
namespace Stripe
{
public class StripeInvoiceItemUpdateOptions
{
[JsonProperty("amount")]
public int? Amount { get; set; }
[JsonProperty("description")]
public string Description { get; set; }
[JsonProperty("currency")]
public string Currency { get; set; }
[JsonProperty("discountable")]
public bool Discountable { get; set; }
[JsonProperty("metadata")]
public Dictionary<string, string> Metadata { get; set; }
}
}
| 23.75 | 64 | 0.622807 | [
"Apache-2.0"
] | HilalRather/stripe.net | src/Stripe.net/Services/InvoiceItems/StripeInvoiceItemUpdateOptions.cs | 572 | C# |
using System;
namespace org.apache.lucene.analysis.path
{
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using MappingCharFilter = org.apache.lucene.analysis.charfilter.MappingCharFilter;
using NormalizeCharMap = org.apache.lucene.analysis.charfilter.NormalizeCharMap;
public class TestPathHierarchyTokenizer : BaseTokenStreamTestCase
{
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testBasic() throws Exception
public virtual void testBasic()
{
string path = "/a/b/c";
PathHierarchyTokenizer t = new PathHierarchyTokenizer(new StringReader(path));
assertTokenStreamContents(t, new string[]{"/a", "/a/b", "/a/b/c"}, new int[]{0, 0, 0}, new int[]{2, 4, 6}, new int[]{1, 0, 0}, path.Length);
}
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testEndOfDelimiter() throws Exception
public virtual void testEndOfDelimiter()
{
string path = "/a/b/c/";
PathHierarchyTokenizer t = new PathHierarchyTokenizer(new StringReader(path));
assertTokenStreamContents(t, new string[]{"/a", "/a/b", "/a/b/c", "/a/b/c/"}, new int[]{0, 0, 0, 0}, new int[]{2, 4, 6, 7}, new int[]{1, 0, 0, 0}, path.Length);
}
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testStartOfChar() throws Exception
public virtual void testStartOfChar()
{
string path = "a/b/c";
PathHierarchyTokenizer t = new PathHierarchyTokenizer(new StringReader(path));
assertTokenStreamContents(t, new string[]{"a", "a/b", "a/b/c"}, new int[]{0, 0, 0}, new int[]{1, 3, 5}, new int[]{1, 0, 0}, path.Length);
}
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testStartOfCharEndOfDelimiter() throws Exception
public virtual void testStartOfCharEndOfDelimiter()
{
string path = "a/b/c/";
PathHierarchyTokenizer t = new PathHierarchyTokenizer(new StringReader(path));
assertTokenStreamContents(t, new string[]{"a", "a/b", "a/b/c", "a/b/c/"}, new int[]{0, 0, 0, 0}, new int[]{1, 3, 5, 6}, new int[]{1, 0, 0, 0}, path.Length);
}
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testOnlyDelimiter() throws Exception
public virtual void testOnlyDelimiter()
{
string path = "/";
PathHierarchyTokenizer t = new PathHierarchyTokenizer(new StringReader(path));
assertTokenStreamContents(t, new string[]{"/"}, new int[]{0}, new int[]{1}, new int[]{1}, path.Length);
}
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testOnlyDelimiters() throws Exception
public virtual void testOnlyDelimiters()
{
string path = "//";
PathHierarchyTokenizer t = new PathHierarchyTokenizer(new StringReader(path));
assertTokenStreamContents(t, new string[]{"/", "//"}, new int[]{0, 0}, new int[]{1, 2}, new int[]{1, 0}, path.Length);
}
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testReplace() throws Exception
public virtual void testReplace()
{
string path = "/a/b/c";
PathHierarchyTokenizer t = new PathHierarchyTokenizer(new StringReader(path), '/', '\\');
assertTokenStreamContents(t, new string[]{"\\a", "\\a\\b", "\\a\\b\\c"}, new int[]{0, 0, 0}, new int[]{2, 4, 6}, new int[]{1, 0, 0}, path.Length);
}
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testWindowsPath() throws Exception
public virtual void testWindowsPath()
{
string path = "c:\\a\\b\\c";
PathHierarchyTokenizer t = new PathHierarchyTokenizer(new StringReader(path), '\\', '\\');
assertTokenStreamContents(t, new string[]{"c:", "c:\\a", "c:\\a\\b", "c:\\a\\b\\c"}, new int[]{0, 0, 0, 0}, new int[]{2, 4, 6, 8}, new int[]{1, 0, 0, 0}, path.Length);
}
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testNormalizeWinDelimToLinuxDelim() throws Exception
public virtual void testNormalizeWinDelimToLinuxDelim()
{
NormalizeCharMap.Builder builder = new NormalizeCharMap.Builder();
builder.add("\\", "/");
NormalizeCharMap normMap = builder.build();
string path = "c:\\a\\b\\c";
Reader cs = new MappingCharFilter(normMap, new StringReader(path));
PathHierarchyTokenizer t = new PathHierarchyTokenizer(cs);
assertTokenStreamContents(t, new string[]{"c:", "c:/a", "c:/a/b", "c:/a/b/c"}, new int[]{0, 0, 0, 0}, new int[]{2, 4, 6, 8}, new int[]{1, 0, 0, 0}, path.Length);
}
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testBasicSkip() throws Exception
public virtual void testBasicSkip()
{
string path = "/a/b/c";
PathHierarchyTokenizer t = new PathHierarchyTokenizer(new StringReader(path), 1);
assertTokenStreamContents(t, new string[]{"/b", "/b/c"}, new int[]{2, 2}, new int[]{4, 6}, new int[]{1, 0}, path.Length);
}
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testEndOfDelimiterSkip() throws Exception
public virtual void testEndOfDelimiterSkip()
{
string path = "/a/b/c/";
PathHierarchyTokenizer t = new PathHierarchyTokenizer(new StringReader(path), 1);
assertTokenStreamContents(t, new string[]{"/b", "/b/c", "/b/c/"}, new int[]{2, 2, 2}, new int[]{4, 6, 7}, new int[]{1, 0, 0}, path.Length);
}
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testStartOfCharSkip() throws Exception
public virtual void testStartOfCharSkip()
{
string path = "a/b/c";
PathHierarchyTokenizer t = new PathHierarchyTokenizer(new StringReader(path), 1);
assertTokenStreamContents(t, new string[]{"/b", "/b/c"}, new int[]{1, 1}, new int[]{3, 5}, new int[]{1, 0}, path.Length);
}
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testStartOfCharEndOfDelimiterSkip() throws Exception
public virtual void testStartOfCharEndOfDelimiterSkip()
{
string path = "a/b/c/";
PathHierarchyTokenizer t = new PathHierarchyTokenizer(new StringReader(path), 1);
assertTokenStreamContents(t, new string[]{"/b", "/b/c", "/b/c/"}, new int[]{1, 1, 1}, new int[]{3, 5, 6}, new int[]{1, 0, 0}, path.Length);
}
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testOnlyDelimiterSkip() throws Exception
public virtual void testOnlyDelimiterSkip()
{
string path = "/";
PathHierarchyTokenizer t = new PathHierarchyTokenizer(new StringReader(path), 1);
assertTokenStreamContents(t, new string[]{}, new int[]{}, new int[]{}, new int[]{}, path.Length);
}
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testOnlyDelimitersSkip() throws Exception
public virtual void testOnlyDelimitersSkip()
{
string path = "//";
PathHierarchyTokenizer t = new PathHierarchyTokenizer(new StringReader(path), 1);
assertTokenStreamContents(t, new string[]{"/"}, new int[]{1}, new int[]{2}, new int[]{1}, path.Length);
}
/// <summary>
/// blast some random strings through the analyzer </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testRandomStrings() throws Exception
public virtual void testRandomStrings()
{
Analyzer a = new AnalyzerAnonymousInnerClassHelper(this);
checkRandomData(random(), a, 1000 * RANDOM_MULTIPLIER);
}
private class AnalyzerAnonymousInnerClassHelper : Analyzer
{
private readonly TestPathHierarchyTokenizer outerInstance;
public AnalyzerAnonymousInnerClassHelper(TestPathHierarchyTokenizer outerInstance)
{
this.outerInstance = outerInstance;
}
protected internal override TokenStreamComponents createComponents(string fieldName, Reader reader)
{
Tokenizer tokenizer = new PathHierarchyTokenizer(reader);
return new TokenStreamComponents(tokenizer, tokenizer);
}
}
/// <summary>
/// blast some random large strings through the analyzer </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void testRandomHugeStrings() throws Exception
public virtual void testRandomHugeStrings()
{
Random random = random();
Analyzer a = new AnalyzerAnonymousInnerClassHelper2(this);
checkRandomData(random, a, 100 * RANDOM_MULTIPLIER, 1027);
}
private class AnalyzerAnonymousInnerClassHelper2 : Analyzer
{
private readonly TestPathHierarchyTokenizer outerInstance;
public AnalyzerAnonymousInnerClassHelper2(TestPathHierarchyTokenizer outerInstance)
{
this.outerInstance = outerInstance;
}
protected internal override TokenStreamComponents createComponents(string fieldName, Reader reader)
{
Tokenizer tokenizer = new PathHierarchyTokenizer(reader);
return new TokenStreamComponents(tokenizer, tokenizer);
}
}
}
} | 44.896861 | 169 | 0.707651 | [
"Apache-2.0"
] | mdissel/lucene.net | src/Lucene.Net.Tests.Analysis.Common/Analysis/Path/TestPathHierarchyTokenizer.cs | 10,014 | C# |
// Copyright 2004-2011 Castle Project - http://www.castleproject.org/
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
namespace Castle.DynamicProxy.Generators.Emitters.SimpleAST
{
using System;
using System.Diagnostics;
using System.Reflection.Emit;
[DebuggerDisplay("&{localReference}")]
public class ByRefReference : TypeReference
{
private readonly LocalReference localReference;
public ByRefReference(LocalReference localReference)
: base(localReference.Type)
{
this.localReference = localReference;
}
public override void LoadAddressOfReference(ILGenerator gen)
{
localReference.LoadAddressOfReference(gen);
}
public override void LoadReference(ILGenerator gen)
{
localReference.LoadAddressOfReference(gen);
}
public override void StoreReference(ILGenerator gen)
{
throw new NotImplementedException();
}
}
} | 29.729167 | 76 | 0.733707 | [
"Apache-2.0"
] | balefrost/CastleProject.Core | src/Castle.Core/DynamicProxy/Generators/Emitters/SimpleAST/ByRefReference.cs | 1,427 | C# |
// *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
using Pulumi.Utilities;
namespace Pulumi.GoogleNative.Apigee.V1
{
public static class GetArchiveDeployment
{
/// <summary>
/// Gets the specified ArchiveDeployment.
/// </summary>
public static Task<GetArchiveDeploymentResult> InvokeAsync(GetArchiveDeploymentArgs args, InvokeOptions? options = null)
=> Pulumi.Deployment.Instance.InvokeAsync<GetArchiveDeploymentResult>("google-native:apigee/v1:getArchiveDeployment", args ?? new GetArchiveDeploymentArgs(), options.WithVersion());
/// <summary>
/// Gets the specified ArchiveDeployment.
/// </summary>
public static Output<GetArchiveDeploymentResult> Invoke(GetArchiveDeploymentInvokeArgs args, InvokeOptions? options = null)
=> Pulumi.Deployment.Instance.Invoke<GetArchiveDeploymentResult>("google-native:apigee/v1:getArchiveDeployment", args ?? new GetArchiveDeploymentInvokeArgs(), options.WithVersion());
}
public sealed class GetArchiveDeploymentArgs : Pulumi.InvokeArgs
{
[Input("archiveDeploymentId", required: true)]
public string ArchiveDeploymentId { get; set; } = null!;
[Input("environmentId", required: true)]
public string EnvironmentId { get; set; } = null!;
[Input("organizationId", required: true)]
public string OrganizationId { get; set; } = null!;
public GetArchiveDeploymentArgs()
{
}
}
public sealed class GetArchiveDeploymentInvokeArgs : Pulumi.InvokeArgs
{
[Input("archiveDeploymentId", required: true)]
public Input<string> ArchiveDeploymentId { get; set; } = null!;
[Input("environmentId", required: true)]
public Input<string> EnvironmentId { get; set; } = null!;
[Input("organizationId", required: true)]
public Input<string> OrganizationId { get; set; } = null!;
public GetArchiveDeploymentInvokeArgs()
{
}
}
[OutputType]
public sealed class GetArchiveDeploymentResult
{
/// <summary>
/// The time at which the Archive Deployment was created in milliseconds since the epoch.
/// </summary>
public readonly string CreatedAt;
/// <summary>
/// Input only. The Google Cloud Storage signed URL returned from GenerateUploadUrl and used to upload the Archive zip file.
/// </summary>
public readonly string GcsUri;
/// <summary>
/// User-supplied key-value pairs used to organize ArchiveDeployments. Label keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: \p{Ll}\p{Lo}{0,62} Label values must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}_-]{0,63} No more than 64 labels can be associated with a given store.
/// </summary>
public readonly ImmutableDictionary<string, string> Labels;
/// <summary>
/// Name of the Archive Deployment in the following format: `organizations/{org}/environments/{env}/archiveDeployments/{id}`.
/// </summary>
public readonly string Name;
/// <summary>
/// A reference to the LRO that created this Archive Deployment in the following format: `organizations/{org}/operations/{id}`
/// </summary>
public readonly string Operation;
/// <summary>
/// The time at which the Archive Deployment was updated in milliseconds since the epoch.
/// </summary>
public readonly string UpdatedAt;
[OutputConstructor]
private GetArchiveDeploymentResult(
string createdAt,
string gcsUri,
ImmutableDictionary<string, string> labels,
string name,
string operation,
string updatedAt)
{
CreatedAt = createdAt;
GcsUri = gcsUri;
Labels = labels;
Name = name;
Operation = operation;
UpdatedAt = updatedAt;
}
}
}
| 39.59292 | 500 | 0.653554 | [
"Apache-2.0"
] | AaronFriel/pulumi-google-native | sdk/dotnet/Apigee/V1/GetArchiveDeployment.cs | 4,474 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FantasyData.Soccer.Entities
{
public class Venues : List<Venue> { }
public class Venue
{
public int VenueId { get; set; }
public string Name { get; set; }
public string Address { get; set; }
public string City { get; set; }
public string Zip { get; set; }
public string Country { get; set; }
public bool Open { get; set; }
public int? Opened { get; set; }
public string Nickname1 { get; set; }
public string Nickname2 { get; set; }
public int? Capacity { get; set; }
public string Surface { get; set; }
public decimal? GeoLat { get; set; }
public decimal? GeoLong { get; set; }
}
}
| 29.928571 | 45 | 0.599045 | [
"MIT"
] | pzadafiya/FantasyDataAPI | Soccer/FantasyData.Soccer.Entities/Venue.cs | 840 | C# |
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace DAL.Migrations
{
public partial class Initial : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Authors",
columns: table => new
{
AuthorId = table.Column<int>(nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
CreatedBy = table.Column<string>(nullable: true),
UpdatedBy = table.Column<string>(nullable: true),
CreatedDate = table.Column<DateTime>(nullable: false),
UpdatedDate = table.Column<DateTime>(nullable: false),
AuthorName = table.Column<string>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Authors", x => x.AuthorId);
});
migrationBuilder.CreateTable(
name: "Genres",
columns: table => new
{
GenreId = table.Column<int>(nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
CreatedBy = table.Column<string>(nullable: true),
UpdatedBy = table.Column<string>(nullable: true),
CreatedDate = table.Column<DateTime>(nullable: false),
UpdatedDate = table.Column<DateTime>(nullable: false),
GenreName = table.Column<string>(maxLength: 40, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Genres", x => x.GenreId);
});
migrationBuilder.CreateTable(
name: "ImageCovers",
columns: table => new
{
ImageCoverId = table.Column<int>(nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
CreatedBy = table.Column<string>(nullable: true),
UpdatedBy = table.Column<string>(nullable: true),
CreatedDate = table.Column<DateTime>(nullable: false),
UpdatedDate = table.Column<DateTime>(nullable: false),
ImgCoverName = table.Column<string>(maxLength: 40, nullable: false),
ImgCoverUrl = table.Column<string>(maxLength: 256, nullable: true),
ImgCoverDescription = table.Column<string>(maxLength: 500, nullable: true),
GameId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ImageCovers", x => x.ImageCoverId);
});
migrationBuilder.CreateTable(
name: "ImageGameLogos",
columns: table => new
{
ImageGameLogoId = table.Column<int>(nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
CreatedBy = table.Column<string>(nullable: true),
UpdatedBy = table.Column<string>(nullable: true),
CreatedDate = table.Column<DateTime>(nullable: false),
UpdatedDate = table.Column<DateTime>(nullable: false),
ImgGameLogoName = table.Column<string>(maxLength: 40, nullable: false),
ImgGameLogoUrl = table.Column<string>(maxLength: 256, nullable: true),
ImgGameLogoDescription = table.Column<string>(maxLength: 500, nullable: true),
GameId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ImageGameLogos", x => x.ImageGameLogoId);
});
migrationBuilder.CreateTable(
name: "Platforms",
columns: table => new
{
PlatformId = table.Column<int>(nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
CreatedBy = table.Column<string>(nullable: true),
UpdatedBy = table.Column<string>(nullable: true),
CreatedDate = table.Column<DateTime>(nullable: false),
UpdatedDate = table.Column<DateTime>(nullable: false),
PlatformName = table.Column<string>(maxLength: 40, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Platforms", x => x.PlatformId);
});
migrationBuilder.CreateTable(
name: "Games",
columns: table => new
{
GameId = table.Column<int>(nullable: false),
CreatedBy = table.Column<string>(nullable: true),
UpdatedBy = table.Column<string>(nullable: true),
CreatedDate = table.Column<DateTime>(nullable: false),
UpdatedDate = table.Column<DateTime>(nullable: false),
GameName = table.Column<string>(nullable: false),
GameDescription = table.Column<string>(nullable: true),
ImageCoverId = table.Column<int>(nullable: false),
ImageGameLogoId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Games", x => x.GameId);
table.ForeignKey(
name: "FK_Games_ImageCovers_GameId",
column: x => x.GameId,
principalTable: "ImageCovers",
principalColumn: "ImageCoverId",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Games_ImageGameLogos_GameId",
column: x => x.GameId,
principalTable: "ImageGameLogos",
principalColumn: "ImageGameLogoId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "GamesGenres",
columns: table => new
{
GameId = table.Column<int>(nullable: false),
GenreId = table.Column<int>(nullable: false),
CreatedBy = table.Column<string>(nullable: true),
UpdatedBy = table.Column<string>(nullable: true),
CreatedDate = table.Column<DateTime>(nullable: false),
UpdatedDate = table.Column<DateTime>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_GamesGenres", x => new { x.GameId, x.GenreId });
table.ForeignKey(
name: "FK_GamesGenres_Games_GameId",
column: x => x.GameId,
principalTable: "Games",
principalColumn: "GameId",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_GamesGenres_Genres_GenreId",
column: x => x.GenreId,
principalTable: "Genres",
principalColumn: "GenreId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "GamesPlatforms",
columns: table => new
{
GameId = table.Column<int>(nullable: false),
PlatformId = table.Column<int>(nullable: false),
CreatedBy = table.Column<string>(nullable: true),
UpdatedBy = table.Column<string>(nullable: true),
CreatedDate = table.Column<DateTime>(nullable: false),
UpdatedDate = table.Column<DateTime>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_GamesPlatforms", x => new { x.GameId, x.PlatformId });
table.ForeignKey(
name: "FK_GamesPlatforms_Games_GameId",
column: x => x.GameId,
principalTable: "Games",
principalColumn: "GameId",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_GamesPlatforms_Platforms_PlatformId",
column: x => x.PlatformId,
principalTable: "Platforms",
principalColumn: "PlatformId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Images",
columns: table => new
{
ImageId = table.Column<int>(nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
CreatedBy = table.Column<string>(nullable: true),
UpdatedBy = table.Column<string>(nullable: true),
CreatedDate = table.Column<DateTime>(nullable: false),
UpdatedDate = table.Column<DateTime>(nullable: false),
ImgName = table.Column<string>(maxLength: 40, nullable: false),
ImgUrl = table.Column<string>(maxLength: 256, nullable: true),
ImgDescription = table.Column<string>(maxLength: 500, nullable: true),
GameId = table.Column<int>(nullable: false),
PlatformId = table.Column<int>(nullable: false),
AuthorId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Images", x => x.ImageId);
table.ForeignKey(
name: "FK_Images_Authors_AuthorId",
column: x => x.AuthorId,
principalTable: "Authors",
principalColumn: "AuthorId",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Images_Games_GameId",
column: x => x.GameId,
principalTable: "Games",
principalColumn: "GameId",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Images_Platforms_PlatformId",
column: x => x.PlatformId,
principalTable: "Platforms",
principalColumn: "PlatformId",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_GamesGenres_GenreId",
table: "GamesGenres",
column: "GenreId");
migrationBuilder.CreateIndex(
name: "IX_GamesPlatforms_PlatformId",
table: "GamesPlatforms",
column: "PlatformId");
migrationBuilder.CreateIndex(
name: "IX_Images_AuthorId",
table: "Images",
column: "AuthorId");
migrationBuilder.CreateIndex(
name: "IX_Images_GameId",
table: "Images",
column: "GameId");
migrationBuilder.CreateIndex(
name: "IX_Images_PlatformId",
table: "Images",
column: "PlatformId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "GamesGenres");
migrationBuilder.DropTable(
name: "GamesPlatforms");
migrationBuilder.DropTable(
name: "Images");
migrationBuilder.DropTable(
name: "Genres");
migrationBuilder.DropTable(
name: "Authors");
migrationBuilder.DropTable(
name: "Games");
migrationBuilder.DropTable(
name: "Platforms");
migrationBuilder.DropTable(
name: "ImageCovers");
migrationBuilder.DropTable(
name: "ImageGameLogos");
}
}
}
| 45.129825 | 98 | 0.484062 | [
"MIT"
] | marcvil/VideogameArtGallery | DAL/Migrations/20200914094144_Initial.cs | 12,864 | C# |
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
// Ported from um/d3d12.h in the Windows SDK for Windows 10.0.20348.0
// Original source is Copyright © Microsoft. All rights reserved.
using System;
namespace TerraFX.Interop
{
[Flags]
public enum D3D12_PIPELINE_STATE_FLAGS
{
D3D12_PIPELINE_STATE_FLAG_NONE = 0,
D3D12_PIPELINE_STATE_FLAG_TOOL_DEBUG = 0x1,
}
}
| 28.941176 | 145 | 0.737805 | [
"MIT"
] | DaZombieKiller/terrafx.interop.windows | sources/Interop/Windows/um/d3d12/D3D12_PIPELINE_STATE_FLAGS.cs | 494 | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.