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
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Http.Authentication; using Microsoft.AspNetCore.Identity; namespace AspRPG.Models.ManageViewModels { public class ManageLoginsViewModel { public IList<UserLoginInfo> CurrentLogins { get; set; } public IList<AuthenticationDescription> OtherLogins { get; set; } } }
24.647059
73
0.761337
[ "MIT" ]
dr4gonz/AspRPG
src/AspRPG/Models/ManageViewModels/ManageLoginsViewModel.cs
421
C#
using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Voodoo.Reports.Tests.Rendering { [TestClass] public class ReportWithTooManyCellsTest : BaseTest { [TestMethod, ExpectedException(typeof(TooManyCellsException))] public void RenderReport_ValidData_IsOk() { var data = base.GetData(); var report = new ReportWithTooManyCells(); report.Build(data); base.WriteFile(report); } public override string Name => "ReportWithTooManyCellsTest"; } }
29.157895
70
0.655235
[ "MIT" ]
MiniverCheevy/voodoo-reports
Voodoo.Reports.Tests/Rendering/ReportWithTooManyCellsTest.cs
556
C#
// *********************************************************************** // Assembly : EveLib.EveMarketData // Author : Lars Kristian // Created : 03-06-2014 // // Last Modified By : Lars Kristian // Last Modified On : 06-19-2014 // *********************************************************************** // <copyright file="EmdItemPricesJsonConverter.cs" company=""> // Copyright (c) . All rights reserved. // </copyright> // <summary></summary> // *********************************************************************** using System; using eZet.EveLib.EveMarketDataModule.Models; using Newtonsoft.Json; namespace eZet.EveLib.EveMarketDataModule.JsonConverters { /// <summary> /// Class EmdItemPricesJsonConverter. /// </summary> public class EmdItemPricesJsonConverter : JsonConverter { /// <summary> /// Writes the JSON representation of the object. /// </summary> /// <param name="writer">The <see cref="T:Newtonsoft.Json.JsonWriter" /> to write to.</param> /// <param name="value">The value.</param> /// <param name="serializer">The calling serializer.</param> /// <exception cref="System.NotImplementedException"></exception> public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { throw new NotImplementedException(); } /// <summary> /// Reads the JSON representation of the object. /// </summary> /// <param name="reader">The <see cref="T:Newtonsoft.Json.JsonReader" /> to read from.</param> /// <param name="objectType">Type of the object.</param> /// <param name="existingValue">The existing value of object being read.</param> /// <param name="serializer">The calling serializer.</param> /// <returns>The object value.</returns> public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { var result = new ItemPrices(); serializer.Converters.Add(new EmdRowCollectionJsonConverter<ItemPrices.ItemPriceEntry>()); result.Prices = serializer.Deserialize<EmdRowCollection<ItemPrices.ItemPriceEntry>>(reader); return result; } /// <summary> /// Determines whether this instance can convert the specified object type. /// </summary> /// <param name="objectType">Type of the object.</param> /// <returns> /// <c>true</c> if this instance can convert the specified object type; otherwise, /// <c>false</c>. /// </returns> /// <exception cref="System.NotImplementedException"></exception> public override bool CanConvert(Type objectType) { throw new NotImplementedException(); } } }
45.078125
104
0.578856
[ "Apache-2.0" ]
ezet/evelib
EveLib.EveMarketData/JsonConverters/EmdItemPricesJsonConverter.cs
2,887
C#
// // DiagramMark.cs // // Author: // Jon Thysell <thysell@gmail.com> // // Copyright (c) 2015, 2016, 2017, 2018, 2019, 2020, 2021 Jon Thysell <http://jonthysell.com> // // 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. using System; using System.Globalization; using System.Xml; namespace Chordious.Core { public class DiagramMark : DiagramElement { public new MarkPosition Position { get { return (MarkPosition)base.Position; } set { base.Position = value; } } public DiagramMarkType Type { get { return MarkStyle.MarkType; } set { MarkStyle.MarkType = value; } } public DiagramMarkStyleWrapper MarkStyle { get; private set; } public DiagramMark(Diagram parent, MarkPosition position, string text = "") : base(parent, position, text) { MarkStyle = new DiagramMarkStyleWrapper(Style, position.Fret > parent.NumFrets ? DiagramMarkType.Bottom : DiagramMarkType.Normal); } public DiagramMark(Diagram parent, XmlReader xmlReader) : base(parent) { MarkStyle = new DiagramMarkStyleWrapper(Style); Read(xmlReader); } public override bool IsVisible() { return (MarkStyle.MarkVisible && MarkStyle.MarkShape != DiagramMarkShape.None) || (MarkStyle.MarkTextVisible && !StringUtils.IsNullOrWhiteSpace(Text)); } public bool IsAboveTopEdge() { return (Position.Fret == 0); } public bool IsBelowBottomEdge() { return (Position.Fret == Parent.NumFrets + 1); } public override sealed void Read(XmlReader xmlReader) { if (null == xmlReader) { throw new ArgumentNullException(nameof(xmlReader)); } using (xmlReader) { if (xmlReader.IsStartElement() && xmlReader.Name == "mark") { Text = xmlReader.GetAttribute("text"); Type = (DiagramMarkType)Enum.Parse(typeof(DiagramMarkType), xmlReader.GetAttribute("type")); int @string = int.Parse(xmlReader.GetAttribute("string")); int fret = int.Parse(xmlReader.GetAttribute("fret")); Position = new MarkPosition(@string, fret); while (xmlReader.Read()) { if (xmlReader.IsStartElement() && xmlReader.Name == "style") { Style.Read(xmlReader.ReadSubtree()); } } } } } public override void Write(XmlWriter xmlWriter) { if (null == xmlWriter) { throw new ArgumentNullException(nameof(xmlWriter)); } xmlWriter.WriteStartElement("mark"); xmlWriter.WriteAttributeString("text", Text); xmlWriter.WriteAttributeString("type", Type.ToString()); xmlWriter.WriteAttributeString("string", Position.String.ToString()); xmlWriter.WriteAttributeString("fret", Position.Fret.ToString()); string prefix = DiagramStyle.GetMarkStylePrefix(Type); // Only write the styles that apply to the type of this mark Style.Write(xmlWriter, prefix + "mark"); xmlWriter.WriteEndElement(); } public override string ToSvg() { string svg = ""; if (IsVisible()) { string prefix = DiagramStyle.GetMarkStylePrefix(Type); DiagramMarkShape shape = MarkStyle.MarkShape; double radius = MarkStyle.MarkRadiusRatio * 0.5 * Math.Min(Parent.Style.GridStringSpacing, Parent.Style.GridFretSpacing); double centerX = Parent.GridLeftEdge() + (Parent.Style.GridStringSpacing * (Position.String - 1)); double centerY = Parent.GridTopEdge() + (Parent.Style.GridFretSpacing / 2.0) + (Parent.Style.GridFretSpacing * (Position.Fret - 1)); // Draw shape if (MarkStyle.MarkVisible && MarkStyle.MarkShape != DiagramMarkShape.None) { string shapeStyle = Style.GetSvgStyle(_shapeStyleMap, prefix); if (MarkStyle.MarkBorderThickness > 0) { shapeStyle += Style.GetSvgStyle(_shapeStyleMapBorder, prefix); } switch (shape) { case DiagramMarkShape.Circle: svg += string.Format(CultureInfo.InvariantCulture, SvgConstants.CIRCLE, shapeStyle, radius, centerX, centerY); break; case DiagramMarkShape.Square: svg += string.Format(CultureInfo.InvariantCulture, SvgConstants.RECTANGLE, shapeStyle, radius * 2.0, radius * 2.0, centerX - radius, centerY - radius); break; case DiagramMarkShape.Diamond: string diamondPoints = ""; for (int i = 0; i < 4; i++) { double angle = (i * 90.0) * (Math.PI / 180.0); diamondPoints += string.Format(CultureInfo.InvariantCulture, "{0},{1} ", centerX + (radius * Math.Cos(angle)), centerY + (radius * Math.Sin(angle))); } svg += string.Format(CultureInfo.InvariantCulture, SvgConstants.POLYGON, shapeStyle, diamondPoints); break; case DiagramMarkShape.X: string xPoints = ""; for (int i = 0; i < 4; i++) { double angle = (45.0 + (i * 90.0)); double rad0 = (angle - 45.0) * (Math.PI / 180.0); // Starting close point double len0 = Math.Sqrt(2 * Math.Pow(radius * Math.Sin(XThicknessAngle), 2)); xPoints += string.Format(CultureInfo.InvariantCulture, "{0},{1} ", centerX + (len0 * Math.Cos(rad0)), centerY + (len0 * Math.Sin(rad0))); double rad1 = (angle * (Math.PI / 180.0)) - XThicknessAngle; // First far corner xPoints += string.Format(CultureInfo.InvariantCulture, "{0},{1} ", centerX + (radius * Math.Cos(rad1)), centerY + (radius * Math.Sin(rad1))); double rad2 = (angle * (Math.PI / 180.0)) + XThicknessAngle; // Second far corner xPoints += string.Format(CultureInfo.InvariantCulture, "{0},{1} ", centerX + (radius * Math.Cos(rad2)), centerY + (radius * Math.Sin(rad2))); } svg += string.Format(CultureInfo.InvariantCulture, SvgConstants.POLYGON, shapeStyle, xPoints.Trim()); break; case DiagramMarkShape.None: default: break; } } // Draw text if (MarkStyle.MarkTextVisible && !StringUtils.IsNullOrWhiteSpace(Text)) { double textSize = radius * 2.0 * MarkStyle.MarkTextSizeRatio; double textX = centerX; double textY = centerY; switch (MarkStyle.MarkTextAlignment) { case DiagramHorizontalAlignment.Left: textX += (Parent.Style.Orientation == DiagramOrientation.LeftRight) ? -1.0 * textSize * 0.5 : -1.0 * radius; // D <-> U : L <-> R textY += (Parent.Style.Orientation == DiagramOrientation.LeftRight) ? -1.0 * radius : textSize * 0.5; // L <-> R : U <-> D break; case DiagramHorizontalAlignment.Center: textX += (Parent.Style.Orientation == DiagramOrientation.LeftRight) ? -1.0 * textSize * 0.5 : 0; // D <-> U : L <-> R textY += (Parent.Style.Orientation == DiagramOrientation.LeftRight) ? 0 : textSize * 0.5; // L <-> R : U <-> D break; case DiagramHorizontalAlignment.Right: textX += (Parent.Style.Orientation == DiagramOrientation.LeftRight) ? -1.0 * textSize * 0.5 : radius; // D <-> U : L <-> R textY += (Parent.Style.Orientation == DiagramOrientation.LeftRight) ? radius : textSize * 0.5; // L <-> R : U <-> D break; } string textStyle = Style.GetSvgStyle(_textStyleMap, prefix); textStyle += string.Format(CultureInfo.InvariantCulture, "font-size:{0}pt;", textSize); string textFormat = (Parent.Style.Orientation == DiagramOrientation.LeftRight) ? SvgConstants.ROTATED_TEXT : SvgConstants.TEXT; svg += string.Format(CultureInfo.InvariantCulture, textFormat, textStyle, textX, textY, Text); } } return svg; } public override string ToXaml() { throw new NotImplementedException(); } private static readonly string[][] _shapeStyleMap = { new string[] {"mark.color", "fill"}, new string[] {"mark.opacity", "fill-opacity"}, }; private static readonly string[][] _shapeStyleMapBorder = { new string[] {"mark.bordercolor", "stroke"}, new string[] {"mark.borderthickness", "stroke-width"}, }; private static readonly string[][] _textStyleMap = { new string[] {"mark.textcolor", "fill"}, new string[] {"mark.textopacity", "opacity"}, new string[] {"mark.fontfamily", "font-family"}, new string[] {"mark.textalignment", "text-anchor"}, new string[] {"mark.textstyle", ""}, }; private const double XThicknessAngle = 5.7 * (Math.PI / 180.0); } public enum DiagramMarkType { Normal, Muted, Root, Open, OpenRoot, Bottom } }
42.172043
181
0.526007
[ "MIT" ]
jonthysell/Chordious
Chordious.Core/Diagramming/DiagramMark.cs
11,768
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("EnergyLoss")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("EnergyLoss")] [assembly: AssemblyCopyright("Copyright © 2017")] [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("4eb9c6be-eb9d-4cb9-9309-d964a1aa29e2")] // 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")]
37.513514
84
0.747118
[ "MIT" ]
dragobaltov/Programming-Basics-And-Fundamentals
EnergyLoss/EnergyLoss/Properties/AssemblyInfo.cs
1,391
C#
using ApplicationCore.Entities; using Microsoft.EntityFrameworkCore; using System.Reflection; namespace Infrastructure.Data { public class AppContext : DbContext { public AppContext(DbContextOptions<AppContext> options) : base(options) { } public DbSet<FoodProduct> FoodProducts { get; set; } public DbSet<UnitOfMeasure> UnitOfMeasures { get; set; } //protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) //{ // optionsBuilder.UseSqlServer( // "Data Source=.;Integrated Security=true;Initial Catalog=AppDb;"); // base.OnConfiguring(optionsBuilder); //} protected override void OnModelCreating(ModelBuilder builder) { base.OnModelCreating(builder); builder.ApplyConfigurationsFromAssembly(Assembly.GetExecutingAssembly()); } } }
31.655172
87
0.663399
[ "MIT" ]
StefanBalaban/CoreApp
src/Infrastructure/Data/AppContext.cs
920
C#
using System; using System.Collections.Generic; using BizHawk.Common; namespace BizHawk.Emulation.Cores.Computers.Commodore64.Cartridge { // This is a mapper used commonly by System 3. It is // also utilized by the short-lived C64 Game System. // Bank select is DExx. You select them by writing to the // register DE00+BankNr. For example, bank 01 is a write // to DE01. internal class Mapper000F : CartridgeDevice { private readonly int[][] _banks; // 8000 private int _bankMask; private int _bankNumber; private int[] _currentBank; public Mapper000F(IList<int> newAddresses, IList<int> newBanks, IList<int[]> newData) { var count = newAddresses.Count; pinGame = true; pinExRom = false; // build dummy bank var dummyBank = new int[0x2000]; for (var i = 0; i < 0x2000; i++) { dummyBank[i] = 0xFF; // todo: determine if this is correct } switch (count) { case 64: _bankMask = 0x3F; _banks = new int[64][]; break; case 32: _bankMask = 0x1F; _banks = new int[32][]; break; case 16: _bankMask = 0x0F; _banks = new int[16][]; break; case 8: _bankMask = 0x07; _banks = new int[8][]; break; case 4: _bankMask = 0x03; _banks = new int[4][]; break; case 2: _bankMask = 0x01; _banks = new int[2][]; break; case 1: _bankMask = 0x00; _banks = new int[1][]; break; default: throw new Exception("This looks like a System 3/C64GS cartridge but cannot be loaded..."); } // for safety, initialize all banks to dummy for (var i = 0; i < _banks.Length; i++) { _banks[i] = dummyBank; } // now load in the banks for (var i = 0; i < count; i++) { if (newAddresses[i] == 0x8000) { _banks[newBanks[i] & _bankMask] = newData[i]; } } BankSet(0); } protected override void SyncStateInternal(Serializer ser) { ser.Sync("BankMask", ref _bankMask); ser.Sync("BankNumber", ref _bankNumber); ser.Sync("CurrentBank", ref _currentBank, useNull: false); } protected void BankSet(int index) { _bankNumber = index & _bankMask; UpdateState(); } public override int Peek8000(int addr) { return _currentBank[addr]; } public override void PokeDE00(int addr, int val) { BankSet(addr); } public override int Read8000(int addr) { return _currentBank[addr]; } private void UpdateState() { _currentBank = _banks[_bankNumber]; } public override int ReadDE00(int addr) { BankSet(0); return 0; } public override void WriteDE00(int addr, int val) { BankSet(addr); } public override void SyncState(Serializer ser) { ser.Sync(nameof(_bankMask), ref _bankMask); ser.Sync(nameof(_bankNumber), ref _bankNumber); base.SyncState(ser); if (ser.IsReader) { BankSet(_bankNumber); } } } }
20.938356
96
0.595355
[ "MIT" ]
CartoonFan/BizHawk
src/BizHawk.Emulation.Cores/Computers/Commodore64/Cartridge/Mapper000F.cs
3,059
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Media; namespace Sketchball.Collision { /// <summary> /// Circle variant /// </summary> public class BoundingCircle : BoundingBox { public int radius{get; private set;} private int _originalRadius; private Vector _originalPosition; /// <summary> /// Creates new bounding circle /// </summary> /// <param name="radius">Radius of the bounding circle</param> /// <param name="position">position based on pinballElement</param> public BoundingCircle(int radius, Vector position) { this.radius = radius; this.Position = position+new Vector(radius,radius); _originalPosition = this.Position; _originalRadius = radius; } public override bool Intersect(IBoundingBox bB,out Vector hitPoint, Vector velocity ) { return bB.CircleIntersect(this,out hitPoint,velocity); } public override bool Intersect(IBoundingBox bB,out Vector hitPoint) { return bB.CircleIntersect(this,out hitPoint, new Vector(0,0)); } public override Vector Reflect(Vector vecIn, Vector hitPoint, Vector ballpos) { //circle => position = origin of object space coordinate system //=> normal to make reflection is from origin to hitpoint (hitpoint must be conferted to object space first) //TODO take position of bounding box into account Vector normal = hitPoint-(this.BoundingContainer.ParentElement.Location +this.Position); if (normal.X == 0 && normal.Y == 0) normal.Y = -1; normal.Normalize(); return ReflectVector(ref vecIn, ref normal); } public override Vector GetOutOfAreaPush(int diameterBall, Vector hitPoint, Vector velocity, Vector ballPos) { //TODO take bounding box position into account var vector = hitPoint - (this.BoundingContainer.ParentElement.Location + this.Position); vector.Normalize(); return (diameterBall / 1.9f) * vector; } public override void Rotate(double rad, Vector center) { Matrix rotation = new Matrix(); rotation.RotateAt((rad / Math.PI * 180f), center.X, center.Y); Point[] pts = new Point[2]; Vector p1 = this.Position; pts[0].X = p1.X; pts[0].Y = p1.Y; rotation.Transform(pts); p1.X = pts[0].X; p1.Y = pts[0].Y; this.Position = p1; } public override bool LineIntersect(BoundingLine bL, out Vector hitPoint) { //strategy: connect center of ball with start of line. calc where the normal from center of ball on line hits (pointNormalDirectionPice). If len from center of ball to this point //is smaller then radius then it is a hit. Should pointNormalDirectionPice be smaller then start - radius of ball or bigger then end+ radius of ball => ignore hitPoint = new Vector(0, 0); Vector bLWorldPos = bL.Position + bL.BoundingContainer.ParentElement.Location; Vector bLWorldTar = bL.target + bL.BoundingContainer.ParentElement.Location; Vector thisWorldPos = this.Position + this.BoundingContainer.ParentElement.Location ; Vector centerOfCircle = thisWorldPos; Vector directionLine = bLWorldTar - bLWorldPos; Vector normalLine = new Vector(-directionLine.Y, directionLine.X); double lenDirectionPiece = Vector.Multiply((centerOfCircle - bLWorldPos) , NormalizeVector(directionLine)); // Console.WriteLine(bL.position+" "+bL.target+" "+lenDirectionPiece); if (lenDirectionPiece < -this.radius || lenDirectionPiece >= (directionLine.Length+this.radius)) { return false; } Vector pointNormalDirectionPice = bLWorldPos + lenDirectionPiece * NormalizeVector(directionLine); Vector normalFromDirLineToCenter = centerOfCircle - pointNormalDirectionPice; double diff = normalFromDirLineToCenter.Length; if (diff < this.radius) { if (lenDirectionPiece < 0) { hitPoint = bLWorldPos; return true; } if (lenDirectionPiece > (directionLine.Length)) { hitPoint = bLWorldTar; return true; } //in this case T lies in the circle hitPoint = pointNormalDirectionPice; return true; } return false; } public override bool CircleIntersect(BoundingCircle bC, out Vector hitPoint, Vector velocity) { Vector thisWorldTras = this.BoundingContainer.ParentElement.Location; Vector bCWorldTrans = bC.BoundingContainer.ParentElement.Location; if (VectorDistance(bC.Position + bCWorldTrans, this.Position + thisWorldTras) < (this.radius + bC.radius)) { Vector direction = (-(bC.Position + bCWorldTrans) + (this.Position + thisWorldTras)); ; if (velocity != new Vector(0, 0)) { if (direction.X == 0 && direction.Y == 0) { direction = -velocity; } else if (direction.X * velocity.X >= 0 && direction.Y* velocity.Y >= 0) { //point in the same direction => reverse direction direction = -direction; } } if (direction.X == 0 && direction.Y == 0) { direction.X = 0; direction.Y = -1; } direction = NormalizeVector(direction); //hitPoint = bC.position + bCWorldTrans + Vector.Normalize(-(bC.position + bCWorldTrans) + (this.position + thisWorldTras)) * bC.radius hitPoint = bC.Position + bCWorldTrans + direction * bC.radius; return true; } hitPoint = new Vector(0, 0); return false; } public override void DrawDebug(System.Windows.Media.DrawingContext g, System.Windows.Media.Pen pen) { Vector pos = this.Position+this.BoundingContainer.ParentElement.Location; g.DrawEllipse(null, pen, new System.Windows.Point(pos.X, pos.Y ), (this.radius), (this.radius)); } public override IBoundingBox Clone() { //do not forget to assinge BoundingContainer after clone BoundingCircle bL = new BoundingCircle(this.radius, new Vector(this.Position.X - this.radius, this.Position.Y - this.radius)); return bL; } public override void Sync(Matrix matrix) { Point[] points = new Point[] { new Point(_originalPosition.X, _originalPosition.Y) }; matrix.Transform(points); Position = new Vector(points[0].X, points[0].Y); var vectors = new Vector[] { new Vector(_originalRadius, 0) }; matrix.Transform(vectors); radius = (int)new Vector(vectors[0].X, vectors[0].Y).Length; } } }
38.53
190
0.570984
[ "MIT" ]
EusthEnoptEron/Sketchball
Sketchball/Collision/BoundingCircle.cs
7,708
C#
//////////////////////////////////////////////////////////////////////////////// //NUnit tests for "EF Core Provider for LCPI OLE DB" // IBProvider and Contributors. 05.12.2020. using System; using System.Data; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using Microsoft.EntityFrameworkCore; using NUnit.Framework; using xdb=lcpi.data.oledb; namespace EFCore_LcpiOleDb_Tests.General.Work.DBMS.Firebird.V03_0_0.D3.Query.Operators.SET_001.Divide.Complete.NullableInt16.Int32AsDecimal{ //////////////////////////////////////////////////////////////////////////////// using T_DATA1 =System.Nullable<System.Int16>; using T_DATA2 =System.Int32; using T_DATA2_AS=System.Decimal; //////////////////////////////////////////////////////////////////////////////// //class TestSet_001__fields public static class TestSet_001__fields { private const string c_NameOf__TABLE ="TEST_MODIFY_ROW2"; private const string c_NameOf__COL_DATA1 ="COL_SMALLINT"; private const string c_NameOf__COL_DATA2 ="COL2_INTEGER"; private sealed class MyContext:TestBaseDbContext { [Table(c_NameOf__TABLE)] public sealed class TEST_RECORD { [Key] [Column("TEST_ID")] public System.Int64? TEST_ID { get; set; } [Column(c_NameOf__COL_DATA1)] public T_DATA1 COL_DATA1 { get; set; } [Column(c_NameOf__COL_DATA2)] public T_DATA2 COL_DATA2 { get; set; } };//class TEST_RECORD //---------------------------------------------------------------------- public DbSet<TEST_RECORD> testTable { get; set; } //---------------------------------------------------------------------- public MyContext(xdb.OleDbTransaction tr) :base(tr) { }//MyContext };//class MyContext //----------------------------------------------------------------------- [Test] public static void Test_001() { using(var cn=LocalCnHelper.CreateCn()) { cn.Open(); using(var tr=cn.BeginTransaction()) { //insert new record in external transaction using(var db=new MyContext(tr)) { T_DATA1 c_value1=7; const T_DATA2 c_value2=2; System.Int64? testID=Helper__InsertRow(db,c_value1,c_value2); Assert.AreEqual (3.5m, c_value1/(T_DATA2_AS)c_value2); var recs=db.testTable.Where(r => (r.COL_DATA1/(T_DATA2_AS)r.COL_DATA2)==3.5m && r.TEST_ID==testID); int nRecs=0; foreach(var r in recs) { Assert.AreEqual (0, nRecs); ++nRecs; Assert.IsTrue (r.TEST_ID.HasValue); Assert.AreEqual (testID, r.TEST_ID.Value); Assert.AreEqual (c_value1, r.COL_DATA1); Assert.AreEqual (c_value2, r.COL_DATA2); }//foreach r var sqlt =new TestSqlTemplate() .T("SELECT ").N("t","TEST_ID").T(", ").N("t",c_NameOf__COL_DATA1).T(", ").N("t",c_NameOf__COL_DATA2).EOL() .T("FROM ").N(c_NameOf__TABLE).T(" AS ").N("t").EOL() .T("WHERE ((CAST(").N("t",c_NameOf__COL_DATA1).T(" AS DOUBLE PRECISION) / ").N("t",c_NameOf__COL_DATA2).T(") = 3.5) AND (").N("t","TEST_ID").T(" = ").P_ID("__testID_0").T(")"); db.CheckTextOfLastExecutedCommand (sqlt); Assert.AreEqual (1, nRecs); }//using db tr.Rollback(); }//using tr }//using cn }//Test_001 //----------------------------------------------------------------------- private static System.Int64 Helper__InsertRow(MyContext db, T_DATA1 valueForColData1, T_DATA2 valueForColData2) { var newRecord=new MyContext.TEST_RECORD(); newRecord.COL_DATA1 =valueForColData1; newRecord.COL_DATA2 =valueForColData2; db.testTable.Add(newRecord); db.SaveChanges(); db.CheckTextOfLastExecutedCommand (new TestSqlTemplate() .T("INSERT INTO ").N(c_NameOf__TABLE).T(" (").N(c_NameOf__COL_DATA1).T(", ").N(c_NameOf__COL_DATA2).T(")").EOL() .T("VALUES (").P("p0").T(", ").P("p1").T(")").EOL() .T("RETURNING ").N("TEST_ID").EOL() .T("INTO ").P("p2").T(";")); Assert.IsTrue (newRecord.TEST_ID.HasValue); Console.WriteLine("TEST_ID: {0}",newRecord.TEST_ID.Value); return newRecord.TEST_ID.Value; }//Helper__InsertRow };//class TestSet_001__fields //////////////////////////////////////////////////////////////////////////////// }//namespace EFCore_LcpiOleDb_Tests.General.Work.DBMS.Firebird.V03_0_0.D3.Query.Operators.SET_001.Divide.Complete.NullableInt16.Int32AsDecimal
29.356688
183
0.561727
[ "MIT" ]
ibprovider/Lcpi.EFCore.LcpiOleDb
Tests/General/Source/Work/DBMS/Firebird/V03_0_0/D3/Query/Operators/SET_001/Divide/Complete/NullableInt16/Int32AsDecimal/TestSet_001__fields.cs
4,611
C#
using System; using System.IO; namespace EmbeddedResources { public class EmbeddedResourceLoader : ILoadResources { private readonly ILocateResources _resourceLocator; public EmbeddedResourceLoader(ILocateResources resourceLocator) { _resourceLocator = resourceLocator; } public string LoadText(string name) { string text = String.Empty; using (var stream = this.OpenStream(name)) { if (stream == null) throw new ArgumentException($"Resource \"{name}\" not found.", nameof(name)); var reader = new StreamReader(stream); text = reader.ReadToEnd(); } return text; } public byte[] LoadBytes(string name) { var memStream = new MemoryStream(); using (var resStream = this.OpenStream(name)) { if (resStream == null) throw new ArgumentException($"Resource \"{name}\" not found.", nameof(name)); resStream.CopyTo(memStream); } return memStream.ToArray(); } public Stream OpenStream(string name) { ResourceReference resourceReference = _resourceLocator.Locate(name); if (resourceReference == null) throw new ArgumentException($"Resource \"{name}\" not found.", nameof(name)); var stream = resourceReference.Assembly.GetManifestResourceStream(resourceReference.FullName); if (stream == null) throw new ArgumentException($"Resource \"{name}\" not found.", nameof(name)); return stream; } } }
28.33871
106
0.559476
[ "MIT" ]
xinmyname/EmbeddedResourceLoader
src/EmbeddedResourceLoader.cs
1,759
C#
using LogisticsSystem.Controllers; using MyTested.AspNetCore.Mvc; using Xunit; namespace LogisticsSystem.Test.Routing { public class HomeRoutingTest { [Fact] public void IndexRouteShouldBeMapped() => MyRouting .Configuration() .ShouldMap("/") .To<HomeController>(c => c.Index()); [Fact] public void ErrorRouteShouldBeMapped() => MyRouting .Configuration() .ShouldMap("/Home/Error") .To<HomeController>(c => c.Error()); } }
22.259259
55
0.53411
[ "MIT" ]
pepsitopepsito9681/My-courses-at-Software-University
C# Web Project-Logistics System/LogisticsSystem.Test/Routing/HomeRoutingTest.cs
603
C#
using System; namespace Controllers { public class TypeScriptControllerAttribute : Attribute { } }
14
58
0.714286
[ "MIT" ]
TheHatSky/typewriter-controller-template
src/Controllers/Controllers/TypeScriptControllerAttribute.cs
114
C#
using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; namespace Tasks { public class D { static void Main(string[] args) { var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false }; Console.SetOut(sw); Solve(); Console.Out.Flush(); } public static void Solve() { var N = Scanner.Scan<long>(); // i 1 2 3 4 5 6 // p 2 3 4 5 6 1 var answer = N * (N - 1) / 2; Console.WriteLine(answer); } public static class Scanner { private static Queue<string> queue = new Queue<string>(); public static T Next<T>() { if (!queue.Any()) foreach (var item in Console.ReadLine().Trim().Split(" ")) queue.Enqueue(item); return (T)Convert.ChangeType(queue.Dequeue(), typeof(T)); } public static T Scan<T>() => Next<T>(); public static (T1, T2) Scan<T1, T2>() => (Next<T1>(), Next<T2>()); public static (T1, T2, T3) Scan<T1, T2, T3>() => (Next<T1>(), Next<T2>(), Next<T3>()); public static (T1, T2, T3, T4) Scan<T1, T2, T3, T4>() => (Next<T1>(), Next<T2>(), Next<T3>(), Next<T4>()); public static (T1, T2, T3, T4, T5) Scan<T1, T2, T3, T4, T5>() => (Next<T1>(), Next<T2>(), Next<T3>(), Next<T4>(), Next<T5>()); public static IEnumerable<T> ScanEnumerable<T>() => Console.ReadLine().Trim().Split(" ").Select(x => (T)Convert.ChangeType(x, typeof(T))); } } }
36.8
150
0.507246
[ "CC0-1.0" ]
AconCavy/AtCoder.Tasks.CS
ABC/ABC139/Tasks/D.cs
1,656
C#
using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.VisualStudio.TestTools.UnitTesting; using SharperCryptoApiAnalysis.BaseAnalyzers.Analyzers; using SharperCryptoApiAnalysis.BaseAnalyzers.Tests.Verifiers; namespace SharperCryptoApiAnalysis.BaseAnalyzers.Tests { [TestClass] public class LowCostFactorAnalyzer : CodeFixVerifier { [TestMethod] public void TestMethod1() { var test = @""; VerifyCSharpDiagnostic(test); } [TestMethod] public void IterationCountCtorEmpty() { string test = @" using System.Security.Cryptography; namespace SharperCryptoApiAnalysis.BaseAnalyzers.Tests { internal class DraftClass2 { public static void DeriveKey() { using (var pbkdf = new Rfc2898DeriveBytes(""123"", 8)) { } } } }"; var expected = new DiagnosticResult { Id = "SCAA011", Message = "Low iteration count for password derive function", Severity = DiagnosticSeverity.Warning, Locations = new[] { new DiagnosticResultLocation("Test0.cs", 9, 54) } }; VerifyCSharpDiagnostic(test, expected); } [TestMethod] public void IterationCountCtorTooLowLiteral() { string test = @" using System.Security.Cryptography; namespace SharperCryptoApiAnalysis.BaseAnalyzers.Tests { internal class DraftClass2 { public static void DeriveKey() { using (var pbkdf = new Rfc2898DeriveBytes(""123"", 8, 1000)) { } } } }"; var expected = new DiagnosticResult { Id = "SCAA011", Message = "Low iteration count for password derive function", Severity = DiagnosticSeverity.Warning, Locations = new[] { new DiagnosticResultLocation("Test0.cs", 9, 65) } }; VerifyCSharpDiagnostic(test, expected); } [TestMethod] public void IterationCountCtorTooLowBcl() { string test = @" using System.Security.Cryptography; namespace SharperCryptoApiAnalysis.BaseAnalyzers.Tests { internal class DraftClass2 { public static void DeriveKey() { using (var pbkdf = new Rfc2898DeriveBytes(""123"", 8, int.MinValue)) { } } } }"; var expected = new DiagnosticResult { Id = "SCAA011", Message = "Low iteration count for password derive function", Severity = DiagnosticSeverity.Warning, Locations = new[] { new DiagnosticResultLocation("Test0.cs", 9, 65) } }; VerifyCSharpDiagnostic(test, expected); } [TestMethod] public void IterationCountCtorTooLowVariable() { string test = @" using System.Security.Cryptography; namespace SharperCryptoApiAnalysis.BaseAnalyzers.Tests { internal class DraftClass2 { public static void DeriveKey() { var i = 1000; using (var pbkdf = new Rfc2898DeriveBytes(""123"", 8, i)) { } } } }"; var expected = new DiagnosticResult { Id = "SCAA011", Message = "Low iteration count for password derive function", Severity = DiagnosticSeverity.Warning, Locations = new[] { new DiagnosticResultLocation("Test0.cs", 10, 65) } }; VerifyCSharpDiagnostic(test, expected); } [TestMethod] public void IterationCountCtorTooLowVariableFlow() { string test = @" using System.Security.Cryptography; namespace SharperCryptoApiAnalysis.BaseAnalyzers.Tests { internal class DraftClass2 { public static void DeriveKey() { var i = 1000; var j = i; using (var pbkdf = new Rfc2898DeriveBytes(""123"", 8, j)) { } } } }"; var expected = new DiagnosticResult { Id = "SCAA011", Message = "Low iteration count for password derive function", Severity = DiagnosticSeverity.Warning, Locations = new[] { new DiagnosticResultLocation("Test0.cs", 11, 65) } }; VerifyCSharpDiagnostic(test, expected); } [TestMethod] public void IterationCountCtorTooLowMethod() { string test = @" using System.Security.Cryptography; namespace SharperCryptoApiAnalysis.BaseAnalyzers.Tests { internal class DraftClass2 { public static void DeriveKey() { using (var pbkdf = new Rfc2898DeriveBytes(""123"", 8, GetInt())) { } } public static int GetInt() { return 1000; } } }"; var expected = new DiagnosticResult { Id = "SCAA011", Message = "Low iteration count for password derive function", Severity = DiagnosticSeverity.Warning, Locations = new[] { new DiagnosticResultLocation("Test0.cs", 9, 65) } }; VerifyCSharpDiagnostic(test, expected); } [TestMethod] public void IterationCountCtorMethod() { string test = @" using System.Security.Cryptography; namespace SharperCryptoApiAnalysis.BaseAnalyzers.Tests { internal class DraftClass2 { public static void DeriveKey() { using (var pbkdf = new Rfc2898DeriveBytes(""123"", 8, GetInt())) { } } public static int GetInt() { return 10000; } } }"; VerifyCSharpDiagnostic(test); } [TestMethod] public void IterationCountCtorLiteral() { string test = @" using System.Security.Cryptography; namespace SharperCryptoApiAnalysis.BaseAnalyzers.Tests { internal class DraftClass2 { public static void DeriveKey() { using (var pbkdf = new Rfc2898DeriveBytes(""123"", 8, 10000)) { } } } }"; VerifyCSharpDiagnostic(test); } [TestMethod] public void IterationCountPropertyTooLowLiteral() { string test = @" using System.Security.Cryptography; namespace SharperCryptoApiAnalysis.BaseAnalyzers.Tests { internal class DraftClass2 { public static void DeriveKey() { using (var pbkdf = new Rfc2898DeriveBytes(""123"", 8)) { pbkdf.IterationCount = 1000; } } } }"; var expected = new DiagnosticResult { Id = "SCAA011", Message = "Low iteration count for password derive function", Severity = DiagnosticSeverity.Warning, Locations = new[] { new DiagnosticResultLocation("Test0.cs", 11, 17) } }; VerifyCSharpDiagnostic(test, expected); } [TestMethod] public void IterationCountPropertyTooLowLiteralNoUsing() { string test = @" using System.Security.Cryptography; namespace SharperCryptoApiAnalysis.BaseAnalyzers.Tests { internal class DraftClass2 { public static void DeriveKey() { var pbkdf = new Rfc2898DeriveBytes(""123"", 8); pbkdf.IterationCount = 1000; } } }"; var expected = new DiagnosticResult { Id = "SCAA011", Message = "Low iteration count for password derive function", Severity = DiagnosticSeverity.Warning, Locations = new[] { new DiagnosticResultLocation("Test0.cs", 10, 13) } }; VerifyCSharpDiagnostic(test, expected); } [TestMethod] public void IterationCountCtorTooLowLiteralNoUsing() { string test = @" using System.Security.Cryptography; namespace SharperCryptoApiAnalysis.BaseAnalyzers.Tests { internal class DraftClass2 { public static void DeriveKey() { var pbkdf = new Rfc2898DeriveBytes(""123"", 8); } } }"; var expected = new DiagnosticResult { Id = "SCAA011", Message = "Low iteration count for password derive function", Severity = DiagnosticSeverity.Warning, Locations = new[] { new DiagnosticResultLocation("Test0.cs", 9, 47) } }; VerifyCSharpDiagnostic(test, expected); } [TestMethod] public void IterationCountCtorTooLowWithMemeberAccess() { string test = @" using System.Security.Cryptography; namespace SharperCryptoApiAnalysis.BaseAnalyzers.Tests { internal class DraftClass2 { public static void DeriveKey() { using (var pbkdf = new Rfc2898DeriveBytes(""123"", 8)) { var count = pbkdf.IterationCount; } } } }"; var expected = new DiagnosticResult { Id = "SCAA011", Message = "Low iteration count for password derive function", Severity = DiagnosticSeverity.Warning, Locations = new[] { new DiagnosticResultLocation("Test0.cs", 9, 54) } }; VerifyCSharpDiagnostic(test, expected); } protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer() { return new Analyzers.LowCostFactorAnalyzer(); } } }
26.488998
80
0.511076
[ "MIT" ]
AnakinSklavenwalker/SharperCryptoApiAnalysis
tests/SharperCryptoApiAnalysis.BaseAnalyzers.Tests/LowCostFactorAnalyzerTests.cs
10,834
C#
using System.Xml.Serialization; #pragma warning disable CS1591 namespace JenkinsWebApi.Model { // hudson.matrix.MatrixConfiguration public partial class JenkinsMatrixMatrixConfiguration : JenkinsModelProject { // empty } }
19.153846
79
0.742972
[ "MIT" ]
bmasephol/JenkinsWebApi
JenkinsWebApiShared/Model/Generated/JenkinsMatrixMatrixConfiguration.cs
249
C#
using Microsoft.Extensions.DependencyInjection; using System; namespace Okra.Tests.Mocks { public class MockServiceScopeFactory : IServiceScopeFactory { private readonly IServiceProvider _childServiceProvider; public MockServiceScopeFactory(IServiceProvider childServiceProvider) { _childServiceProvider = childServiceProvider; } public IServiceScope CreateScope() { return new MockServiceScope(_childServiceProvider); } } }
24.809524
77
0.700576
[ "Apache-2.0" ]
OkraFramework/Okra.Core
test/Okra.Core.Tests/Mocks/MockServiceScopeFactory.cs
523
C#
using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Metadata; namespace HeadRaceTimingSite.Migrations { public partial class BasicStructure : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn<int>( name: "CompetitionId", table: "Crews", nullable: false, defaultValue: 0); migrationBuilder.AddColumn<int>( name: "StartNumber", table: "Crews", nullable: false, defaultValue: 0); migrationBuilder.CreateTable( name: "Competitions", columns: table => new { CompetitionId = table.Column<int>(nullable: false) .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), Name = table.Column<string>(nullable: true) }, constraints: table => { table.PrimaryKey("PK_Competitions", x => x.CompetitionId); }); migrationBuilder.CreateTable( name: "Sections", columns: table => new { SectionId = table.Column<int>(nullable: false) .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), CompetitionId = table.Column<int>(nullable: false) }, constraints: table => { table.PrimaryKey("PK_Sections", x => x.SectionId); table.ForeignKey( name: "FK_Sections_Competitions_CompetitionId", column: x => x.CompetitionId, principalTable: "Competitions", principalColumn: "CompetitionId", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "Results", columns: table => new { ResultId = table.Column<int>(nullable: false) .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), CrewId = table.Column<int>(nullable: false), SectionId = table.Column<int>(nullable: false), TimeOfDay = table.Column<TimeSpan>(nullable: false) }, constraints: table => { table.PrimaryKey("PK_Results", x => x.ResultId); table.ForeignKey( name: "FK_Results_Crews_CrewId", column: x => x.CrewId, principalTable: "Crews", principalColumn: "CrewId", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_Results_Sections_SectionId", column: x => x.SectionId, principalTable: "Sections", principalColumn: "SectionId", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateIndex( name: "IX_Crews_CompetitionId", table: "Crews", column: "CompetitionId"); migrationBuilder.CreateIndex( name: "IX_Results_CrewId", table: "Results", column: "CrewId"); migrationBuilder.CreateIndex( name: "IX_Results_SectionId", table: "Results", column: "SectionId"); migrationBuilder.CreateIndex( name: "IX_Sections_CompetitionId", table: "Sections", column: "CompetitionId"); migrationBuilder.AddForeignKey( name: "FK_Crews_Competitions_CompetitionId", table: "Crews", column: "CompetitionId", principalTable: "Competitions", principalColumn: "CompetitionId", onDelete: ReferentialAction.Restrict); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Crews_Competitions_CompetitionId", table: "Crews"); migrationBuilder.DropTable( name: "Results"); migrationBuilder.DropTable( name: "Sections"); migrationBuilder.DropTable( name: "Competitions"); migrationBuilder.DropIndex( name: "IX_Crews_CompetitionId", table: "Crews"); migrationBuilder.DropColumn( name: "CompetitionId", table: "Crews"); migrationBuilder.DropColumn( name: "StartNumber", table: "Crews"); } } }
37.496454
122
0.503499
[ "MIT" ]
MelHarbour/HeadRaceTiming-Site
HeadRaceTiming-Site/Migrations/20170321164936_BasicStructure.cs
5,289
C#
//------------------------------------------------------------------------------ // <auto-generated> // Dieser Code wurde von einem Tool generiert. // Laufzeitversion:4.0.30319.42000 // // Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn // der Code erneut generiert wird. // </auto-generated> //------------------------------------------------------------------------------ namespace Program.Properties { using System; /// <summary> /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. /// </summary> // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } /// <summary> /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("program.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } /// <summary> /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } } }
46.765625
173
0.636485
[ "MIT" ]
Grille/2D-isometricRenderer
2D-isoedit/Properties/Resources.Designer.cs
3,003
C#
using System; using Photon.Pun; using Photon.Realtime; using TMPro; using UnityEngine; using UnityEngine.UI; public sealed class PlayerListElementView : MonoBehaviour { [SerializeField] private TMP_Text _usernameText; [SerializeField] private Button _kickButton; private Player _player; public int PlayerActorNumber { get; private set; } public event Action<Player> OnKickButtonClicked = delegate { }; private void Start() { _kickButton.onClick.AddListener(KickButtonClicked); } private void OnDestroy() { _kickButton.onClick.RemoveListener(KickButtonClicked); } private void KickButtonClicked() { OnKickButtonClicked.Invoke(_player); } public void Initialize(Player player, string playerUsername) { _player = player; PlayerActorNumber = _player.ActorNumber; _usernameText.text = playerUsername; if (PhotonNetwork.LocalPlayer.ActorNumber == PlayerActorNumber || !PhotonNetwork.LocalPlayer.IsMasterClient) { _kickButton.gameObject.SetActive(false); } } public void CheckNewMaster(Player newMasterClient) { _kickButton.gameObject.SetActive(newMasterClient.ActorNumber == PhotonNetwork.LocalPlayer.ActorNumber); } }
25.096154
116
0.699617
[ "MIT" ]
OlekLolKek/gb0122
Assets/Code/Views/PlayerListElementView.cs
1,305
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. */ using System.IO; using System.Xml; using System.Text; using Amazon.S3.Util; using Amazon.Runtime; using Amazon.Runtime.Internal; using Amazon.Runtime.Internal.Transform; using Amazon.Util; #pragma warning disable 1591 namespace Amazon.S3.Model.Internal.MarshallTransformations { /// <summary> /// Put Bucket Lifecycle Request Marshaller /// </summary> public class PutLifecycleConfigurationRequestMarshaller : IMarshaller<IRequest, PutLifecycleConfigurationRequest> ,IMarshaller<IRequest,Amazon.Runtime.AmazonWebServiceRequest> { public IRequest Marshall(Amazon.Runtime.AmazonWebServiceRequest input) { return this.Marshall((PutLifecycleConfigurationRequest)input); } public IRequest Marshall(PutLifecycleConfigurationRequest putLifecycleConfigurationRequest) { IRequest request = new DefaultRequest(putLifecycleConfigurationRequest, "AmazonS3"); request.HttpMethod = "PUT"; if (putLifecycleConfigurationRequest.IsSetExpectedBucketOwner()) request.Headers.Add(S3Constants.AmzHeaderExpectedBucketOwner, S3Transforms.ToStringValue(putLifecycleConfigurationRequest.ExpectedBucketOwner)); if (string.IsNullOrEmpty(putLifecycleConfigurationRequest.BucketName)) throw new System.ArgumentException("BucketName is a required property and must be set before making this call.", "PutLifecycleConfigurationRequest.BucketName"); request.MarshallerVersion = 2; request.ResourcePath = string.Concat("/", S3Transforms.ToStringValue(putLifecycleConfigurationRequest.BucketName)); request.AddSubResource("lifecycle"); var stringWriter = new StringWriter(System.Globalization.CultureInfo.InvariantCulture); using (var xmlWriter = XmlWriter.Create(stringWriter, new XmlWriterSettings(){Encoding = Encoding.UTF8, OmitXmlDeclaration = true})) { var lifecycleConfigurationLifecycleConfiguration = putLifecycleConfigurationRequest.Configuration; if (lifecycleConfigurationLifecycleConfiguration != null) { xmlWriter.WriteStartElement("LifecycleConfiguration", ""); if (lifecycleConfigurationLifecycleConfiguration != null) { var lifecycleConfigurationLifecycleConfigurationrulesList = lifecycleConfigurationLifecycleConfiguration.Rules; if (lifecycleConfigurationLifecycleConfigurationrulesList != null && lifecycleConfigurationLifecycleConfigurationrulesList.Count > 0) { foreach (var lifecycleConfigurationLifecycleConfigurationrulesListValue in lifecycleConfigurationLifecycleConfigurationrulesList) { xmlWriter.WriteStartElement("Rule", ""); if (lifecycleConfigurationLifecycleConfigurationrulesListValue != null) { var expiration = lifecycleConfigurationLifecycleConfigurationrulesListValue.Expiration; if (expiration != null) { xmlWriter.WriteStartElement("Expiration", ""); if (expiration.IsSetDateUtc()) { xmlWriter.WriteElementString("Date", "", S3Transforms.ToXmlStringValue(expiration.DateUtc)); } if (expiration.IsSetDays()) { xmlWriter.WriteElementString("Days", "", S3Transforms.ToXmlStringValue(expiration.Days)); } if (expiration.IsSetExpiredObjectDeleteMarker()) { xmlWriter.WriteElementString("ExpiredObjectDeleteMarker", "", S3Transforms.ToXmlStringValue(expiration.ExpiredObjectDeleteMarker)); } xmlWriter.WriteEndElement(); } var transitions = lifecycleConfigurationLifecycleConfigurationrulesListValue.Transitions; if (transitions != null && transitions.Count > 0) { foreach (var transition in transitions) { if (transition != null) { xmlWriter.WriteStartElement("Transition", ""); if (transition.IsSetDateUtc()) { xmlWriter.WriteElementString("Date", "", S3Transforms.ToXmlStringValue(transition.DateUtc)); } if (transition.IsSetDays()) { xmlWriter.WriteElementString("Days", "", S3Transforms.ToXmlStringValue(transition.Days)); } if (transition.IsSetStorageClass()) { xmlWriter.WriteElementString("StorageClass", "", S3Transforms.ToXmlStringValue(transition.StorageClass)); } xmlWriter.WriteEndElement(); } } } var noncurrentVersionExpiration = lifecycleConfigurationLifecycleConfigurationrulesListValue.NoncurrentVersionExpiration; if (noncurrentVersionExpiration != null) { xmlWriter.WriteStartElement("NoncurrentVersionExpiration", ""); if (noncurrentVersionExpiration.IsSetNoncurrentDays()) { xmlWriter.WriteElementString("NoncurrentDays", "", S3Transforms.ToXmlStringValue(noncurrentVersionExpiration.NoncurrentDays)); } xmlWriter.WriteEndElement(); } var noncurrentVersionTransitions = lifecycleConfigurationLifecycleConfigurationrulesListValue.NoncurrentVersionTransitions; if (noncurrentVersionTransitions != null && noncurrentVersionTransitions.Count > 0) { foreach (var noncurrentVersionTransition in noncurrentVersionTransitions) { if (noncurrentVersionTransition != null) { xmlWriter.WriteStartElement("NoncurrentVersionTransition", ""); if (noncurrentVersionTransition.IsSetNoncurrentDays()) { xmlWriter.WriteElementString("NoncurrentDays", "", S3Transforms.ToXmlStringValue(noncurrentVersionTransition.NoncurrentDays)); } if (noncurrentVersionTransition.IsSetStorageClass()) { xmlWriter.WriteElementString("StorageClass", "", S3Transforms.ToXmlStringValue(noncurrentVersionTransition.StorageClass)); } xmlWriter.WriteEndElement(); } } } var abortIncompleteMultipartUpload = lifecycleConfigurationLifecycleConfigurationrulesListValue.AbortIncompleteMultipartUpload; if (abortIncompleteMultipartUpload != null) { xmlWriter.WriteStartElement("AbortIncompleteMultipartUpload", ""); if (abortIncompleteMultipartUpload.IsSetDaysAfterInitiation()) { xmlWriter.WriteElementString("DaysAfterInitiation", "", S3Transforms.ToXmlStringValue(abortIncompleteMultipartUpload.DaysAfterInitiation)); } xmlWriter.WriteEndElement(); } } if (lifecycleConfigurationLifecycleConfigurationrulesListValue.IsSetId()) { xmlWriter.WriteElementString("ID", "", S3Transforms.ToXmlStringValue(lifecycleConfigurationLifecycleConfigurationrulesListValue.Id)); } if (lifecycleConfigurationLifecycleConfigurationrulesListValue.IsSetPrefix() && lifecycleConfigurationLifecycleConfigurationrulesListValue.IsSetFilter()) { throw new AmazonClientException("LifecycleRule.Prefix is deprecated. Please only use LifecycleRule.Filter."); } if (lifecycleConfigurationLifecycleConfigurationrulesListValue.IsSetPrefix()) { xmlWriter.WriteElementString("Prefix", "", S3Transforms.ToXmlStringValue(lifecycleConfigurationLifecycleConfigurationrulesListValue.Prefix)); } if (lifecycleConfigurationLifecycleConfigurationrulesListValue.IsSetFilter()) { xmlWriter.WriteStartElement("Filter", ""); if (lifecycleConfigurationLifecycleConfigurationrulesListValue.Filter.IsSetLifecycleFilterPredicate()) lifecycleConfigurationLifecycleConfigurationrulesListValue.Filter.LifecycleFilterPredicate.Accept(new LifecycleFilterPredicateMarshallVisitor(xmlWriter)); xmlWriter.WriteEndElement(); } if (lifecycleConfigurationLifecycleConfigurationrulesListValue.IsSetStatus()) { xmlWriter.WriteElementString("Status", "", S3Transforms.ToXmlStringValue(lifecycleConfigurationLifecycleConfigurationrulesListValue.Status)); } else { xmlWriter.WriteElementString("Status", "", "Disabled"); } xmlWriter.WriteEndElement(); } } } xmlWriter.WriteEndElement(); } } try { var content = stringWriter.ToString(); request.Content = Encoding.UTF8.GetBytes(content); request.Headers[HeaderKeys.ContentTypeHeader] = "application/xml"; var checksum = AWSSDKUtils.GenerateChecksumForContent(content, true); request.Headers[HeaderKeys.ContentMD5Header] = checksum; } catch (EncoderFallbackException e) { throw new AmazonServiceException("Unable to marshall request to XML", e); } return request; } private static PutLifecycleConfigurationRequestMarshaller _instance; public static PutLifecycleConfigurationRequestMarshaller Instance { get { if (_instance == null) { _instance = new PutLifecycleConfigurationRequestMarshaller(); } return _instance; } } } }
58.276596
194
0.503322
[ "Apache-2.0" ]
PureKrome/aws-sdk-net
sdk/src/Services/S3/Custom/Model/Internal/MarshallTransformations/PutLifecycleConfigurationRequestMarshaller.cs
13,695
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; [RequireComponent(typeof(LineRenderer))] public class KochLine : KochGenerator { LineRenderer lineRenderer; Vector3[] lerpPositions; //public float generateMultiplier; float[] lerpAudio; [Header("Audio")] public AudioVisualizer audioVisualizer; public bool useBuffer = false; public int[] audioBand; public Material material; [ColorUsage(true,true)] public Color color; Material materialInstance; public int audioBandMaterial; public float emissionMultiplier; // Start is called before the first frame update void Start() { if (!audioVisualizer) { audioVisualizer = AudioVisualizer.instance; } lerpAudio = new float[_initiatorPointAmount]; lineRenderer = GetComponent<LineRenderer>(); lineRenderer.enabled = true; lineRenderer.useWorldSpace = false; lineRenderer.loop = true; lineRenderer.positionCount = _positions.Length; lineRenderer.SetPositions(_positions); lerpPositions = new Vector3[_positions.Length]; //Apply material materialInstance = new Material(material); lineRenderer.material = materialInstance; } // Update is called once per frame void Update() { if (!audioVisualizer) { audioVisualizer = AudioVisualizer.instance; } if (useBuffer) { if(materialInstance != null) materialInstance.SetColor("_EmissionColor", color * audioVisualizer.audioBandBuffer[audioBandMaterial] * emissionMultiplier); } else { if (materialInstance != null) materialInstance.SetColor("_EmissionColor", color * audioVisualizer.audioBand[audioBandMaterial] * emissionMultiplier); } if (_generationCount != 0) { int count = 0; for (int i = 0; i < _initiatorPointAmount; i++) { if (useBuffer) { lerpAudio[i] = audioVisualizer.audioBandBuffer[audioBand[i]]; } else { lerpAudio[i] = audioVisualizer.audioBand[audioBand[i]]; } for (int j = 0; j < (_positions.Length - 1) / _initiatorPointAmount; j++) { lerpPositions[count] = Vector3.Lerp(_positions[count], _targetPositions[count], lerpAudio[i]); count++; } } lerpPositions[count] = Vector3.Lerp(_positions[count], _targetPositions[count], lerpAudio[_initiatorPointAmount - 1]); if (_useBezierCurve) { _bezierPosition = BezierCurve(lerpPositions, _bezierVertexCount); lineRenderer.positionCount = _bezierPosition.Length; lineRenderer.SetPositions(_bezierPosition); } else { lineRenderer.positionCount = lerpPositions.Length; lineRenderer.SetPositions(lerpPositions); } } } }
31.803922
141
0.581689
[ "MIT" ]
lobinuxsoft/Audio-Visualizer
Assets/Audio Tools/Audio Visualizer/Scripts/Koch Fractals/KochLine.cs
3,246
C#
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Numerics; using System.Security.Cryptography; using System.Threading.Tasks; using NBitcoin; namespace bitcoinpuzzlescanner { public static class Helpers { /// <summary> /// Write console message. /// </summary> /// <param name="Message">Message to show</param> public static void WriteInfo(string Message) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(Message); Console.ForegroundColor = ConsoleColor.Green; } /// <summary> /// Write mesagge to console if address found /// </summary> public static void WriteFound(string Address, string PrivateKey) { Console.Clear(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("(!) Congratulations. Target address found. Details can be found below and in the generated text file in /found folder. (!)"); Console.WriteLine(Environment.NewLine); Console.WriteLine(Address); Console.WriteLine(PrivateKey); Console.WriteLine(Environment.NewLine); Console.WriteLine("The address where you can donate if you feel like it => 1eosEvvesKV6C2ka4RDNZhmepm1TLFBtw <="); } /// <summary> /// Generate random big integer in range /// </summary> /// <param name="_Random"></param> /// <param name="Min"></param> /// <param name="Max"></param> /// <returns>Random BigInteger</returns> public static BigInteger RandomBigInteger(this Random _Random, BigInteger Min, BigInteger Max) { if (Min > Max) throw new ArgumentException(); if (Min == Max) return Min; BigInteger _Z = Max - 1 - Min; byte[] Bytes = _Z.ToByteArray(); byte LastByteMask = 0b11111111; for (byte Mask = 0b10000000; Mask > 0; Mask >>= 1, LastByteMask >>= 1) { if ((Bytes[Bytes.Length - 1] & Mask) == Mask) break; } while (true) { _Random.NextBytes(Bytes); Bytes[Bytes.Length - 1] &= LastByteMask; var Result = new BigInteger(Bytes); if (Result <= _Z) return Result + Min; } } /// <summary> /// Random generate single HEX value in range /// </summary> /// <param name="Start">HEX start</param> /// <param name="End">HEX end</param> /// <returns>Hex value</returns> public static string RandomHex(string Start, string End) { BigInteger HexStart = BigInteger.Parse(Start, System.Globalization.NumberStyles.HexNumber); BigInteger HexEnd = BigInteger.Parse(End, System.Globalization.NumberStyles.HexNumber); BigInteger Random = RandomBigInteger(new Random(), HexStart, HexEnd); return String.Format("{0:x64}", Random); } /// <summary> /// Get maximum keys length in HEX range /// </summary> /// <param name="Start">HEX start</param> /// <param name="End">HEX ed</param> /// <returns>Max. keys length</returns> public static BigInteger GetMaxKeys(string Start, string End) { BigInteger HexStart = BigInteger.Parse(Start, System.Globalization.NumberStyles.HexNumber); BigInteger HexEnd = BigInteger.Parse(End, System.Globalization.NumberStyles.HexNumber); return (HexEnd - HexStart) + 1; } /// <summary> /// Random generate array HEX value list in range /// </summary> /// <param name="Start">HEX start</param> /// <param name="End">Hex end</param> /// <param name="KeysPerPage">Keys per page</param> /// <returns></returns> public static List<models.Key> RandomHexList(string Start, string End, int ParallelScan = 1000) { BigInteger HexStart = BigInteger.Parse(Start, System.Globalization.NumberStyles.HexNumber); BigInteger HexEnd = BigInteger.Parse(End, System.Globalization.NumberStyles.HexNumber); BigInteger Random = RandomBigInteger(new Random(), HexStart, HexEnd); List<models.Key> KeyList = new List<models.Key>(); for (int i = 0; i < ParallelScan; i++) { string Hex = String.Format("{0:x64}", Random); string Address = HexToAddress(Hex); KeyList.Add(new models.Key { Address = Address, PrivateKey = Hex }); Random++; if (Random > HexEnd) Random = HexEnd; } return KeyList; } /// <summary> /// Generate hex from start to end /// </summary> /// <param name="Start">HEX start</param> /// <param name="End">HEX end</param> /// <param name="ParallelScan">Keys per page</param> /// <returns></returns> public static List<models.Key> RandomHexList(BigInteger Start, string End, int ParallelScan = 1000) { BigInteger HexStart = Start; BigInteger HexEnd = BigInteger.Parse(End, System.Globalization.NumberStyles.HexNumber); List<models.Key> KeyList = new List<models.Key>(); for (int i = 0; i < ParallelScan; i++) { string Hex = String.Format("{0:x64}", HexStart); string Address = HexToAddress(Hex); KeyList.Add(new models.Key { Address = Address, PrivateKey = Hex }); HexStart++; if (HexStart > HexEnd) HexStart = HexEnd; } return KeyList; } /// <summary> /// Generate hex from end to start /// </summary> /// <param name="Start">HEX start</param> /// <param name="End">HEX end</param> /// <param name="ParallelScan">Keys per page</param> /// <returns></returns> public static List<models.Key> RandomHexList(string Start, BigInteger End, int ParallelScan = 1000) { BigInteger HexStart = BigInteger.Parse(Start, System.Globalization.NumberStyles.HexNumber); BigInteger HexEnd = End; List<models.Key> KeyList = new List<models.Key>(); for (int i = 0; i < ParallelScan; i++) { string Hex = String.Format("{0:x64}", HexEnd); string Address = HexToAddress(Hex); KeyList.Add(new models.Key { Address = Address, PrivateKey = Hex }); HexEnd--; if (HexEnd <= HexStart) HexEnd = HexStart; } return KeyList; } /// <summary> /// Converts HEX string to Biginteger /// </summary> /// <param name="Hex"></param> /// <returns></returns> public static BigInteger HexToBigInteger(string Hex) { return BigInteger.Parse(Hex, System.Globalization.NumberStyles.HexNumber); } /// <summary> /// Converts HEX value to Bitcoin Wallet Address /// </summary> /// <param name="Hex">Hex value</param> /// <param name="IsCompressed">Return compressed address or no</param> /// <returns></returns> public static string HexToAddress(string Hex, bool IsCompressed = true) { string PrivateKey = "80" + Hex; string Hash1 = SHA256(PrivateKey); string Hash2 = SHA256(Hash1); string First4Bytes = Hash2.Substring(0, 8); string Checksum = (PrivateKey + First4Bytes); byte[] Data = StringToByteArray(Checksum); string WIF = NBitcoin.DataEncoders.Encoders.Base58.EncodeData(Data); if (IsCompressed) { var Secret = new BitcoinSecret(WIF, Network.Main); return Secret.PubKey.Compress().GetAddress(ScriptPubKeyType.Legacy, Network.Main).ToString(); } else { var Secret = new BitcoinSecret(WIF, Network.Main); return Secret.GetAddress(ScriptPubKeyType.Legacy).ToString(); } } /// <summary> /// Parse string to enum /// </summary> /// <typeparam name="T">Enum type to try parse</typeparam> /// <param name="Value">String to convert enum</param> /// <returns></returns> public static T ParseEnum<T>(string Value) { return (T)Enum.Parse(typeof(T), Value, true); } /// <summary> /// Convert string to SHA256 /// </summary> /// <param name="Value"></param> /// <returns>Hashed string</returns> public static string SHA256(string Value) { byte[] Bytes = StringToByteArray(Value); SHA256Managed Sha = new SHA256Managed(); string HashString = String.Empty; byte[] encrypt = Sha.ComputeHash(Bytes); foreach (byte _Byte in encrypt) { HashString += _Byte.ToString("x2"); } return HashString; } /// <summary> /// Convert string to byte array /// </summary> /// <param name="Value"></param> /// <returns>byte array</returns> public static byte[] StringToByteArray(string Value) { return Enumerable.Range(0, Value.Length) .Where(x => x % 2 == 0) .Select(x => Convert.ToByte(Value.Substring(x, 2), 16)) .ToArray(); } /// <summary> /// Saves a file into found folder /// </summary> /// <param name="PrivateKey"></param> /// <param name="Address"></param> public static void SaveFile(string PrivateKey, string Address) { // Save file string[] Lines = { PrivateKey, Address, DateTime.Now.ToLongDateString() }; string AppPath = AppDomain.CurrentDomain.BaseDirectory + "/found/"; using (StreamWriter outputFile = new StreamWriter(Path.Combine(AppPath, PrivateKey + ".txt"))) { foreach (string Line in Lines) outputFile.WriteLine(Line); } } } }
38.210145
156
0.54836
[ "MIT" ]
ilkerccom/bitcoinpuzzlescanner
bitcoinpuzzlescanner/helpers/Helpers.cs
10,548
C#
using System.IO; using Microsoft.AspNetCore.Hosting; namespace D2D.Web.Host.Startup { public class Program { public static void Main(string[] args) { var host = new WebHostBuilder() .UseKestrel() .UseContentRoot(Directory.GetCurrentDirectory()) .UseIISIntegration() .UseStartup<Startup>() .Build(); host.Run(); } } }
21.904762
64
0.521739
[ "MIT" ]
TheGenezis/D2D
src/D2D.Web.Host/Startup/Program.cs
462
C#
using Prism; using Prism.Ioc; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; using Windows.Foundation; using Windows.Foundation.Collections; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls.Primitives; using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Navigation; namespace HomeLink.App.UWP { public sealed partial class MainPage { public MainPage() { this.InitializeComponent(); LoadApplication(new HomeLink.App.App(new UwpInitializer())); } } public class UwpInitializer : IPlatformInitializer { public void RegisterTypes(IContainerRegistry containerRegistry) { // Register any platform specific implementations } } }
24.131579
72
0.714286
[ "MIT" ]
RomanEmreis/HomeLink.App
HomeLink.App/HomeLink.App/HomeLink.App.UWP/MainPage.xaml.cs
919
C#
using Microsoft.WindowsAzure.Storage.Blob; using System; using System.Drawing; using System.IO; using WWTWebservices; namespace WWT.Providers { public abstract partial class MarsMoc : RequestProvider { public Bitmap DownloadBitmap(string dataset, int level, int x, int y) { string DSSTileCache = WWTUtil.GetCurrentConfigShare("DSSTileCache", true); string id = "1738422189"; switch (dataset) { case "mars_base_map": id = "1738422189"; break; case "mars_terrain_color": id = "220581050"; break; case "mars_hirise": id = "109459728"; break; case "mars_moc": id = "252927426"; break; case "mars_historic_green": id = "1194136815"; break; case "mars_historic_schiaparelli": id = "1113282550"; break; case "mars_historic_lowell": id = "675790761"; break; case "mars_historic_antoniadi": id = "1648157275"; break; case "mars_historic_mec1": id = "2141096698"; break; } string filename = String.Format(DSSTileCache + "\\wwtcache\\mars\\{3}\\{0}\\{2}\\{1}_{2}.png", level, x, y, id); string path = String.Format(DSSTileCache + "\\wwtcache\\mars\\{3}\\{0}\\{2}", level, x, y, id); if (!File.Exists(filename)) { return null; } return new Bitmap(filename); } public Bitmap LoadMoc(int level, int tileX, int tileY) { UInt32 index = ComputeHash(level, tileX, tileY) % 400; CloudBlockBlob blob = new CloudBlockBlob(new Uri(String.Format(@"https://marsstage.blob.core.windows.net/moc/mocv5_{0}.plate", index))); Stream stream = blob.OpenRead(); Stream s = PlateFile2.GetFileStream(stream, -1, level, tileX, tileY); if (s != null) { return new Bitmap(s); } return null; } public UInt32 ComputeHash(int level, int x, int y) { return DirectoryEntry.ComputeHash(level + 128, x, y); } } }
30.27381
148
0.476602
[ "MIT" ]
twsouthwick/wwt-website
src/WWT.Providers/Providers/MarsMoc.aspx.cs
2,543
C#
namespace Mozlite.Extensions.Extensions { /// <summary> /// 唯一Id对象接口。 /// </summary> /// <typeparam name="TKey">Id类型。</typeparam> public interface ISitableObject<TKey> : IIdObject<TKey>, ISitable { } /// <summary> /// 唯一Id对象接口。 /// </summary> public interface ISitableObject : ISitableObject<int> { } }
20.941176
69
0.589888
[ "Apache-2.0" ]
Mozlite/aspnetcore
Mozlite.Extensions.Extensions/ISitableObject.cs
392
C#
using Newtonsoft.Json; using OpenBots.Core.Attributes.PropertyAttributes; using OpenBots.Core.Command; using OpenBots.Core.Enums; using OpenBots.Core.Infrastructure; using OpenBots.Core.Server.API_Methods; using OpenBots.Core.Utilities.CommonUtilities; using System; using System.Data; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Windows.Forms; using OpenBots.Core.Properties; using System.Threading.Tasks; namespace OpenBots.Commands.Asset { [Serializable] [Category("Asset Commands")] [Description("This command appends text to the end of a text Asset in OpenBots Server.")] public class AppendTextAssetCommand : ScriptCommand { [Required] [DisplayName("Text Asset Name")] [Description("Enter the name of the Asset.")] [SampleUsage("\"Name\" || vAssetName")] [Remarks("This command will throw an exception if an asset of the wrong type is used.")] [Editor("ShowVariableHelper", typeof(UIAdditionalHelperType))] [CompatibleTypes(new Type[] { typeof(string) })] public string v_AssetName { get; set; } [Required] [DisplayName("Append Text")] [Description("Enter the text value to append.")] [SampleUsage("\"Smith\" || vAssetValue")] [Remarks("")] [Editor("ShowVariableHelper", typeof(UIAdditionalHelperType))] [CompatibleTypes(new Type[] { typeof(string) })] public string v_AppendText { get; set; } public AppendTextAssetCommand() { CommandName = "AppendTextAssetCommand"; SelectionName = "Append Text Asset"; CommandEnabled = true; CommandIcon = Resources.command_asset; CommonMethods.InitializeDefaultWebProtocol(); } public async override Task RunCommand(object sender) { var engine = (IAutomationEngineInstance)sender; var vAssetName = (string)await v_AssetName.EvaluateCode(engine); var vAppendText = (string)await v_AppendText.EvaluateCode(engine); var client = AuthMethods.GetAuthToken(); var asset = AssetMethods.GetAsset(client, vAssetName, "Text"); if (asset == null) throw new DataException($"No Asset was found for '{vAssetName}' with type 'Text'"); AssetMethods.AppendAsset(client, asset.Id, vAppendText); } public override List<Control> Render(IfrmCommandEditor editor, ICommandControls commandControls) { base.Render(editor, commandControls); RenderedControls.AddRange(commandControls.CreateDefaultInputGroupFor("v_AssetName", this, editor)); RenderedControls.AddRange(commandControls.CreateDefaultInputGroupFor("v_AppendText", this, editor)); return RenderedControls; } public override string GetDisplayValue() { return base.GetDisplayValue() + $" ['{v_AssetName} With Value '{v_AppendText}']"; } } }
32.094118
103
0.752199
[ "Apache-2.0" ]
arenabilgisayar/OpenBots.Studio
OpenBots.Commands/OpenBots.Commands.Server/OpenBots.Commands.Asset/AppendTextAssetCommand.cs
2,730
C#
#pragma checksum "D:\GitHub\azure-mobile-services\quickstart\phonegap\favex\platforms\wp8\cordovalib\CordovaView.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "C72FA4ECB38C8B117F8ADD2807310EBE" //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.34014 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using Microsoft.Phone.Controls; using System; using System.Windows; using System.Windows.Automation; using System.Windows.Automation.Peers; using System.Windows.Automation.Provider; using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Ink; using System.Windows.Input; using System.Windows.Interop; using System.Windows.Markup; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Media.Imaging; using System.Windows.Resources; using System.Windows.Shapes; using System.Windows.Threading; namespace WPCordovaClassLib { public partial class CordovaView : System.Windows.Controls.UserControl { internal System.Windows.Controls.Grid LayoutRoot; internal Microsoft.Phone.Controls.WebBrowser CordovaBrowser; internal System.Windows.Media.Animation.Storyboard FadeIn; private bool _contentLoaded; /// <summary> /// InitializeComponent /// </summary> [System.Diagnostics.DebuggerNonUserCodeAttribute()] public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; System.Windows.Application.LoadComponent(this, new System.Uri("/com.mobileservices.favex;component/cordovalib/CordovaView.xaml", System.UriKind.Relative)); this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot"))); this.CordovaBrowser = ((Microsoft.Phone.Controls.WebBrowser)(this.FindName("CordovaBrowser"))); this.FadeIn = ((System.Windows.Media.Animation.Storyboard)(this.FindName("FadeIn"))); } } }
37.25
195
0.662332
[ "MIT" ]
kv19971/FavEx
platforms/wp8/obj/Debug/cordovalib/CordovaView.g.cs
2,386
C#
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. using System; using System.Collections.Generic; using System.Collections.Specialized; using System.Diagnostics; using System.Windows; namespace ModernWpf.Controls { // Internal component for layout to keep track of elements and // help with collection changes. internal class ElementManager { public void SetContext(VirtualizingLayoutContext virtualContext) { m_context = virtualContext; } public void OnBeginMeasure(ScrollOrientation orientation) { if (m_context != null) { if (IsVirtualizingContext) { // We proactively clear elements laid out outside of the realizaton // rect so that they are available for reuse during the current // measure pass. // This is useful during fast panning scenarios in which the realization // window is constantly changing and we want to reuse elements from // the end that's opposite to the panning direction. DiscardElementsOutsideWindow(m_context.RealizationRect, orientation); } else { // If we are initialized with a non-virtualizing context, make sure that // we have enough space to hold the bounds for all the elements. int count = m_context.ItemCount; if (m_realizedElementLayoutBounds.Count != count) { // Make sure there is enough space for the bounds. // Note: We could optimize when the count becomes smaller, but keeping // it always up to date is the simplest option for now. m_realizedElementLayoutBounds.Resize(count, new Rect()); } } } } public int GetRealizedElementCount() { return IsVirtualizingContext? m_realizedElements.Count : m_context.ItemCount; } public UIElement GetAt(int realizedIndex) { UIElement element; if (IsVirtualizingContext) { if (m_realizedElements[realizedIndex] == null) { // Sentinel. Create the element now since we need it. int dataIndex = GetDataIndexFromRealizedRangeIndex(realizedIndex); element = m_context.GetOrCreateElementAt(dataIndex, ElementRealizationOptions.ForceCreate | ElementRealizationOptions.SuppressAutoRecycle); m_realizedElements[realizedIndex] = element; } else { element = m_realizedElements[realizedIndex]; } } else { // realizedIndex and dataIndex are the same (everything is realized) element = m_context.GetOrCreateElementAt(realizedIndex, ElementRealizationOptions.ForceCreate | ElementRealizationOptions.SuppressAutoRecycle); } return element; } public void Add(UIElement element, int dataIndex) { Debug.Assert(IsVirtualizingContext); if (m_realizedElements.Count == 0) { m_firstRealizedDataIndex = dataIndex; } m_realizedElements.Add(element); m_realizedElementLayoutBounds.Add(new Rect()); } public void Insert(int realizedIndex, int dataIndex, UIElement element) { Debug.Assert(IsVirtualizingContext); if (realizedIndex == 0) { m_firstRealizedDataIndex = dataIndex; } m_realizedElements.Insert(realizedIndex, element); // Set bounds to an invalid rect since we do not know it yet. m_realizedElementLayoutBounds.Insert(realizedIndex, Rect.Empty); } public void ClearRealizedRange(int realizedIndex, int count) { Debug.Assert(IsVirtualizingContext); for (int i = 0; i < count; i++) { // Clear from the edges so that ItemsRepeater can optimize on maintaining // realized indices without walking through all the children every time. int index = realizedIndex == 0 ? realizedIndex + i : (realizedIndex + count - 1) - i; if (m_realizedElements[index] is UIElement elementRef) { m_context.RecycleElement(elementRef); } } m_realizedElements.RemoveRange(realizedIndex, count); m_realizedElementLayoutBounds.RemoveRange(realizedIndex, count); if (realizedIndex == 0) { m_firstRealizedDataIndex = m_realizedElements.Count == 0 ? -1 : m_firstRealizedDataIndex + count; } } public void DiscardElementsOutsideWindow(bool forward, int startIndex) { // Remove layout elements that are outside the realized range. if (IsDataIndexRealized(startIndex)) { Debug.Assert(IsVirtualizingContext); int rangeIndex = GetRealizedRangeIndexFromDataIndex(startIndex); if (forward) { ClearRealizedRange(rangeIndex, GetRealizedElementCount() - rangeIndex); } else { ClearRealizedRange(0, rangeIndex + 1); } } } public void ClearRealizedRange() { Debug.Assert(IsVirtualizingContext); ClearRealizedRange(0, GetRealizedElementCount()); } public Rect GetLayoutBoundsForDataIndex(int dataIndex) { int realizedIndex = GetRealizedRangeIndexFromDataIndex(dataIndex); return m_realizedElementLayoutBounds[realizedIndex]; } public void SetLayoutBoundsForDataIndex(int dataIndex, Rect bounds) { int realizedIndex = GetRealizedRangeIndexFromDataIndex(dataIndex); m_realizedElementLayoutBounds[realizedIndex] = bounds; } public Rect GetLayoutBoundsForRealizedIndex(int realizedIndex) { return m_realizedElementLayoutBounds[realizedIndex]; } public void SetLayoutBoundsForRealizedIndex(int realizedIndex, Rect bounds) { m_realizedElementLayoutBounds[realizedIndex] = bounds; } public bool IsDataIndexRealized(int index) { if (IsVirtualizingContext) { int realizedCount = GetRealizedElementCount(); return realizedCount > 0 && GetDataIndexFromRealizedRangeIndex(0) <= index && GetDataIndexFromRealizedRangeIndex(realizedCount - 1) >= index; } else { // Non virtualized - everything is realized return index >= 0 && index < m_context.ItemCount; } } public bool IsIndexValidInData(int currentIndex) { return currentIndex >= 0 && currentIndex < m_context.ItemCount; } public UIElement GetRealizedElement(int dataIndex) { Debug.Assert(IsDataIndexRealized(dataIndex)); return IsVirtualizingContext ? GetAt(GetRealizedRangeIndexFromDataIndex(dataIndex)) : m_context.GetOrCreateElementAt(dataIndex, ElementRealizationOptions.ForceCreate | ElementRealizationOptions.SuppressAutoRecycle); } public void EnsureElementRealized(bool forward, int dataIndex, string layoutId) { if (IsDataIndexRealized(dataIndex) == false) { var element = m_context.GetOrCreateElementAt(dataIndex, ElementRealizationOptions.ForceCreate | ElementRealizationOptions.SuppressAutoRecycle); if (forward) { Add(element, dataIndex); } else { Insert(0, dataIndex, element); } Debug.Assert(IsDataIndexRealized(dataIndex)); } } // Does the given window intersect the range of realized elements public bool IsWindowConnected(Rect window, ScrollOrientation orientation, bool scrollOrientationSameAsFlow) { Debug.Assert(IsVirtualizingContext); bool intersects = false; if (m_realizedElementLayoutBounds.Count > 0) { var firstElementBounds = GetLayoutBoundsForRealizedIndex(0); var lastElementBounds = GetLayoutBoundsForRealizedIndex(GetRealizedElementCount() - 1); var effectiveOrientation = scrollOrientationSameAsFlow ? (orientation == ScrollOrientation.Vertical ? ScrollOrientation.Horizontal : ScrollOrientation.Vertical) : orientation; var windowStart = effectiveOrientation == ScrollOrientation.Vertical ? window.Y : window.X; var windowEnd = effectiveOrientation == ScrollOrientation.Vertical ? window.Y + window.Height : window.X + window.Width; var firstElementStart = effectiveOrientation == ScrollOrientation.Vertical ? firstElementBounds.Y : firstElementBounds.X; var lastElementEnd = effectiveOrientation == ScrollOrientation.Vertical ? lastElementBounds.Y + lastElementBounds.Height : lastElementBounds.X + lastElementBounds.Width; intersects = firstElementStart <= windowEnd && lastElementEnd >= windowStart; } return intersects; } public void DataSourceChanged(object source, NotifyCollectionChangedEventArgs args) { Debug.Assert(IsVirtualizingContext); if (m_realizedElements.Count > 0) { switch (args.Action) { case NotifyCollectionChangedAction.Add: { OnItemsAdded(args.NewStartingIndex, args.NewItems.Count); } break; case NotifyCollectionChangedAction.Replace: { int oldSize = args.OldItems.Count; int newSize = args.NewItems.Count; int oldStartIndex = args.OldStartingIndex; int newStartIndex = args.NewStartingIndex; if (oldSize == newSize && oldStartIndex == newStartIndex && IsDataIndexRealized(oldStartIndex) && IsDataIndexRealized(oldStartIndex + oldSize - 1)) { // Straight up replace of n items within the realization window. // Removing and adding might causes us to lose the anchor causing us // to throw away all containers and start from scratch. // Instead, we can just clear those items and set the element to // null (sentinel) and let the next measure get new containers for them. var startRealizedIndex = GetRealizedRangeIndexFromDataIndex(oldStartIndex); for (int realizedIndex = startRealizedIndex; realizedIndex < startRealizedIndex + oldSize; realizedIndex++) { if (m_realizedElements[realizedIndex] is UIElement elementRef) { m_context.RecycleElement(elementRef); m_realizedElements[realizedIndex] = null; } } } else { OnItemsRemoved(oldStartIndex, oldSize); OnItemsAdded(newStartIndex, newSize); } } break; case NotifyCollectionChangedAction.Remove: { OnItemsRemoved(args.OldStartingIndex, args.OldItems.Count); } break; case NotifyCollectionChangedAction.Reset: ClearRealizedRange(); break; case NotifyCollectionChangedAction.Move: int size = args.OldItems != null ? args.OldItems.Count : 1; OnItemsRemoved(args.OldStartingIndex, size); OnItemsAdded(args.NewStartingIndex, size); break; } } } // we do not want copies of this type //public ElementManager(const ElementManager& that) = delete; //public ElementManager& ElementManager::operator=(const ElementManager& other) = delete; public int GetElementDataIndex(UIElement suggestedAnchor) { Debug.Assert(suggestedAnchor != null); var index = m_realizedElements.IndexOf(suggestedAnchor); return index >= 0 ? GetDataIndexFromRealizedRangeIndex(index) : -1; } public int GetDataIndexFromRealizedRangeIndex(int rangeIndex) { Debug.Assert(rangeIndex >= 0 && rangeIndex < GetRealizedElementCount()); return IsVirtualizingContext ? rangeIndex + m_firstRealizedDataIndex : rangeIndex; } private int GetRealizedRangeIndexFromDataIndex(int dataIndex) { Debug.Assert(IsDataIndexRealized(dataIndex)); return IsVirtualizingContext ? dataIndex - m_firstRealizedDataIndex : dataIndex; } private void DiscardElementsOutsideWindow(Rect window, ScrollOrientation orientation) { Debug.Assert(IsVirtualizingContext); Debug.Assert(m_realizedElements.Count == m_realizedElementLayoutBounds.Count); // The following illustration explains the cutoff indices. // We will clear all the realized elements from both ends // up to the corresponding cutoff index. // '-' means the element is outside the cutoff range. // '*' means the element is inside the cutoff range and will be cleared. // // Window: // |______________________________| // Realization range: // |*****----------------------------------*********| // | | // frontCutoffIndex backCutoffIndex // // Note that we tolerate at most one element outside of the window // because the FlowLayoutAlgorithm.Generate routine stops *after* // it laid out an element outside the realization window. // This is also convenient because it protects the anchor // during a BringIntoView operation during which the anchor may // not be in the realization window (in fact, the realization window // might be empty if the BringIntoView is issued before the first // layout pass). int realizedRangeSize = GetRealizedElementCount(); int frontCutoffIndex = -1; int backCutoffIndex = realizedRangeSize; for (int i = 0; i < realizedRangeSize && !Intersects(window, m_realizedElementLayoutBounds[i], orientation); ++i) { ++frontCutoffIndex; } for (int i = realizedRangeSize - 1; i >= 0 && !Intersects(window, m_realizedElementLayoutBounds[i], orientation); --i) { --backCutoffIndex; } if (backCutoffIndex < realizedRangeSize - 1) { ClearRealizedRange(backCutoffIndex + 1, realizedRangeSize - backCutoffIndex - 1); } if (frontCutoffIndex > 0) { ClearRealizedRange(0, Math.Min(frontCutoffIndex, GetRealizedElementCount())); } } private static bool Intersects(Rect lhs, Rect rhs, ScrollOrientation orientation) { var lhsStart = orientation == ScrollOrientation.Vertical ? lhs.Y : lhs.X; var lhsEnd = orientation == ScrollOrientation.Vertical ? lhs.Y + lhs.Height : lhs.X + lhs.Width; var rhsStart = orientation == ScrollOrientation.Vertical ? rhs.Y : rhs.X; var rhsEnd = orientation == ScrollOrientation.Vertical ? rhs.Y + rhs.Height : rhs.X + rhs.Width; return lhsEnd >= rhsStart && lhsStart <= rhsEnd; } private void OnItemsAdded(int index, int count) { // Using the old indices here (before it was updated by the collection change) // if the insert data index is between the first and last realized data index, we need // to insert items. int lastRealizedDataIndex = m_firstRealizedDataIndex + GetRealizedElementCount() - 1; int newStartingIndex = index; if (newStartingIndex >= m_firstRealizedDataIndex && newStartingIndex <= lastRealizedDataIndex) { // Inserted within the realized range int insertRangeStartIndex = newStartingIndex - m_firstRealizedDataIndex; for (int i = 0; i < count; i++) { // Insert null (sentinel) here instead of an element, that way we dont // end up creating a lot of elements only to be thrown out in the next layout. int insertRangeIndex = insertRangeStartIndex + i; int dataIndex = newStartingIndex + i; // This is to keep the contiguousness of the mapping Insert(insertRangeIndex, dataIndex, null); } } else if (index <= m_firstRealizedDataIndex) { // Items were inserted before the realized range. // We need to update m_firstRealizedDataIndex; m_firstRealizedDataIndex += count; } } private void OnItemsRemoved(int index, int count) { int lastRealizedDataIndex = m_firstRealizedDataIndex + m_realizedElements.Count - 1; int startIndex = Math.Max(m_firstRealizedDataIndex, index); int endIndex = Math.Min(lastRealizedDataIndex, index + count - 1); bool removeAffectsFirstRealizedDataIndex = (index <= m_firstRealizedDataIndex); if (endIndex >= startIndex) { ClearRealizedRange(GetRealizedRangeIndexFromDataIndex(startIndex), endIndex - startIndex + 1); } if (removeAffectsFirstRealizedDataIndex && m_firstRealizedDataIndex != -1) { m_firstRealizedDataIndex -= count; } } private bool IsVirtualizingContext { get { if (m_context != null) { var rect = m_context.RealizationRect; bool hasInfiniteSize = double.IsInfinity(rect.Height) || double.IsInfinity(rect.Width); return !hasInfiniteSize; } return false; } } private readonly List<UIElement> m_realizedElements = new List<UIElement>(); private readonly List<Rect> m_realizedElementLayoutBounds = new List<Rect>(); private int m_firstRealizedDataIndex = -1; private VirtualizingLayoutContext m_context; } }
42.253061
200
0.552985
[ "MIT" ]
AlphaNecron/ModernWpf
ModernWpf.Controls/Repeater/Layouts/FlowLayout/ElementManager.cs
20,706
C#
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; using Ianitor.Osp.Backend.Persistence.DataAccess; using Ianitor.Osp.Common.Shared; using Ianitor.Osp.Common.Shared.DataTransferObjects; using Ianitor.Osp.Common.Shared.Exchange; using Newtonsoft.Json; namespace Ianitor.Osp.Backend.Persistence.Commands { internal class ExportRtModel { private readonly ITenantContextInternal _tenantContext; internal ExportRtModel(ITenantContextInternal tenantContext) { _tenantContext = tenantContext; } public async Task Export(IOspSession session, OspObjectId queryId, string filePath, CancellationToken? cancellationToken) { var query = await _tenantContext.Repository.GetRtEntityAsync(session, new RtEntityId(Constants.SystemQueryCkId, queryId)); if (CheckCancellation(cancellationToken)) throw new OperationCanceledException(); if (query == null) { throw new ModelExportException($"Query '{queryId}‘ does not exist."); } DataQueryOperation dataQueryOperation = new DataQueryOperation(); var sortingDtoList = JsonConvert.DeserializeObject<ICollection<SortDto>>(query.GetAttributeStringValueOrDefault("Sorting")); dataQueryOperation.SortOrders = sortingDtoList.Select(dto => new SortOrderItem(dto.AttributeName.ToPascalCase(), (SortOrders) dto.SortOrder)); var fieldFilterDtoList = JsonConvert.DeserializeObject<ICollection<FieldFilterDto>>( query.GetAttributeStringValueOrDefault("FieldFilter")); dataQueryOperation.FieldFilters = fieldFilterDtoList.Select(dto => new FieldFilter(TransformAttributeName(dto.AttributeName), (FieldFilterOperator) dto.Operator, dto.ComparisonValue)); var ckId = query.GetAttributeStringValueOrDefault("QueryCkId"); var resultSet = await _tenantContext.Repository.GetRtEntitiesByTypeAsync(session, ckId, dataQueryOperation); var entityCacheItem = _tenantContext.CkCache.GetEntityCacheItem(ckId); RtModelRoot model = new RtModelRoot(); model.RtEntities.AddRange(resultSet.Result.Select(entity => { var exEntity = new RtEntity { Id = entity.RtId.ToOspObjectId(), WellKnownName = entity.WellKnownName, CkId = entity.CkId, }; exEntity.Attributes.AddRange(entity.Attributes.Select(pair => { var attributeCacheItem = entityCacheItem.Attributes[pair.Key]; return new RtAttribute { Id = attributeCacheItem.AttributeId, Value = pair.Value }; })); return exEntity; })); await using StreamWriter streamWriter = new StreamWriter(filePath); RtSerializer.Serialize(streamWriter, model); await session.CommitTransactionAsync(); } private static string TransformAttributeName(string attributeNameDto) { var attributeName = attributeNameDto.ToPascalCase(); if (attributeName == nameof(RtEntityDto.RtId)) { attributeName = Constants.IdField; } if (attributeName == nameof(RtEntityDto.WellKnownName)) { attributeName = nameof(RtEntity.WellKnownName); } return attributeName; } private static bool CheckCancellation(CancellationToken? cancellationToken) { if (cancellationToken != null && cancellationToken.Value.IsCancellationRequested) { return true; } return false; } } }
37.583333
134
0.620103
[ "MIT" ]
ianitor/ObjectServicePlatform
Osp/Backend/Ianitor.Osp.Backend.Persistence/Commands/ExportRtModel.cs
4,061
C#
// $Id$ // // Copyright 2008-2009 The SharpSvn Project // // 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. using System; using System.Collections.Generic; using System.Text; using System.Management.Automation; namespace SharpSvn.PowerShell.Commands { public sealed class SvnMerge : SvnSingleTargetCommand<SvnMergeArgs> { string _source; SvnMergeRange[] _mergeRanges; [Parameter(Position = 1, Mandatory = true)] [ValidateNotNullOrEmpty] public string Source { get { return _source; ; } set { _source = value; } } [Parameter] public SvnMergeRange[] MergeRanges { get { return _mergeRanges; } set { _mergeRanges = value; } } public TSource GetSource<TSource>() where TSource : SvnTarget { SvnTarget rslt; if (SvnTarget.TryParse(Source, out rslt)) return rslt as TSource; return null; } protected override void ProcessRecord() { Client.Merge(Target, GetSource<SvnTarget>(), new List<SvnMergeRange>(MergeRanges), SvnArguments); } } }
29.448276
109
0.637588
[ "Apache-2.0" ]
AmpScm/SharpSvn
contrib/PowerShell/SharpSvn/Commands/SvnMerge.cs
1,708
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 chime-2018-05-01.normal.json service model. */ using System; using System.Collections.Generic; using System.Xml.Serialization; using System.Text; using System.IO; using System.Net; using Amazon.Runtime; using Amazon.Runtime.Internal; namespace Amazon.Chime.Model { /// <summary> /// Container for the parameters to the DeleteProxySession operation. /// Deletes the specified proxy session from the specified Amazon Chime Voice Connector. /// </summary> public partial class DeleteProxySessionRequest : AmazonChimeRequest { private string _proxySessionId; private string _voiceConnectorId; /// <summary> /// Gets and sets the property ProxySessionId. /// <para> /// The proxy session ID. /// </para> /// </summary> [AWSProperty(Required=true, Min=1, Max=128)] public string ProxySessionId { get { return this._proxySessionId; } set { this._proxySessionId = value; } } // Check to see if ProxySessionId property is set internal bool IsSetProxySessionId() { return this._proxySessionId != null; } /// <summary> /// Gets and sets the property VoiceConnectorId. /// <para> /// The Amazon Chime voice connector ID. /// </para> /// </summary> [AWSProperty(Required=true, Min=1, Max=128)] public string VoiceConnectorId { get { return this._voiceConnectorId; } set { this._voiceConnectorId = value; } } // Check to see if VoiceConnectorId property is set internal bool IsSetVoiceConnectorId() { return this._voiceConnectorId != null; } } }
31.658228
104
0.617353
[ "Apache-2.0" ]
philasmar/aws-sdk-net
sdk/src/Services/Chime/Generated/Model/DeleteProxySessionRequest.cs
2,501
C#
using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Threading.Tasks; namespace ECom.Web.Services { public class RequestLoggingMiddleware { private readonly RequestDelegate _next; private readonly ILogger<RequestLoggingMiddleware> _logger; public RequestLoggingMiddleware(RequestDelegate next, ILogger<RequestLoggingMiddleware> logger) { _next = next; _logger = logger; } public async Task Invoke(HttpContext context) { var startTime = DateTime.UtcNow; var watch = Stopwatch.StartNew(); await _next.Invoke(context); watch.Stop(); var logTemplate = @"Client IP: {clientIP} Request path: {requestPath} Request content type: {requestContentType} Request content length: {requestContentLength} Start time: {startTime} Duration: {duration}"; _logger.LogInformation(logTemplate, context.Connection.RemoteIpAddress.ToString(), context.Request.Path, context.Request.ContentType, context.Request.ContentLength, startTime, watch.ElapsedMilliseconds); } } }
32
103
0.581782
[ "MIT" ]
nabinkjha/Ecom
ECom.Web/Services/RequestLoggingMiddleware.cs
1,506
C#
using System; using System.Collections.Generic; using System.Configuration; using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; using SendGrid; using SendGrid.Helpers.Mail; using System.Threading.Tasks; using iCoreService.Models; namespace iCoreService.Controllers { /// <summary> /// Provides in-application feedback. /// </summary> public class FeedbackController : ApiController { private string feedbackMailTo = ConfigurationManager.AppSettings["FeedbackMailTo"]; private string feedbackMailFrom = ConfigurationManager.AppSettings["FeedbackMailFrom"]; private string feedbackSubject = ConfigurationManager.AppSettings["FeedbackSubject"]; private string sendGridApiKey = ConfigurationManager.AppSettings["SendGridApiKey"]; /// <summary> /// Receives end-user feedback from the application and mails it to the development team. /// </summary> /// <param name="feedback">A JSON document containnig the end-user feedback and runtime environment information.</param> /// <returns></returns> public async Task<HttpResponseMessage> PostFeedback([FromBody]Feedback feedback) { HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.InternalServerError); try { await SendFeedback(feedback); response.StatusCode = HttpStatusCode.OK; } catch (Exception ex) { return new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent(ex.Message) }; } return response; } async Task SendFeedback(Feedback feedback) { var client = new SendGridClient(this.sendGridApiKey); var from = new EmailAddress(feedbackMailFrom, "Digital Archive Feedback");; var to = new EmailAddress(feedbackMailTo); var msg = MailHelper.CreateSingleEmail(from, to, this.feedbackSubject, feedback.ToString(), null); var response = await client.SendEmailAsync(msg); } } }
35.390625
128
0.643709
[ "MIT" ]
mikechristel/iCoreService-Digital-Archive-API
iCoreService/Controllers/FeedbackController.cs
2,267
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 WebAclRuleStatementRateBasedStatementScopeDownStatementNotStatementStatementOrStatementStatementIpSetReferenceStatementGetArgs : Pulumi.ResourceArgs { /// <summary> /// The Amazon Resource Name (ARN) of the IP Set that this statement references. /// </summary> [Input("arn", required: true)] public Input<string> Arn { get; set; } = null!; public WebAclRuleStatementRateBasedStatementScopeDownStatementNotStatementStatementOrStatementStatementIpSetReferenceStatementGetArgs() { } } }
35.884615
172
0.733119
[ "ECL-2.0", "Apache-2.0" ]
mdop-wh/pulumi-aws
sdk/dotnet/WafV2/Inputs/WebAclRuleStatementRateBasedStatementScopeDownStatementNotStatementStatementOrStatementStatementIpSetReferenceStatementGetArgs.cs
933
C#
using GizmoFort.Connector.ERPNext.PublicTypes; using GizmoFort.Connector.ERPNext.WrapperTypes; using System.ComponentModel; namespace GizmoFort.Connector.ERPNext.ERPTypes.Payment_terms_template { public class ERPPayment_terms_template : ERPNextObjectBase { public ERPPayment_terms_template() : this(new ERPObject(DocType.Payment_terms_template)) { } public ERPPayment_terms_template(ERPObject obj) : base(obj) { } public static ERPPayment_terms_template Create(string terms) { ERPPayment_terms_template obj = new ERPPayment_terms_template(); obj.terms = terms; return obj; } public string terms { get { return data.terms; } set { data.terms = value; data.name = value; } } public string template_name { get { return data.template_name; } set { data.template_name = value; } } public long allocate_payment_based_on_payment_terms { get { return data.allocate_payment_based_on_payment_terms; } set { data.allocate_payment_based_on_payment_terms = value; } } } //Enums go here }
27.148936
100
0.616771
[ "MIT" ]
dmequus/gizmofort.connector.erpnext
Libs/GizmoFort.Connector.ERPNext/ERPTypes/Payment_terms_template/ERPPayment_terms_template.cs
1,276
C#
// This file is auto-generated, don't edit it. Thanks. using System; using System.Collections.Generic; using System.IO; using Tea; namespace Aliyun.SDK.CCP.CCPClient.Models { public class ListTagsRequestModel : TeaModel { [NameInMap("headers")] [Validation(Required=false)] public Dictionary<string, string> Headers { get; set; } [NameInMap("body")] [Validation(Required=true)] public ListImageTagsRequest Body { get; set; } } }
21.347826
63
0.663951
[ "Apache-2.0" ]
aliyun/aliyun-ccp
ccppath-sdk/cs/core/Models/ListTagsRequestModel.cs
491
C#
using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; namespace NumericTextboxControl { public partial class UserControl1 : UserControl { public UserControl1() { InitializeComponent(); } } }
18.55
51
0.698113
[ "MIT" ]
bobbyache/CsPrototypes
NumericTextBox/NumericTextboxControl/UserControl1.cs
373
C#
using System; using System.Collections; using System.Collections.Generic; using System.Globalization; using System.Linq; using UnityEngine; using DTLocalization.Internal; using GDataDB; namespace DTLocalization { public class LocalizationConfiguration : MonoBehaviour { // PRAGMA MARK - Public Static Interface public static Font DowngradedFont { get { if (downgradedFont_ == null) { Debug.LogWarning("downgradedFont_ not found - using first font found in resources (Arial?)! Specify a downgradedFont in your LocalizationConfiguration!"); downgradedFont_ = Resources.FindObjectsOfTypeAll<Font>()[0]; } return downgradedFont_; } } private static Font downgradedFont_ = null; // PRAGMA MARK - Public Interface public IEnumerable<ILocalizationTableSource> TableSources { get { return gdataTableSources_.Cast<ILocalizationTableSource>(); } } // PRAGMA MARK - Internal [Header("Outlets")] [SerializeField] private GDatabaseSource[] gdataTableSources_; [SerializeField] private Font defaultDowngradedFont_; private void Awake() { if (defaultDowngradedFont_ != null) { downgradedFont_ = defaultDowngradedFont_; } } } }
24.875
159
0.746231
[ "MIT" ]
DarrenTsung/DTLocalization
LocalizationConfiguration.cs
1,194
C#
using System; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using PlexRequests.DataAccess.Enums; namespace PlexRequests.Functions.Features.Search.Models { public class MovieSearchModel { public int Id { get; set; } public string Title { get; set; } public string Overview { get; set; } public string PosterPath { get; set; } public string BackdropPath { get; set; } public DateTime? ReleaseDate { get; set; } [JsonConverter(typeof(StringEnumConverter))] public RequestStatuses? RequestStatus { get; set; } public string PlexMediaUri { get; set; } } }
30.857143
59
0.665123
[ "MIT" ]
Jbond312/PlexRequestsApi
src/PlexRequests.Functions/Features/Search/Models/MovieSearchModel.cs
650
C#
using System; using System.Linq; using System.Reflection; using Microsoft.Extensions.DependencyInjection; using Refit; namespace PS.Web.Api.Client { public static class ServiceCollectionExtensions { public static IParkingSpaceWebApiClientBuilder AddParkingSpaceWebApiClient(this IServiceCollection services, Action<ParkingSpaceWebApiOptionsBuilder> buildAction) { var optsBuilder = new ParkingSpaceWebApiOptionsBuilder(); buildAction?.Invoke(optsBuilder); var opts = optsBuilder.Build(); var t = typeof(AssemblyMarker).Assembly .HttpInterfaces() .ToList(); typeof(AssemblyMarker).Assembly .HttpInterfaces() .ToList() .ForEach(httpType => { services .AddRefitClient(httpType) .ConfigureHttpClient(http => { http.BaseAddress = new Uri(opts.BaseUrl); }) .AddHttpMessageHandler<BearerTokenDelegatingHandler>() ; } ); services.AddScoped<BearerTokenDelegatingHandler>(); services.AddDefaults(); var builder = new ParkingSpaceWebApiClientBuilder(services); return builder; } private static IServiceCollection AddDefaults(this IServiceCollection services) { typeof(AssemblyMarker).Assembly .GetTypes() .Where(t => t.GetCustomAttributes().Any(a => a.GetType() == typeof(DefaultForAttribute)) ) .ToList() .ForEach(concreteType => { var attr = concreteType.GetCustomAttribute(typeof(DefaultForAttribute)) as DefaultForAttribute; services.AddScoped(attr.Abstract, concreteType); services.AddScoped(concreteType); }); return services; } } }
27.523077
166
0.647289
[ "Apache-2.0" ]
hypnot1c/ParkingSpace
src/BuildingBlocks/Api/Clients/ParkingSpace/PS.Web.Api.Client.Http.Refit.DependencyInjection/Extensions/ServiceCollectionExtensions.cs
1,789
C#
using System; using FluentValidation; using OpenRealEstate.Core.Models; namespace OpenRealEstate.Validation { public class AggregateRootValidator<T> : AbstractValidator<T> where T : AggregateRoot { public AggregateRootValidator() { RuleFor(aggregateRoot => aggregateRoot.Id).NotEmpty() .WithMessage("An 'Id' is required. eg. RayWhite.Kew, Belle.Mosman69, 12345XXAbCdE"); RuleFor(aggregateRoot => aggregateRoot.UpdatedOn).NotEqual(DateTime.MinValue) .WithMessage("A valid 'UpdatedOn' is required. Please use a date/time value that is in this decade or so."); } } }
37.555556
125
0.659763
[ "MIT" ]
OpenRealEstate/OpenRealEstate.NET
Code/OpenRealEstate.Validation/AggregateRootValidator.cs
678
C#
using FluentAssertions; using Moq; using System.Net; using System.Threading.Tasks; using WireMock.Models; using WireMock.ResponseBuilders; using WireMock.Settings; using Xunit; namespace WireMock.Net.Tests.ResponseBuilders { public class ResponseWithStatusCodeTests { private readonly Mock<IWireMockServerSettings> _settingsMock = new Mock<IWireMockServerSettings>(); private const string ClientIp = "::1"; [Theory] [InlineData("201", "201")] [InlineData(201, 201)] [InlineData(HttpStatusCode.Created, 201)] public async Task Response_ProvideResponse_WithStatusCode(object statusCode, object expectedStatusCode) { // Arrange var request = new RequestMessage(new UrlDetails("http://localhost/fault"), "GET", ClientIp); // Act var responseBuilder = Response.Create(); switch (statusCode) { case string statusCodeAsString: responseBuilder = responseBuilder.WithStatusCode(statusCodeAsString); break; case int statusCodeAInteger: responseBuilder = responseBuilder.WithStatusCode(statusCodeAInteger); break; case HttpStatusCode statusCodeAsEnum: responseBuilder = responseBuilder.WithStatusCode(statusCodeAsEnum); break; } var response = await responseBuilder.ProvideResponseAsync(request, _settingsMock.Object).ConfigureAwait(false); // Assert response.Message.StatusCode.Should().Be(expectedStatusCode); } } }
33.72
123
0.634638
[ "Apache-2.0" ]
WireMock-Net/WireMock.Net
test/WireMock.Net.Tests/ResponseBuilders/ResponseWithStatusCodeTests.cs
1,686
C#
/* =============================================================================== EntitySpaces 2009 by EntitySpaces, LLC Persistence Layer and Business Objects for Microsoft .NET EntitySpaces(TM) is a legal trademark of EntitySpaces, LLC http://www.entityspaces.net =============================================================================== EntitySpaces Version : 2009.2.1214.0 EntitySpaces Driver : SQL Date Generated : 1/15/2010 6:52:27 PM =============================================================================== */ using System; using System.ComponentModel; using System.Collections.Generic; using System.Text; using System.Data; using EntitySpaces.Interfaces; using EntitySpaces.Core; namespace BusinessObjects { public partial class ReferredEmployee : esReferredEmployee { public ReferredEmployee() { } } }
27.848485
79
0.511425
[ "Unlicense" ]
EntitySpaces/EntitySpaces-CompleteSource
Tests/CSharp/TestSqlServer35/TestSqlServer35/BusinessObjects/Custom/ForeignKeyTest/ReferredEmployee.cs
919
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Dominio { public class Persona { string nombre; string apellido; string documento; int edad; public string Nombre { get => nombre; set => nombre = value; } public string Apellido { get => apellido; set => apellido = value; } public string Documento { get => documento; set => documento = value; } public int Edad { get => edad; set => edad = value; } } }
22.538462
79
0.59215
[ "MIT" ]
IvanAP1791/Prueba
Dominio/Persona.cs
588
C#
/////////////////////////////////////////////////////////////////////////////////// // Open 3D Model Viewer (open3mod) (v2.0) // [ExportDialog.cs] // (c) 2012-2015, Open3Mod Contributors // // Licensed under the terms and conditions of the 3-clause BSD license. See // the LICENSE file in the root folder of the repository for the details. // // HIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR // ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /////////////////////////////////////////////////////////////////////////////////// using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Threading; using System.Windows.Forms; using Assimp; namespace open3mod { public partial class ExportDialog : Form { private readonly MainWindow _main; private readonly ExportFormatDescription[] _formats; private bool _changedText = false; public string SelectedFormatId { get { return _formats[comboBoxExportFormats.SelectedIndex].FormatId; } } public ExportFormatDescription SelectedFormat { get { return _formats[comboBoxExportFormats.SelectedIndex]; } } public ExportDialog(MainWindow main) { _main = main; InitializeComponent(); using (var v = new AssimpContext()) { _formats = v.GetSupportedExportFormats(); foreach (var format in _formats) { comboBoxExportFormats.Items.Add(format.Description + " (" + format.FileExtension + ")"); } comboBoxExportFormats.SelectedIndex = ExportSettings.Default.ExportFormatIndex; comboBoxExportFormats.SelectedIndexChanged += (object s, EventArgs e) => { ExportSettings.Default.ExportFormatIndex = comboBoxExportFormats.SelectedIndex; UpdateFileName(true); }; } textBoxFileName.KeyPress += (object s, KeyPressEventArgs e) => { _changedText = true; }; // Respond to updates in the main window - the export dialog is non-modal and // always takes the currently selected file at the time the export button // is pressed. _main.SelectedTabChanged += (Tab tab) => { UpdateFileName(); UpdateCaption(); }; UpdateFileName(); UpdateCaption(); } private void UpdateCaption() { string str = "Export "; var scene = _main.UiState.ActiveTab.ActiveScene; if (scene != null) { str += Path.GetFileName(scene.File); buttonExportRun.Enabled = true; } else { buttonExportRun.Enabled = false; str += "<no scene currently selected>"; } Text = str; } private void UpdateFileName(bool extensionOnly = false) { string str = textBoxFileName.Text; if (!extensionOnly && !_changedText) { var scene = _main.UiState.ActiveTab.ActiveScene; if (scene != null) { str = Path.GetFileName(scene.File); } } textBoxFileName.Text = Path.ChangeExtension(str, SelectedFormat.FileExtension); } private void buttonSelectFolder_Click(object sender, EventArgs e) { folderBrowserDialog.ShowDialog(this); textBoxPath.Text = folderBrowserDialog.SelectedPath; } private void buttonExport(object sender, EventArgs e) { var scene = _main.UiState.ActiveTab.ActiveScene; if (scene == null) { MessageBox.Show("No exportable scene selected"); return; } DoExport(scene, SelectedFormatId); } private void DoExport(Scene scene, string id) { var overwriteWithoutConfirmation = checkBoxNoOverwriteConfirm.Checked; var path = textBoxPath.Text.Trim(); path = (path.Length > 0 ? path : scene.BaseDir); var name = textBoxFileName.Text.Trim(); var fullPath = Path.Combine(path, name); if (!overwriteWithoutConfirmation && Path.GetFullPath(fullPath) == Path.GetFullPath(scene.File)) { if (MessageBox.Show("This will overwrite the current scene's source file. Continue?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { PushLog("Canceled"); return; } } var copyTextures = checkBoxCopyTexturesToSubfolder.Checked; var relativeTexturePaths = checkBoxUseRelativeTexturePaths.Checked; var includeAnimations = checkBoxIncludeAnimations.Checked; var includeSceneHierarchy = checkBoxIncludeSceneHierarchy.Checked; var textureCopyJobs = new Dictionary<string, string>(); var textureDestinationFolder = textBoxCopyTexturesToFolder.Text; PushLog("*** Export: " + scene.File); if(copyTextures) { try { Directory.CreateDirectory(Path.Combine(path, textureDestinationFolder)); } catch (Exception) { PushLog("Failed to create texture destination directory " + Path.Combine(path, textureDestinationFolder)); return; } } progressBarExport.Style = ProgressBarStyle.Marquee; progressBarExport.MarqueeAnimationSpeed = 5; // Create a shallow copy of the original scene that replaces all the texture paths with their // corresponding output paths, and omits animations if requested. var sourceScene = new Assimp.Scene { /* //ASSIMP410 Textures = scene.Raw.Textures, SceneFlags = scene.Raw.SceneFlags, RootNode = scene.Raw.RootNode, Meshes = scene.Raw.Meshes, Lights = scene.Raw.Lights, Cameras = scene.Raw.Cameras */ }; if (includeAnimations) { ////ASSIMP410 sourceScene.Animations = scene.Raw.Animations; } var uniques = new HashSet<string>(); var textureMapping = new Dictionary<string, string>(); PushLog("Locating all textures"); foreach (var texId in scene.TextureSet.GetTextureIds()) { // TODO(acgessler): Verify if this handles texture replacements and GUID-IDs correctly. var destName = texId; // Broadly skip over embedded (in-memory) textures if (destName.StartsWith("*")) { PushLog("Ignoring embedded texture: " + destName); continue; } // Locate the texture on-disk string diskLocation; try { TextureLoader.ObtainStream(texId, scene.BaseDir, out diskLocation).Close(); } catch(IOException) { PushLog("Failed to locate texture " + texId); continue; } if (copyTextures) { destName = GeUniqueTextureExportPath(path, textureDestinationFolder, diskLocation, uniques); } if (relativeTexturePaths) { textureMapping[texId] = GetRelativePath(path + "\\", destName); } else { textureMapping[texId] = destName; } textureCopyJobs[diskLocation] = destName; PushLog("Texture " + texId + " maps to " + textureMapping[texId]); } foreach (var mat in scene.Raw.Materials) { sourceScene.Materials.Add(CloneMaterial(mat, textureMapping)); } var t = new Thread(() => { using (var v = new AssimpContext()) { PushLog("Exporting using Assimp to " + fullPath + ", using format id: " + id); var result = v.ExportFile(sourceScene, fullPath, id, includeSceneHierarchy ? PostProcessSteps.None : PostProcessSteps.PreTransformVertices); _main.BeginInvoke(new MethodInvoker(() => { progressBarExport.Style = ProgressBarStyle.Continuous; progressBarExport.MarqueeAnimationSpeed = 0; if (!result) { // TODO: get native error message PushLog("Export failure"); MessageBox.Show("Failed to export to " + fullPath, "Export error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (copyTextures) { PushLog("Copying textures"); foreach (var kv in textureCopyJobs) { PushLog(" ... " + kv.Key + " -> " + kv.Value); try { File.Copy(kv.Key, kv.Value, false); } catch (IOException) { if (!File.Exists(kv.Value)) { throw; } if (!overwriteWithoutConfirmation && MessageBox.Show("Texture " + kv.Value + " already exists. Overwrite?", "Overwrite Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { PushLog("Exists already, skipping"); continue; } PushLog("Exists already, overwriting"); File.Copy(kv.Key, kv.Value, true); } catch (Exception ex) { PushLog(ex.Message); } } } if (checkBoxOpenExportedFile.Checked) { _main.AddTab(fullPath, true, false); } PushLog("Export completed"); } })); } }); t.Start(); } private static string GeUniqueTextureExportPath(string exportBasePath, string textureDestinationFolder, string diskLocation, HashSet<string> uniques) { string baseFileName = Path.GetFileNameWithoutExtension(diskLocation); string destName; var count = 1; // Enforce unique output names do { destName = Path.Combine(exportBasePath, Path.Combine(textureDestinationFolder, baseFileName + (count == 1 ? "" : (count.ToString(CultureInfo.InvariantCulture) + "_")) + Path.GetExtension(diskLocation) )); ++count; } while (uniques.Contains(destName)); uniques.Add(destName); return destName; } private void PushLog(string message) { _main.BeginInvoke(new MethodInvoker(() => { textBoxExportLog.Text += message + Environment.NewLine; textBoxExportLog.SelectionStart = textBoxExportLog.TextLength; textBoxExportLog.ScrollToCaret(); })); } /// <summary> /// Clone a given material subject to a texture path remapping /// </summary> /// <param name="mat"></param> /// <param name="textureMapping"></param> /// <returns></returns> private static Material CloneMaterial(Material mat, Dictionary<string, string> textureMapping) { Debug.Assert(mat != null); Debug.Assert(textureMapping != null); var matOut = new Material(); foreach (var prop in mat.GetAllProperties()) { var propOut = prop; if (prop.PropertyType == PropertyType.String && textureMapping.ContainsKey(prop.GetStringValue())) { propOut = new MaterialProperty {PropertyType = PropertyType.String, Name = prop.Name}; propOut.TextureIndex = prop.TextureIndex; propOut.TextureType = prop.TextureType; propOut.SetStringValue(textureMapping[prop.GetStringValue()]); } matOut.AddProperty(propOut); } return matOut; } // From http://stackoverflow.com/questions/9042861/how-to-make-an-absolute-path-relative-to-a-particular-folder public static string GetRelativePath(string fromPath, string toPath) { var fromUri = new Uri(Path.GetFullPath(fromPath), UriKind.Absolute); var toUri = new Uri(Path.GetFullPath(toPath), UriKind.Absolute); return fromUri.MakeRelativeUri(toUri).ToString(); } } } /* vi: set shiftwidth=4 tabstop=4: */
39.715013
126
0.488467
[ "MIT" ]
WildGenie/vrs
open3mod/ExportDialog.cs
15,608
C#
// ***************************************************************************** // BSD 3-Clause License (https://github.com/ComponentFactory/Krypton/blob/master/LICENSE) // © Component Factory Pty Ltd, 2006 - 2016, All rights reserved. // The software and associated documentation supplied hereunder are the // proprietary information of Component Factory Pty Ltd, 13 Swallows Close, // Mornington, Vic 3931, Australia and are supplied subject to license terms. // // Modifications by Peter Wagner(aka Wagnerp) & Simon Coghlan(aka Smurf-IV) 2017 - 2020. All rights reserved. (https://github.com/Wagnerp/Krypton-NET-5.490) // Version 5.490.0.0 www.ComponentFactory.com // ***************************************************************************** using ComponentFactory.Krypton.Toolkit; namespace ComponentFactory.Krypton.Navigator { /// <summary> /// Custom type converter so that BarItemSizing values appear as neat text at design time. /// </summary> public class BarItemSizingConverter : StringLookupConverter { #region Static Fields #endregion #region Identity /// <summary> /// Initialize a new instance of the BarItemSizingConverter clas. /// </summary> public BarItemSizingConverter() : base(typeof(BarItemSizing)) { } #endregion #region Protected /// <summary> /// Gets an array of lookup pairs. /// </summary> protected override Pair[] Pairs { get; } = { new Pair(BarItemSizing.Individual, "Individual Sizing"), new Pair(BarItemSizing.SameHeight, "All Same Height"), new Pair(BarItemSizing.SameWidth, "All Same Width"), new Pair(BarItemSizing.SameWidthAndHeight, "All Same Width & Height") }; #endregion } }
40.0625
157
0.579303
[ "BSD-3-Clause" ]
Carko/Krypton-Toolkit-Suite-NET-Core
Source/Krypton Components/ComponentFactory.Krypton.Navigator/Converters/BarItemSizingConverter.cs
1,926
C#
using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Linq; using System.Reflection; using System.Threading.Tasks; using System.Windows.Forms; namespace CSharpBible.AboutEx.Visual { partial class AboutBox1 : Form { public AboutBox1() { InitializeComponent(); this.Text = String.Format("Info über {0}", AssemblyTitle); this.labelProductName.Text = AssemblyProduct; this.labelVersion.Text = String.Format("Version {0}", AssemblyVersion); this.labelCopyright.Text = AssemblyCopyright; this.labelCompanyName.Text = AssemblyCompany; this.textBoxDescription.Text = AssemblyDescription; } #region Assemblyattributaccessoren public string AssemblyTitle { get { object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false); if (attributes.Length > 0) { AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0]; if (titleAttribute.Title != "") { return titleAttribute.Title; } } return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase); } } public string AssemblyVersion { get { return Assembly.GetExecutingAssembly().GetName().Version.ToString(); } } public string AssemblyDescription { get { object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false); if (attributes.Length == 0) { return ""; } return ((AssemblyDescriptionAttribute)attributes[0]).Description; } } public string AssemblyProduct { get { object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false); if (attributes.Length == 0) { return ""; } return ((AssemblyProductAttribute)attributes[0]).Product; } } public string AssemblyCopyright { get { object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false); if (attributes.Length == 0) { return ""; } return ((AssemblyCopyrightAttribute)attributes[0]).Copyright; } } public string AssemblyCompany { get { object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false); if (attributes.Length == 0) { return ""; } return ((AssemblyCompanyAttribute)attributes[0]).Company; } } #endregion private void okButton_Click(object sender, EventArgs e) { Close(); } } }
31.477477
135
0.533486
[ "MIT" ]
joecare99/CSharp
CSharpBible/AboutEx/Visual/AboutBox1.cs
3,497
C#
using System; using System.ComponentModel; using System.Globalization; using System.Web; using System.Web.UI; using Microsoft.Web.Mvc.Properties; namespace Microsoft.Web.Mvc.Controls { public class Label : MvcControl { private string _format; private string _name; private int _truncateLength = -1; private string _truncateText = "..."; [DefaultValue(EncodeType.Html)] public EncodeType EncodeType { get; set; } [DefaultValue("")] public string Format { get { return _format ?? String.Empty; } set { _format = value; } } [DefaultValue("")] public string Name { get { return _name ?? String.Empty; } set { _name = value; } } [DefaultValue(-1)] [Description("The length of the text at which to truncate the value. Set to -1 to never truncate.")] public int TruncateLength { get { return _truncateLength; } set { if (value < -1) { throw new ArgumentOutOfRangeException("value", "The TruncateLength property must be greater than or equal to -1."); } _truncateLength = value; } } [DefaultValue("...")] [Description("The text to display at the end of the string if it is truncated. This text is never encoded.")] public string TruncateText { get { return _truncateText ?? String.Empty; } set { _truncateText = value; } } protected override void Render(HtmlTextWriter writer) { if (!DesignMode && String.IsNullOrEmpty(Name)) { throw new InvalidOperationException(MvcResources.CommonControls_NameRequired); } string stringValue = String.Empty; if (ViewData != null) { object rawValue = ViewData.Eval(Name); if (String.IsNullOrEmpty(Format)) { stringValue = Convert.ToString(rawValue, CultureInfo.CurrentCulture); } else { stringValue = String.Format(CultureInfo.CurrentCulture, Format, rawValue); } } writer.AddAttribute(HtmlTextWriterAttribute.Name, Name); if (!String.IsNullOrEmpty(ID)) { writer.AddAttribute(HtmlTextWriterAttribute.Id, ID); } bool wasTruncated = false; if ((TruncateLength >= 0) && (stringValue.Length > TruncateLength)) { stringValue = stringValue.Substring(0, TruncateLength); wasTruncated = true; } switch (EncodeType) { case EncodeType.Html: writer.Write(HttpUtility.HtmlEncode(stringValue)); break; case EncodeType.HtmlAttribute: writer.Write(HttpUtility.HtmlAttributeEncode(stringValue)); break; case EncodeType.None: writer.Write(stringValue); break; } if (wasTruncated) { writer.Write(TruncateText); } } } }
30.589286
135
0.516346
[ "Apache-2.0" ]
douchedetector/mvc-razor
src/Microsoft.Web.Mvc/Controls/Label.cs
3,428
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.ContainerService.V20200701 { /// <summary> /// AgentPoolMode represents mode of an agent pool /// </summary> [EnumType] public readonly struct AgentPoolMode : IEquatable<AgentPoolMode> { private readonly string _value; private AgentPoolMode(string value) { _value = value ?? throw new ArgumentNullException(nameof(value)); } public static AgentPoolMode System { get; } = new AgentPoolMode("System"); public static AgentPoolMode User { get; } = new AgentPoolMode("User"); public static bool operator ==(AgentPoolMode left, AgentPoolMode right) => left.Equals(right); public static bool operator !=(AgentPoolMode left, AgentPoolMode right) => !left.Equals(right); public static explicit operator string(AgentPoolMode value) => value._value; [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object? obj) => obj is AgentPoolMode other && Equals(other); public bool Equals(AgentPoolMode other) => string.Equals(_value, other._value, StringComparison.Ordinal); [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value?.GetHashCode() ?? 0; public override string ToString() => _value; } /// <summary> /// AgentPoolType represents types of an agent pool /// </summary> [EnumType] public readonly struct AgentPoolType : IEquatable<AgentPoolType> { private readonly string _value; private AgentPoolType(string value) { _value = value ?? throw new ArgumentNullException(nameof(value)); } public static AgentPoolType VirtualMachineScaleSets { get; } = new AgentPoolType("VirtualMachineScaleSets"); public static AgentPoolType AvailabilitySet { get; } = new AgentPoolType("AvailabilitySet"); public static bool operator ==(AgentPoolType left, AgentPoolType right) => left.Equals(right); public static bool operator !=(AgentPoolType left, AgentPoolType right) => !left.Equals(right); public static explicit operator string(AgentPoolType value) => value._value; [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object? obj) => obj is AgentPoolType other && Equals(other); public bool Equals(AgentPoolType 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 private link service connection status. /// </summary> [EnumType] public readonly struct ConnectionStatus : IEquatable<ConnectionStatus> { private readonly string _value; private ConnectionStatus(string value) { _value = value ?? throw new ArgumentNullException(nameof(value)); } public static ConnectionStatus Pending { get; } = new ConnectionStatus("Pending"); public static ConnectionStatus Approved { get; } = new ConnectionStatus("Approved"); public static ConnectionStatus Rejected { get; } = new ConnectionStatus("Rejected"); public static ConnectionStatus Disconnected { get; } = new ConnectionStatus("Disconnected"); public static bool operator ==(ConnectionStatus left, ConnectionStatus right) => left.Equals(right); public static bool operator !=(ConnectionStatus left, ConnectionStatus right) => !left.Equals(right); public static explicit operator string(ConnectionStatus value) => value._value; [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object? obj) => obj is ConnectionStatus other && Equals(other); public bool Equals(ConnectionStatus other) => string.Equals(_value, other._value, StringComparison.Ordinal); [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value?.GetHashCode() ?? 0; public override string ToString() => _value; } /// <summary> /// Size of agent VMs. /// </summary> [EnumType] public readonly struct ContainerServiceVMSizeTypes : IEquatable<ContainerServiceVMSizeTypes> { private readonly string _value; private ContainerServiceVMSizeTypes(string value) { _value = value ?? throw new ArgumentNullException(nameof(value)); } public static ContainerServiceVMSizeTypes Standard_A1 { get; } = new ContainerServiceVMSizeTypes("Standard_A1"); public static ContainerServiceVMSizeTypes Standard_A10 { get; } = new ContainerServiceVMSizeTypes("Standard_A10"); public static ContainerServiceVMSizeTypes Standard_A11 { get; } = new ContainerServiceVMSizeTypes("Standard_A11"); public static ContainerServiceVMSizeTypes Standard_A1_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_A1_v2"); public static ContainerServiceVMSizeTypes Standard_A2 { get; } = new ContainerServiceVMSizeTypes("Standard_A2"); public static ContainerServiceVMSizeTypes Standard_A2_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_A2_v2"); public static ContainerServiceVMSizeTypes Standard_A2m_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_A2m_v2"); public static ContainerServiceVMSizeTypes Standard_A3 { get; } = new ContainerServiceVMSizeTypes("Standard_A3"); public static ContainerServiceVMSizeTypes Standard_A4 { get; } = new ContainerServiceVMSizeTypes("Standard_A4"); public static ContainerServiceVMSizeTypes Standard_A4_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_A4_v2"); public static ContainerServiceVMSizeTypes Standard_A4m_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_A4m_v2"); public static ContainerServiceVMSizeTypes Standard_A5 { get; } = new ContainerServiceVMSizeTypes("Standard_A5"); public static ContainerServiceVMSizeTypes Standard_A6 { get; } = new ContainerServiceVMSizeTypes("Standard_A6"); public static ContainerServiceVMSizeTypes Standard_A7 { get; } = new ContainerServiceVMSizeTypes("Standard_A7"); public static ContainerServiceVMSizeTypes Standard_A8 { get; } = new ContainerServiceVMSizeTypes("Standard_A8"); public static ContainerServiceVMSizeTypes Standard_A8_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_A8_v2"); public static ContainerServiceVMSizeTypes Standard_A8m_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_A8m_v2"); public static ContainerServiceVMSizeTypes Standard_A9 { get; } = new ContainerServiceVMSizeTypes("Standard_A9"); public static ContainerServiceVMSizeTypes Standard_B2ms { get; } = new ContainerServiceVMSizeTypes("Standard_B2ms"); public static ContainerServiceVMSizeTypes Standard_B2s { get; } = new ContainerServiceVMSizeTypes("Standard_B2s"); public static ContainerServiceVMSizeTypes Standard_B4ms { get; } = new ContainerServiceVMSizeTypes("Standard_B4ms"); public static ContainerServiceVMSizeTypes Standard_B8ms { get; } = new ContainerServiceVMSizeTypes("Standard_B8ms"); public static ContainerServiceVMSizeTypes Standard_D1 { get; } = new ContainerServiceVMSizeTypes("Standard_D1"); public static ContainerServiceVMSizeTypes Standard_D11 { get; } = new ContainerServiceVMSizeTypes("Standard_D11"); public static ContainerServiceVMSizeTypes Standard_D11_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_D11_v2"); public static ContainerServiceVMSizeTypes Standard_D11_v2_Promo { get; } = new ContainerServiceVMSizeTypes("Standard_D11_v2_Promo"); public static ContainerServiceVMSizeTypes Standard_D12 { get; } = new ContainerServiceVMSizeTypes("Standard_D12"); public static ContainerServiceVMSizeTypes Standard_D12_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_D12_v2"); public static ContainerServiceVMSizeTypes Standard_D12_v2_Promo { get; } = new ContainerServiceVMSizeTypes("Standard_D12_v2_Promo"); public static ContainerServiceVMSizeTypes Standard_D13 { get; } = new ContainerServiceVMSizeTypes("Standard_D13"); public static ContainerServiceVMSizeTypes Standard_D13_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_D13_v2"); public static ContainerServiceVMSizeTypes Standard_D13_v2_Promo { get; } = new ContainerServiceVMSizeTypes("Standard_D13_v2_Promo"); public static ContainerServiceVMSizeTypes Standard_D14 { get; } = new ContainerServiceVMSizeTypes("Standard_D14"); public static ContainerServiceVMSizeTypes Standard_D14_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_D14_v2"); public static ContainerServiceVMSizeTypes Standard_D14_v2_Promo { get; } = new ContainerServiceVMSizeTypes("Standard_D14_v2_Promo"); public static ContainerServiceVMSizeTypes Standard_D15_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_D15_v2"); public static ContainerServiceVMSizeTypes Standard_D16_v3 { get; } = new ContainerServiceVMSizeTypes("Standard_D16_v3"); public static ContainerServiceVMSizeTypes Standard_D16s_v3 { get; } = new ContainerServiceVMSizeTypes("Standard_D16s_v3"); public static ContainerServiceVMSizeTypes Standard_D1_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_D1_v2"); public static ContainerServiceVMSizeTypes Standard_D2 { get; } = new ContainerServiceVMSizeTypes("Standard_D2"); public static ContainerServiceVMSizeTypes Standard_D2_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_D2_v2"); public static ContainerServiceVMSizeTypes Standard_D2_v2_Promo { get; } = new ContainerServiceVMSizeTypes("Standard_D2_v2_Promo"); public static ContainerServiceVMSizeTypes Standard_D2_v3 { get; } = new ContainerServiceVMSizeTypes("Standard_D2_v3"); public static ContainerServiceVMSizeTypes Standard_D2s_v3 { get; } = new ContainerServiceVMSizeTypes("Standard_D2s_v3"); public static ContainerServiceVMSizeTypes Standard_D3 { get; } = new ContainerServiceVMSizeTypes("Standard_D3"); public static ContainerServiceVMSizeTypes Standard_D32_v3 { get; } = new ContainerServiceVMSizeTypes("Standard_D32_v3"); public static ContainerServiceVMSizeTypes Standard_D32s_v3 { get; } = new ContainerServiceVMSizeTypes("Standard_D32s_v3"); public static ContainerServiceVMSizeTypes Standard_D3_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_D3_v2"); public static ContainerServiceVMSizeTypes Standard_D3_v2_Promo { get; } = new ContainerServiceVMSizeTypes("Standard_D3_v2_Promo"); public static ContainerServiceVMSizeTypes Standard_D4 { get; } = new ContainerServiceVMSizeTypes("Standard_D4"); public static ContainerServiceVMSizeTypes Standard_D4_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_D4_v2"); public static ContainerServiceVMSizeTypes Standard_D4_v2_Promo { get; } = new ContainerServiceVMSizeTypes("Standard_D4_v2_Promo"); public static ContainerServiceVMSizeTypes Standard_D4_v3 { get; } = new ContainerServiceVMSizeTypes("Standard_D4_v3"); public static ContainerServiceVMSizeTypes Standard_D4s_v3 { get; } = new ContainerServiceVMSizeTypes("Standard_D4s_v3"); public static ContainerServiceVMSizeTypes Standard_D5_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_D5_v2"); public static ContainerServiceVMSizeTypes Standard_D5_v2_Promo { get; } = new ContainerServiceVMSizeTypes("Standard_D5_v2_Promo"); public static ContainerServiceVMSizeTypes Standard_D64_v3 { get; } = new ContainerServiceVMSizeTypes("Standard_D64_v3"); public static ContainerServiceVMSizeTypes Standard_D64s_v3 { get; } = new ContainerServiceVMSizeTypes("Standard_D64s_v3"); public static ContainerServiceVMSizeTypes Standard_D8_v3 { get; } = new ContainerServiceVMSizeTypes("Standard_D8_v3"); public static ContainerServiceVMSizeTypes Standard_D8s_v3 { get; } = new ContainerServiceVMSizeTypes("Standard_D8s_v3"); public static ContainerServiceVMSizeTypes Standard_DS1 { get; } = new ContainerServiceVMSizeTypes("Standard_DS1"); public static ContainerServiceVMSizeTypes Standard_DS11 { get; } = new ContainerServiceVMSizeTypes("Standard_DS11"); public static ContainerServiceVMSizeTypes Standard_DS11_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_DS11_v2"); public static ContainerServiceVMSizeTypes Standard_DS11_v2_Promo { get; } = new ContainerServiceVMSizeTypes("Standard_DS11_v2_Promo"); public static ContainerServiceVMSizeTypes Standard_DS12 { get; } = new ContainerServiceVMSizeTypes("Standard_DS12"); public static ContainerServiceVMSizeTypes Standard_DS12_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_DS12_v2"); public static ContainerServiceVMSizeTypes Standard_DS12_v2_Promo { get; } = new ContainerServiceVMSizeTypes("Standard_DS12_v2_Promo"); public static ContainerServiceVMSizeTypes Standard_DS13 { get; } = new ContainerServiceVMSizeTypes("Standard_DS13"); public static ContainerServiceVMSizeTypes Standard_DS13_2_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_DS13-2_v2"); public static ContainerServiceVMSizeTypes Standard_DS13_4_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_DS13-4_v2"); public static ContainerServiceVMSizeTypes Standard_DS13_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_DS13_v2"); public static ContainerServiceVMSizeTypes Standard_DS13_v2_Promo { get; } = new ContainerServiceVMSizeTypes("Standard_DS13_v2_Promo"); public static ContainerServiceVMSizeTypes Standard_DS14 { get; } = new ContainerServiceVMSizeTypes("Standard_DS14"); public static ContainerServiceVMSizeTypes Standard_DS14_4_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_DS14-4_v2"); public static ContainerServiceVMSizeTypes Standard_DS14_8_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_DS14-8_v2"); public static ContainerServiceVMSizeTypes Standard_DS14_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_DS14_v2"); public static ContainerServiceVMSizeTypes Standard_DS14_v2_Promo { get; } = new ContainerServiceVMSizeTypes("Standard_DS14_v2_Promo"); public static ContainerServiceVMSizeTypes Standard_DS15_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_DS15_v2"); public static ContainerServiceVMSizeTypes Standard_DS1_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_DS1_v2"); public static ContainerServiceVMSizeTypes Standard_DS2 { get; } = new ContainerServiceVMSizeTypes("Standard_DS2"); public static ContainerServiceVMSizeTypes Standard_DS2_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_DS2_v2"); public static ContainerServiceVMSizeTypes Standard_DS2_v2_Promo { get; } = new ContainerServiceVMSizeTypes("Standard_DS2_v2_Promo"); public static ContainerServiceVMSizeTypes Standard_DS3 { get; } = new ContainerServiceVMSizeTypes("Standard_DS3"); public static ContainerServiceVMSizeTypes Standard_DS3_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_DS3_v2"); public static ContainerServiceVMSizeTypes Standard_DS3_v2_Promo { get; } = new ContainerServiceVMSizeTypes("Standard_DS3_v2_Promo"); public static ContainerServiceVMSizeTypes Standard_DS4 { get; } = new ContainerServiceVMSizeTypes("Standard_DS4"); public static ContainerServiceVMSizeTypes Standard_DS4_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_DS4_v2"); public static ContainerServiceVMSizeTypes Standard_DS4_v2_Promo { get; } = new ContainerServiceVMSizeTypes("Standard_DS4_v2_Promo"); public static ContainerServiceVMSizeTypes Standard_DS5_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_DS5_v2"); public static ContainerServiceVMSizeTypes Standard_DS5_v2_Promo { get; } = new ContainerServiceVMSizeTypes("Standard_DS5_v2_Promo"); public static ContainerServiceVMSizeTypes Standard_E16_v3 { get; } = new ContainerServiceVMSizeTypes("Standard_E16_v3"); public static ContainerServiceVMSizeTypes Standard_E16s_v3 { get; } = new ContainerServiceVMSizeTypes("Standard_E16s_v3"); public static ContainerServiceVMSizeTypes Standard_E2_v3 { get; } = new ContainerServiceVMSizeTypes("Standard_E2_v3"); public static ContainerServiceVMSizeTypes Standard_E2s_v3 { get; } = new ContainerServiceVMSizeTypes("Standard_E2s_v3"); public static ContainerServiceVMSizeTypes Standard_E32_16s_v3 { get; } = new ContainerServiceVMSizeTypes("Standard_E32-16s_v3"); public static ContainerServiceVMSizeTypes Standard_E32_8s_v3 { get; } = new ContainerServiceVMSizeTypes("Standard_E32-8s_v3"); public static ContainerServiceVMSizeTypes Standard_E32_v3 { get; } = new ContainerServiceVMSizeTypes("Standard_E32_v3"); public static ContainerServiceVMSizeTypes Standard_E32s_v3 { get; } = new ContainerServiceVMSizeTypes("Standard_E32s_v3"); public static ContainerServiceVMSizeTypes Standard_E4_v3 { get; } = new ContainerServiceVMSizeTypes("Standard_E4_v3"); public static ContainerServiceVMSizeTypes Standard_E4s_v3 { get; } = new ContainerServiceVMSizeTypes("Standard_E4s_v3"); public static ContainerServiceVMSizeTypes Standard_E64_16s_v3 { get; } = new ContainerServiceVMSizeTypes("Standard_E64-16s_v3"); public static ContainerServiceVMSizeTypes Standard_E64_32s_v3 { get; } = new ContainerServiceVMSizeTypes("Standard_E64-32s_v3"); public static ContainerServiceVMSizeTypes Standard_E64_v3 { get; } = new ContainerServiceVMSizeTypes("Standard_E64_v3"); public static ContainerServiceVMSizeTypes Standard_E64s_v3 { get; } = new ContainerServiceVMSizeTypes("Standard_E64s_v3"); public static ContainerServiceVMSizeTypes Standard_E8_v3 { get; } = new ContainerServiceVMSizeTypes("Standard_E8_v3"); public static ContainerServiceVMSizeTypes Standard_E8s_v3 { get; } = new ContainerServiceVMSizeTypes("Standard_E8s_v3"); public static ContainerServiceVMSizeTypes Standard_F1 { get; } = new ContainerServiceVMSizeTypes("Standard_F1"); public static ContainerServiceVMSizeTypes Standard_F16 { get; } = new ContainerServiceVMSizeTypes("Standard_F16"); public static ContainerServiceVMSizeTypes Standard_F16s { get; } = new ContainerServiceVMSizeTypes("Standard_F16s"); public static ContainerServiceVMSizeTypes Standard_F16s_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_F16s_v2"); public static ContainerServiceVMSizeTypes Standard_F1s { get; } = new ContainerServiceVMSizeTypes("Standard_F1s"); public static ContainerServiceVMSizeTypes Standard_F2 { get; } = new ContainerServiceVMSizeTypes("Standard_F2"); public static ContainerServiceVMSizeTypes Standard_F2s { get; } = new ContainerServiceVMSizeTypes("Standard_F2s"); public static ContainerServiceVMSizeTypes Standard_F2s_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_F2s_v2"); public static ContainerServiceVMSizeTypes Standard_F32s_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_F32s_v2"); public static ContainerServiceVMSizeTypes Standard_F4 { get; } = new ContainerServiceVMSizeTypes("Standard_F4"); public static ContainerServiceVMSizeTypes Standard_F4s { get; } = new ContainerServiceVMSizeTypes("Standard_F4s"); public static ContainerServiceVMSizeTypes Standard_F4s_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_F4s_v2"); public static ContainerServiceVMSizeTypes Standard_F64s_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_F64s_v2"); public static ContainerServiceVMSizeTypes Standard_F72s_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_F72s_v2"); public static ContainerServiceVMSizeTypes Standard_F8 { get; } = new ContainerServiceVMSizeTypes("Standard_F8"); public static ContainerServiceVMSizeTypes Standard_F8s { get; } = new ContainerServiceVMSizeTypes("Standard_F8s"); public static ContainerServiceVMSizeTypes Standard_F8s_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_F8s_v2"); public static ContainerServiceVMSizeTypes Standard_G1 { get; } = new ContainerServiceVMSizeTypes("Standard_G1"); public static ContainerServiceVMSizeTypes Standard_G2 { get; } = new ContainerServiceVMSizeTypes("Standard_G2"); public static ContainerServiceVMSizeTypes Standard_G3 { get; } = new ContainerServiceVMSizeTypes("Standard_G3"); public static ContainerServiceVMSizeTypes Standard_G4 { get; } = new ContainerServiceVMSizeTypes("Standard_G4"); public static ContainerServiceVMSizeTypes Standard_G5 { get; } = new ContainerServiceVMSizeTypes("Standard_G5"); public static ContainerServiceVMSizeTypes Standard_GS1 { get; } = new ContainerServiceVMSizeTypes("Standard_GS1"); public static ContainerServiceVMSizeTypes Standard_GS2 { get; } = new ContainerServiceVMSizeTypes("Standard_GS2"); public static ContainerServiceVMSizeTypes Standard_GS3 { get; } = new ContainerServiceVMSizeTypes("Standard_GS3"); public static ContainerServiceVMSizeTypes Standard_GS4 { get; } = new ContainerServiceVMSizeTypes("Standard_GS4"); public static ContainerServiceVMSizeTypes Standard_GS4_4 { get; } = new ContainerServiceVMSizeTypes("Standard_GS4-4"); public static ContainerServiceVMSizeTypes Standard_GS4_8 { get; } = new ContainerServiceVMSizeTypes("Standard_GS4-8"); public static ContainerServiceVMSizeTypes Standard_GS5 { get; } = new ContainerServiceVMSizeTypes("Standard_GS5"); public static ContainerServiceVMSizeTypes Standard_GS5_16 { get; } = new ContainerServiceVMSizeTypes("Standard_GS5-16"); public static ContainerServiceVMSizeTypes Standard_GS5_8 { get; } = new ContainerServiceVMSizeTypes("Standard_GS5-8"); public static ContainerServiceVMSizeTypes Standard_H16 { get; } = new ContainerServiceVMSizeTypes("Standard_H16"); public static ContainerServiceVMSizeTypes Standard_H16m { get; } = new ContainerServiceVMSizeTypes("Standard_H16m"); public static ContainerServiceVMSizeTypes Standard_H16mr { get; } = new ContainerServiceVMSizeTypes("Standard_H16mr"); public static ContainerServiceVMSizeTypes Standard_H16r { get; } = new ContainerServiceVMSizeTypes("Standard_H16r"); public static ContainerServiceVMSizeTypes Standard_H8 { get; } = new ContainerServiceVMSizeTypes("Standard_H8"); public static ContainerServiceVMSizeTypes Standard_H8m { get; } = new ContainerServiceVMSizeTypes("Standard_H8m"); public static ContainerServiceVMSizeTypes Standard_L16s { get; } = new ContainerServiceVMSizeTypes("Standard_L16s"); public static ContainerServiceVMSizeTypes Standard_L32s { get; } = new ContainerServiceVMSizeTypes("Standard_L32s"); public static ContainerServiceVMSizeTypes Standard_L4s { get; } = new ContainerServiceVMSizeTypes("Standard_L4s"); public static ContainerServiceVMSizeTypes Standard_L8s { get; } = new ContainerServiceVMSizeTypes("Standard_L8s"); public static ContainerServiceVMSizeTypes Standard_M128_32ms { get; } = new ContainerServiceVMSizeTypes("Standard_M128-32ms"); public static ContainerServiceVMSizeTypes Standard_M128_64ms { get; } = new ContainerServiceVMSizeTypes("Standard_M128-64ms"); public static ContainerServiceVMSizeTypes Standard_M128ms { get; } = new ContainerServiceVMSizeTypes("Standard_M128ms"); public static ContainerServiceVMSizeTypes Standard_M128s { get; } = new ContainerServiceVMSizeTypes("Standard_M128s"); public static ContainerServiceVMSizeTypes Standard_M64_16ms { get; } = new ContainerServiceVMSizeTypes("Standard_M64-16ms"); public static ContainerServiceVMSizeTypes Standard_M64_32ms { get; } = new ContainerServiceVMSizeTypes("Standard_M64-32ms"); public static ContainerServiceVMSizeTypes Standard_M64ms { get; } = new ContainerServiceVMSizeTypes("Standard_M64ms"); public static ContainerServiceVMSizeTypes Standard_M64s { get; } = new ContainerServiceVMSizeTypes("Standard_M64s"); public static ContainerServiceVMSizeTypes Standard_NC12 { get; } = new ContainerServiceVMSizeTypes("Standard_NC12"); public static ContainerServiceVMSizeTypes Standard_NC12s_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_NC12s_v2"); public static ContainerServiceVMSizeTypes Standard_NC12s_v3 { get; } = new ContainerServiceVMSizeTypes("Standard_NC12s_v3"); public static ContainerServiceVMSizeTypes Standard_NC24 { get; } = new ContainerServiceVMSizeTypes("Standard_NC24"); public static ContainerServiceVMSizeTypes Standard_NC24r { get; } = new ContainerServiceVMSizeTypes("Standard_NC24r"); public static ContainerServiceVMSizeTypes Standard_NC24rs_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_NC24rs_v2"); public static ContainerServiceVMSizeTypes Standard_NC24rs_v3 { get; } = new ContainerServiceVMSizeTypes("Standard_NC24rs_v3"); public static ContainerServiceVMSizeTypes Standard_NC24s_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_NC24s_v2"); public static ContainerServiceVMSizeTypes Standard_NC24s_v3 { get; } = new ContainerServiceVMSizeTypes("Standard_NC24s_v3"); public static ContainerServiceVMSizeTypes Standard_NC6 { get; } = new ContainerServiceVMSizeTypes("Standard_NC6"); public static ContainerServiceVMSizeTypes Standard_NC6s_v2 { get; } = new ContainerServiceVMSizeTypes("Standard_NC6s_v2"); public static ContainerServiceVMSizeTypes Standard_NC6s_v3 { get; } = new ContainerServiceVMSizeTypes("Standard_NC6s_v3"); public static ContainerServiceVMSizeTypes Standard_ND12s { get; } = new ContainerServiceVMSizeTypes("Standard_ND12s"); public static ContainerServiceVMSizeTypes Standard_ND24rs { get; } = new ContainerServiceVMSizeTypes("Standard_ND24rs"); public static ContainerServiceVMSizeTypes Standard_ND24s { get; } = new ContainerServiceVMSizeTypes("Standard_ND24s"); public static ContainerServiceVMSizeTypes Standard_ND6s { get; } = new ContainerServiceVMSizeTypes("Standard_ND6s"); public static ContainerServiceVMSizeTypes Standard_NV12 { get; } = new ContainerServiceVMSizeTypes("Standard_NV12"); public static ContainerServiceVMSizeTypes Standard_NV24 { get; } = new ContainerServiceVMSizeTypes("Standard_NV24"); public static ContainerServiceVMSizeTypes Standard_NV6 { get; } = new ContainerServiceVMSizeTypes("Standard_NV6"); public static bool operator ==(ContainerServiceVMSizeTypes left, ContainerServiceVMSizeTypes right) => left.Equals(right); public static bool operator !=(ContainerServiceVMSizeTypes left, ContainerServiceVMSizeTypes right) => !left.Equals(right); public static explicit operator string(ContainerServiceVMSizeTypes value) => value._value; [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object? obj) => obj is ContainerServiceVMSizeTypes other && Equals(other); public bool Equals(ContainerServiceVMSizeTypes 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 licenseType to use for Windows VMs. Windows_Server is used to enable Azure Hybrid User Benefits for Windows VMs. /// </summary> [EnumType] public readonly struct LicenseType : IEquatable<LicenseType> { private readonly string _value; private LicenseType(string value) { _value = value ?? throw new ArgumentNullException(nameof(value)); } public static LicenseType None { get; } = new LicenseType("None"); public static LicenseType Windows_Server { get; } = new LicenseType("Windows_Server"); public static bool operator ==(LicenseType left, LicenseType right) => left.Equals(right); public static bool operator !=(LicenseType left, LicenseType right) => !left.Equals(right); public static explicit operator string(LicenseType value) => value._value; [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object? obj) => obj is LicenseType other && Equals(other); public bool Equals(LicenseType 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 load balancer sku for the managed cluster. /// </summary> [EnumType] public readonly struct LoadBalancerSku : IEquatable<LoadBalancerSku> { private readonly string _value; private LoadBalancerSku(string value) { _value = value ?? throw new ArgumentNullException(nameof(value)); } public static LoadBalancerSku Standard { get; } = new LoadBalancerSku("standard"); public static LoadBalancerSku Basic { get; } = new LoadBalancerSku("basic"); public static bool operator ==(LoadBalancerSku left, LoadBalancerSku right) => left.Equals(right); public static bool operator !=(LoadBalancerSku left, LoadBalancerSku right) => !left.Equals(right); public static explicit operator string(LoadBalancerSku value) => value._value; [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object? obj) => obj is LoadBalancerSku other && Equals(other); public bool Equals(LoadBalancerSku other) => string.Equals(_value, other._value, StringComparison.Ordinal); [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value?.GetHashCode() ?? 0; public override string ToString() => _value; } /// <summary> /// Name of a managed cluster SKU. /// </summary> [EnumType] public readonly struct ManagedClusterSKUName : IEquatable<ManagedClusterSKUName> { private readonly string _value; private ManagedClusterSKUName(string value) { _value = value ?? throw new ArgumentNullException(nameof(value)); } public static ManagedClusterSKUName Basic { get; } = new ManagedClusterSKUName("Basic"); public static bool operator ==(ManagedClusterSKUName left, ManagedClusterSKUName right) => left.Equals(right); public static bool operator !=(ManagedClusterSKUName left, ManagedClusterSKUName right) => !left.Equals(right); public static explicit operator string(ManagedClusterSKUName value) => value._value; [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object? obj) => obj is ManagedClusterSKUName other && Equals(other); public bool Equals(ManagedClusterSKUName other) => string.Equals(_value, other._value, StringComparison.Ordinal); [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value?.GetHashCode() ?? 0; public override string ToString() => _value; } /// <summary> /// Tier of a managed cluster SKU. /// </summary> [EnumType] public readonly struct ManagedClusterSKUTier : IEquatable<ManagedClusterSKUTier> { private readonly string _value; private ManagedClusterSKUTier(string value) { _value = value ?? throw new ArgumentNullException(nameof(value)); } public static ManagedClusterSKUTier Paid { get; } = new ManagedClusterSKUTier("Paid"); public static ManagedClusterSKUTier Free { get; } = new ManagedClusterSKUTier("Free"); public static bool operator ==(ManagedClusterSKUTier left, ManagedClusterSKUTier right) => left.Equals(right); public static bool operator !=(ManagedClusterSKUTier left, ManagedClusterSKUTier right) => !left.Equals(right); public static explicit operator string(ManagedClusterSKUTier value) => value._value; [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object? obj) => obj is ManagedClusterSKUTier other && Equals(other); public bool Equals(ManagedClusterSKUTier other) => string.Equals(_value, other._value, StringComparison.Ordinal); [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value?.GetHashCode() ?? 0; public override string ToString() => _value; } /// <summary> /// Network mode used for building Kubernetes network. /// </summary> [EnumType] public readonly struct NetworkMode : IEquatable<NetworkMode> { private readonly string _value; private NetworkMode(string value) { _value = value ?? throw new ArgumentNullException(nameof(value)); } public static NetworkMode Transparent { get; } = new NetworkMode("transparent"); public static NetworkMode Bridge { get; } = new NetworkMode("bridge"); public static bool operator ==(NetworkMode left, NetworkMode right) => left.Equals(right); public static bool operator !=(NetworkMode left, NetworkMode right) => !left.Equals(right); public static explicit operator string(NetworkMode value) => value._value; [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object? obj) => obj is NetworkMode other && Equals(other); public bool Equals(NetworkMode other) => string.Equals(_value, other._value, StringComparison.Ordinal); [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value?.GetHashCode() ?? 0; public override string ToString() => _value; } /// <summary> /// Network plugin used for building Kubernetes network. /// </summary> [EnumType] public readonly struct NetworkPlugin : IEquatable<NetworkPlugin> { private readonly string _value; private NetworkPlugin(string value) { _value = value ?? throw new ArgumentNullException(nameof(value)); } public static NetworkPlugin Azure { get; } = new NetworkPlugin("azure"); public static NetworkPlugin Kubenet { get; } = new NetworkPlugin("kubenet"); public static bool operator ==(NetworkPlugin left, NetworkPlugin right) => left.Equals(right); public static bool operator !=(NetworkPlugin left, NetworkPlugin right) => !left.Equals(right); public static explicit operator string(NetworkPlugin value) => value._value; [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object? obj) => obj is NetworkPlugin other && Equals(other); public bool Equals(NetworkPlugin other) => string.Equals(_value, other._value, StringComparison.Ordinal); [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value?.GetHashCode() ?? 0; public override string ToString() => _value; } /// <summary> /// Network policy used for building Kubernetes network. /// </summary> [EnumType] public readonly struct NetworkPolicy : IEquatable<NetworkPolicy> { private readonly string _value; private NetworkPolicy(string value) { _value = value ?? throw new ArgumentNullException(nameof(value)); } public static NetworkPolicy Calico { get; } = new NetworkPolicy("calico"); public static NetworkPolicy Azure { get; } = new NetworkPolicy("azure"); public static bool operator ==(NetworkPolicy left, NetworkPolicy right) => left.Equals(right); public static bool operator !=(NetworkPolicy left, NetworkPolicy right) => !left.Equals(right); public static explicit operator string(NetworkPolicy value) => value._value; [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object? obj) => obj is NetworkPolicy other && Equals(other); public bool Equals(NetworkPolicy other) => string.Equals(_value, other._value, StringComparison.Ordinal); [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value?.GetHashCode() ?? 0; public override string ToString() => _value; } /// <summary> /// OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. /// </summary> [EnumType] public readonly struct OSType : IEquatable<OSType> { private readonly string _value; private OSType(string value) { _value = value ?? throw new ArgumentNullException(nameof(value)); } public static OSType Linux { get; } = new OSType("Linux"); public static OSType Windows { get; } = new OSType("Windows"); public static bool operator ==(OSType left, OSType right) => left.Equals(right); public static bool operator !=(OSType left, OSType right) => !left.Equals(right); public static explicit operator string(OSType value) => value._value; [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object? obj) => obj is OSType other && Equals(other); public bool Equals(OSType 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 outbound (egress) routing method. /// </summary> [EnumType] public readonly struct OutboundType : IEquatable<OutboundType> { private readonly string _value; private OutboundType(string value) { _value = value ?? throw new ArgumentNullException(nameof(value)); } public static OutboundType LoadBalancer { get; } = new OutboundType("loadBalancer"); public static OutboundType UserDefinedRouting { get; } = new OutboundType("userDefinedRouting"); public static bool operator ==(OutboundType left, OutboundType right) => left.Equals(right); public static bool operator !=(OutboundType left, OutboundType right) => !left.Equals(right); public static explicit operator string(OutboundType value) => value._value; [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object? obj) => obj is OutboundType other && Equals(other); public bool Equals(OutboundType 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 type of identity used for the managed cluster. Type 'SystemAssigned' will use an implicitly created identity in master components and an auto-created user assigned identity in MC_ resource group in agent nodes. Type 'None' will not use MSI for the managed cluster, service principal will be used instead. /// </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 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> /// ScaleSetEvictionPolicy to be used to specify eviction policy for Spot virtual machine scale set. Default to Delete. /// </summary> [EnumType] public readonly struct ScaleSetEvictionPolicy : IEquatable<ScaleSetEvictionPolicy> { private readonly string _value; private ScaleSetEvictionPolicy(string value) { _value = value ?? throw new ArgumentNullException(nameof(value)); } public static ScaleSetEvictionPolicy Delete { get; } = new ScaleSetEvictionPolicy("Delete"); public static ScaleSetEvictionPolicy Deallocate { get; } = new ScaleSetEvictionPolicy("Deallocate"); public static bool operator ==(ScaleSetEvictionPolicy left, ScaleSetEvictionPolicy right) => left.Equals(right); public static bool operator !=(ScaleSetEvictionPolicy left, ScaleSetEvictionPolicy right) => !left.Equals(right); public static explicit operator string(ScaleSetEvictionPolicy value) => value._value; [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object? obj) => obj is ScaleSetEvictionPolicy other && Equals(other); public bool Equals(ScaleSetEvictionPolicy other) => string.Equals(_value, other._value, StringComparison.Ordinal); [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value?.GetHashCode() ?? 0; public override string ToString() => _value; } /// <summary> /// ScaleSetPriority to be used to specify virtual machine scale set priority. Default to regular. /// </summary> [EnumType] public readonly struct ScaleSetPriority : IEquatable<ScaleSetPriority> { private readonly string _value; private ScaleSetPriority(string value) { _value = value ?? throw new ArgumentNullException(nameof(value)); } public static ScaleSetPriority Spot { get; } = new ScaleSetPriority("Spot"); public static ScaleSetPriority Regular { get; } = new ScaleSetPriority("Regular"); public static bool operator ==(ScaleSetPriority left, ScaleSetPriority right) => left.Equals(right); public static bool operator !=(ScaleSetPriority left, ScaleSetPriority right) => !left.Equals(right); public static explicit operator string(ScaleSetPriority value) => value._value; [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object? obj) => obj is ScaleSetPriority other && Equals(other); public bool Equals(ScaleSetPriority other) => string.Equals(_value, other._value, StringComparison.Ordinal); [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() => _value?.GetHashCode() ?? 0; public override string ToString() => _value; } }
65.002941
316
0.738157
[ "Apache-2.0" ]
pulumi/pulumi-azure-nextgen
sdk/dotnet/ContainerService/V20200701/Enums.cs
44,202
C#
using System; using System.Text; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.IdentityModel.Tokens; using Abp.AspNetCore; using Abp.AspNetCore.Configuration; using Abp.AspNetCore.SignalR; using Abp.Modules; using Abp.Reflection.Extensions; using Abp.Zero.Configuration; using NetCore.Authentication.JwtBearer; using NetCore.Configuration; using NetCore.EntityFrameworkCore; namespace NetCore { [DependsOn( typeof(NetCoreApplicationModule), typeof(NetCoreEntityFrameworkModule), typeof(AbpAspNetCoreModule) ,typeof(AbpAspNetCoreSignalRModule) )] public class NetCoreWebCoreModule : AbpModule { private readonly IHostingEnvironment _env; private readonly IConfigurationRoot _appConfiguration; public NetCoreWebCoreModule(IHostingEnvironment env) { _env = env; _appConfiguration = env.GetAppConfiguration(); } public override void PreInitialize() { Configuration.DefaultNameOrConnectionString = _appConfiguration.GetConnectionString( NetCoreConsts.ConnectionStringName ); // Use database for language management Configuration.Modules.Zero().LanguageManagement.EnableDbLocalization(); Configuration.Modules.AbpAspNetCore() .CreateControllersForAppServices( typeof(NetCoreApplicationModule).GetAssembly() ); ConfigureTokenAuth(); } private void ConfigureTokenAuth() { IocManager.Register<TokenAuthConfiguration>(); var tokenAuthConfig = IocManager.Resolve<TokenAuthConfiguration>(); tokenAuthConfig.SecurityKey = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(_appConfiguration["Authentication:JwtBearer:SecurityKey"])); tokenAuthConfig.Issuer = _appConfiguration["Authentication:JwtBearer:Issuer"]; tokenAuthConfig.Audience = _appConfiguration["Authentication:JwtBearer:Audience"]; tokenAuthConfig.SigningCredentials = new SigningCredentials(tokenAuthConfig.SecurityKey, SecurityAlgorithms.HmacSha256); tokenAuthConfig.Expiration = TimeSpan.FromDays(1); } public override void Initialize() { IocManager.RegisterAssemblyByConvention(typeof(NetCoreWebCoreModule).GetAssembly()); } } }
35.3
151
0.698098
[ "MIT" ]
Kinnco/NetCoreAbp
4.7.1/src/NetCore.Web.Core/NetCoreWebCoreModule.cs
2,473
C#
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using BCrypt.Net; namespace KeyLog { public partial class FormLogin : Form { // Test Object string uname = "martineng"; string pwd = "password"; public FormLogin() { InitializeComponent(); OnLoad(); tboxUname_Leave(this, new EventArgs()); tboxPwd_Leave(this, new EventArgs()); } // Control to login private void txtboxPwd_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { btnLogin_Click(this, new EventArgs()); } } // Action on load public void OnLoad() { // Encrypting User uname = BCrypt.Net.BCrypt.HashString(uname); pwd = BCrypt.Net.BCrypt.HashPassword(pwd); } // To validate User public Boolean loginAuthentication() { Boolean isMatch = false; // Validate if it's User if (BCrypt.Net.BCrypt.Verify(this.tboxUname.Text, uname)) { if (BCrypt.Net.BCrypt.Verify(this.tboxPwd.Text, pwd)) { isMatch = true; MessageBox.Show("WELCOME"); } // END IF else { isMatch = false; MessageBox.Show("INVALID CREDENTIAL"); } // END ELSE } // END IF else { isMatch = false; MessageBox.Show("INVALID CREDENTIAL"); } // END ELSE return isMatch; } // END validateUser() // Watermark effect for textboxes private void tboxUname_Enter(object sender, EventArgs e) { if (tboxUname.Text == "Username") { tboxUname.Text = ""; tboxUname.ForeColor = SystemColors.WindowText; tboxUname.UseSystemPasswordChar = true; } } private void tboxUname_Leave(object sender, EventArgs e) { if (tboxUname.Text.Length == 0) { tboxUname.Text = "Username"; tboxUname.ForeColor = SystemColors.GrayText; tboxUname.UseSystemPasswordChar = false; } } private void tboxPwd_Enter(object sender, EventArgs e) { if (tboxPwd.Text == "Password") { tboxPwd.Text = ""; tboxPwd.ForeColor = SystemColors.WindowText; tboxPwd.UseSystemPasswordChar = true; } } private void tboxPwd_Leave(object sender, EventArgs e) { if (tboxPwd.Text.Length == 0) { tboxPwd.Text = "Password"; tboxPwd.ForeColor = SystemColors.GrayText; tboxPwd.UseSystemPasswordChar = false; } } private void btnLogin_Click(object sender, EventArgs e) { if (loginAuthentication()) { this.Hide(); Keylog.FormPanel formPanel = new Keylog.FormPanel(); formPanel.Closed += (s, arg) => this.Close(); formPanel.Show(); } } } // END class } // END namespace
29.380952
70
0.482172
[ "Apache-2.0" ]
martineng/Keylog
Keylog/FormLogin.cs
3,704
C#
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad { using System; using System.Collections.Generic; using System.Text; using System.Reflection; using Microsoft.Protocols.TestTools; using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.Protocols.TestTools.Messages.Runtime; [Microsoft.VisualStudio.TestTools.UnitTesting.TestClassAttribute()] public partial class TestScenarioS7 : PtfTestClassBase { public TestScenarioS7() { this.SetSwitch("ProceedControlTimeout", "100"); this.SetSwitch("QuiescenceTimeout", "10000"); } #region Expect Delegates public delegate void RemoveAccountRightsDelegate1(Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus @return); public delegate void CloseDelegate1(Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle handleAfterClose, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus @return); #endregion #region Event Metadata static System.Reflection.MethodBase CloseInfo = TestManagerHelpers.GetMethodInfo(typeof(Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ILsadManagedAdapter), "Close", typeof(int), typeof(Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle).MakeByRefType()); static System.Reflection.MethodBase RemoveAccountRightsInfo = TestManagerHelpers.GetMethodInfo(typeof(Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ILsadManagedAdapter), "RemoveAccountRights", typeof(int), typeof(string), typeof(Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid), typeof(int), typeof(List<string>)); #endregion #region Adapter Instances private Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ILsadManagedAdapter ILsadManagedAdapterInstance; #endregion #region Class Initialization and Cleanup [Microsoft.VisualStudio.TestTools.UnitTesting.ClassInitializeAttribute()] public static void ClassInitialize(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext context) { PtfTestClassBase.Initialize(context); } [Microsoft.VisualStudio.TestTools.UnitTesting.ClassCleanupAttribute()] public static void ClassCleanup() { PtfTestClassBase.Cleanup(); } #endregion #region Test Initialization and Cleanup protected override void TestInitialize() { this.InitializeTestManager(); this.ILsadManagedAdapterInstance = ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ILsadManagedAdapter)(this.GetAdapter(typeof(Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ILsadManagedAdapter)))); } protected override void TestCleanup() { base.TestCleanup(); this.CleanupTestManager(); } #endregion #region Test Starting in S0 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S0() { this.Manager.BeginTest("TestScenarioS7S0"); this.Manager.Comment("reaching state \'S0\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S1\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S96\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp0; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp1; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp1 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp0); this.Manager.Comment("reaching state \'S144\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp0, "policyHandle of OpenPolicy, state S144"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp1, "return of OpenPolicy, state S144"); this.Manager.Comment("reaching state \'S192\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp2; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp3; this.Manager.Comment("executing step \'call CreateAccount(11,4061069327,Valid,\"SID\",out _)\'"); temp3 = this.ILsadManagedAdapterInstance.CreateAccount(11, 4061069327u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp2); this.Manager.Comment("reaching state \'S240\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Invalid]:InvalidHandle\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp2, "accountHandle of CreateAccount, state S240"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidHandle, temp3, "return of CreateAccount, state S240"); this.Manager.Comment("reaching state \'S288\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp4; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp5; this.Manager.Comment("executing step \'call OpenAccount(11,True,Valid,\"SID\",out _)\'"); temp5 = this.ILsadManagedAdapterInstance.OpenAccount(11, true, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp4); this.Manager.Comment("reaching state \'S336\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:InvalidHandle\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp4, "accountHandle of OpenAccount, state S336"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidHandle, temp5, "return of OpenAccount, state S336"); this.Manager.Comment("reaching state \'S384\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp6; this.Manager.Comment("executing step \'call AddAccountRights(11,\"SID\",Valid,{\"invalidvalue\"})\'"); temp6 = this.ILsadManagedAdapterInstance.AddAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S432\'"); this.Manager.Comment("checking step \'return AddAccountRights/InvalidHandle\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidHandle, temp6, "return of AddAccountRights, state S432"); this.Manager.Comment("reaching state \'S480\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp7; this.Manager.Comment("executing step \'call RemoveAccountRights(11,\"SID\",Valid,0,{\"invalidvalue\"})\'"); temp7 = this.ILsadManagedAdapterInstance.RemoveAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), 0, new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S528\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/InvalidHandle\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidHandle, temp7, "return of RemoveAccountRights, state S528"); TestScenarioS7S575(); this.Manager.EndTest(); } private void TestScenarioS7S575() { this.Manager.Comment("reaching state \'S575\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp8; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp9; this.Manager.Comment("executing step \'call Close(1,out _)\'"); temp9 = this.ILsadManagedAdapterInstance.Close(1, out temp8); this.Manager.AddReturn(CloseInfo, null, temp8, temp9); TestScenarioS7S581(); } private void TestScenarioS7S581() { this.Manager.Comment("reaching state \'S581\'"); this.Manager.ExpectReturn(this.QuiescenceTimeout, true, new ExpectedReturn(TestScenarioS7.CloseInfo, null, new CloseDelegate1(this.TestScenarioS7S0CloseChecker))); this.Manager.Comment("reaching state \'S586\'"); } private void TestScenarioS7S0CloseChecker(Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle handleAfterClose, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus @return) { this.Manager.Comment("checking step \'return Close/[out Null]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle.Null, handleAfterClose, "handleAfterClose of Close, state S581"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), @return, "return of Close, state S581"); } #endregion #region Test Starting in S10 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S10() { this.Manager.BeginTest("TestScenarioS7S10"); this.Manager.Comment("reaching state \'S10\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S11\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S101\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp10; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp11; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp11 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp10); this.Manager.Comment("reaching state \'S149\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp10, "policyHandle of OpenPolicy, state S149"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp11, "return of OpenPolicy, state S149"); this.Manager.Comment("reaching state \'S197\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp12; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp13; this.Manager.Comment("executing step \'call CreateAccount(1,4061069327,Valid,\"SID\",out _)\'"); temp13 = this.ILsadManagedAdapterInstance.CreateAccount(1, 4061069327u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp12); this.Manager.Comment("reaching state \'S245\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp12, "accountHandle of CreateAccount, state S245"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp13, "return of CreateAccount, state S245"); this.Manager.Comment("reaching state \'S293\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp14; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp15; this.Manager.Comment("executing step \'call OpenAccount(1,True,Valid,\"SID\",out _)\'"); temp15 = this.ILsadManagedAdapterInstance.OpenAccount(1, true, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp14); this.Manager.Comment("reaching state \'S341\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp14, "accountHandle of OpenAccount, state S341"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp15, "return of OpenAccount, state S341"); this.Manager.Comment("reaching state \'S389\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp16; this.Manager.Comment("executing step \'call AddAccountRights(1,\"SID\",Valid,{\"SeAssignPrimaryTokenPrivile" + "ge\"})\'"); temp16 = this.ILsadManagedAdapterInstance.AddAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S437\'"); this.Manager.Comment("checking step \'return AddAccountRights/Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp16, "return of AddAccountRights, state S437"); this.Manager.Comment("reaching state \'S485\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp17; this.Manager.Comment("executing step \'call RemoveAccountRights(11,\"SID\",Invalid,0,{\"SeAssignPrimaryToke" + "nPrivilege\"})\'"); temp17 = this.ILsadManagedAdapterInstance.RemoveAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), 0, new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S533\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp17, "return of RemoveAccountRights, state S533"); TestScenarioS7S577(); this.Manager.EndTest(); } private void TestScenarioS7S577() { this.Manager.Comment("reaching state \'S577\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp18; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp19; this.Manager.Comment("executing step \'call Close(1,out _)\'"); temp19 = this.ILsadManagedAdapterInstance.Close(1, out temp18); this.Manager.Comment("reaching state \'S583\'"); this.Manager.Comment("checking step \'return Close/[out Null]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle.Null, temp18, "handleAfterClose of Close, state S583"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp19, "return of Close, state S583"); this.Manager.Comment("reaching state \'S588\'"); } #endregion #region Test Starting in S12 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S12() { this.Manager.BeginTest("TestScenarioS7S12"); this.Manager.Comment("reaching state \'S12\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S13\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S102\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp20; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp21; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp21 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp20); this.Manager.Comment("reaching state \'S150\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp20, "policyHandle of OpenPolicy, state S150"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp21, "return of OpenPolicy, state S150"); this.Manager.Comment("reaching state \'S198\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp22; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp23; this.Manager.Comment("executing step \'call CreateAccount(1,4061069327,Valid,\"SID\",out _)\'"); temp23 = this.ILsadManagedAdapterInstance.CreateAccount(1, 4061069327u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp22); this.Manager.Comment("reaching state \'S246\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp22, "accountHandle of CreateAccount, state S246"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp23, "return of CreateAccount, state S246"); this.Manager.Comment("reaching state \'S294\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp24; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp25; this.Manager.Comment("executing step \'call OpenAccount(1,True,Valid,\"SID\",out _)\'"); temp25 = this.ILsadManagedAdapterInstance.OpenAccount(1, true, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp24); this.Manager.Comment("reaching state \'S342\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp24, "accountHandle of OpenAccount, state S342"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp25, "return of OpenAccount, state S342"); this.Manager.Comment("reaching state \'S390\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp26; this.Manager.Comment("executing step \'call AddAccountRights(1,\"SID\",Valid,{\"SeAssignPrimaryTokenPrivile" + "ge\"})\'"); temp26 = this.ILsadManagedAdapterInstance.AddAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S438\'"); this.Manager.Comment("checking step \'return AddAccountRights/Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp26, "return of AddAccountRights, state S438"); this.Manager.Comment("reaching state \'S486\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp27; this.Manager.Comment("executing step \'call RemoveAccountRights(11,\"SID\",Invalid,0,{\"invalidvalue\"})\'"); temp27 = this.ILsadManagedAdapterInstance.RemoveAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), 0, new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S534\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp27, "return of RemoveAccountRights, state S534"); TestScenarioS7S577(); this.Manager.EndTest(); } #endregion #region Test Starting in S14 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S14() { this.Manager.BeginTest("TestScenarioS7S14"); this.Manager.Comment("reaching state \'S14\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S15\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S103\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp28; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp29; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp29 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp28); this.Manager.Comment("reaching state \'S151\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp28, "policyHandle of OpenPolicy, state S151"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp29, "return of OpenPolicy, state S151"); this.Manager.Comment("reaching state \'S199\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp30; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp31; this.Manager.Comment("executing step \'call CreateAccount(1,4061069327,Valid,\"SID\",out _)\'"); temp31 = this.ILsadManagedAdapterInstance.CreateAccount(1, 4061069327u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp30); this.Manager.Comment("reaching state \'S247\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp30, "accountHandle of CreateAccount, state S247"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp31, "return of CreateAccount, state S247"); this.Manager.Comment("reaching state \'S295\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp32; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp33; this.Manager.Comment("executing step \'call OpenAccount(1,True,Valid,\"SID\",out _)\'"); temp33 = this.ILsadManagedAdapterInstance.OpenAccount(1, true, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp32); this.Manager.Comment("reaching state \'S343\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp32, "accountHandle of OpenAccount, state S343"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp33, "return of OpenAccount, state S343"); this.Manager.Comment("reaching state \'S391\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp34; this.Manager.Comment("executing step \'call AddAccountRights(1,\"SID\",Valid,{\"SeAssignPrimaryTokenPrivile" + "ge\"})\'"); temp34 = this.ILsadManagedAdapterInstance.AddAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S439\'"); this.Manager.Comment("checking step \'return AddAccountRights/Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp34, "return of AddAccountRights, state S439"); this.Manager.Comment("reaching state \'S487\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp35; this.Manager.Comment("executing step \'call RemoveAccountRights(1,\"SID\",Valid,0,{\"invalidvalue\"})\'"); temp35 = this.ILsadManagedAdapterInstance.RemoveAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), 0, new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S535\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/NoSuchPrivilege\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.NoSuchPrivilege, temp35, "return of RemoveAccountRights, state S535"); TestScenarioS7S577(); this.Manager.EndTest(); } #endregion #region Test Starting in S16 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S16() { this.Manager.BeginTest("TestScenarioS7S16"); this.Manager.Comment("reaching state \'S16\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S17\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S104\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp36; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp37; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp37 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp36); this.Manager.Comment("reaching state \'S152\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp36, "policyHandle of OpenPolicy, state S152"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp37, "return of OpenPolicy, state S152"); this.Manager.Comment("reaching state \'S200\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp38; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp39; this.Manager.Comment("executing step \'call CreateAccount(1,4061069327,Valid,\"SID\",out _)\'"); temp39 = this.ILsadManagedAdapterInstance.CreateAccount(1, 4061069327u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp38); this.Manager.Comment("reaching state \'S248\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp38, "accountHandle of CreateAccount, state S248"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp39, "return of CreateAccount, state S248"); this.Manager.Comment("reaching state \'S296\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp40; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp41; this.Manager.Comment("executing step \'call OpenAccount(1,True,Valid,\"SID\",out _)\'"); temp41 = this.ILsadManagedAdapterInstance.OpenAccount(1, true, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp40); this.Manager.Comment("reaching state \'S344\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp40, "accountHandle of OpenAccount, state S344"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp41, "return of OpenAccount, state S344"); this.Manager.Comment("reaching state \'S392\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp42; this.Manager.Comment("executing step \'call AddAccountRights(1,\"SID\",Valid,{\"SeAssignPrimaryTokenPrivile" + "ge\"})\'"); temp42 = this.ILsadManagedAdapterInstance.AddAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S440\'"); this.Manager.Comment("checking step \'return AddAccountRights/Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp42, "return of AddAccountRights, state S440"); this.Manager.Comment("reaching state \'S488\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp43; this.Manager.Comment("executing step \'call RemoveAccountRights(11,\"SID\",Valid,0,{\"SeAssignPrimaryTokenP" + "rivilege\"})\'"); temp43 = this.ILsadManagedAdapterInstance.RemoveAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), 0, new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S536\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/InvalidHandle\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidHandle, temp43, "return of RemoveAccountRights, state S536"); TestScenarioS7S577(); this.Manager.EndTest(); } #endregion #region Test Starting in S18 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S18() { this.Manager.BeginTest("TestScenarioS7S18"); this.Manager.Comment("reaching state \'S18\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S19\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S105\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp44; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp45; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp45 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp44); this.Manager.Comment("reaching state \'S153\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp44, "policyHandle of OpenPolicy, state S153"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp45, "return of OpenPolicy, state S153"); this.Manager.Comment("reaching state \'S201\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp46; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp47; this.Manager.Comment("executing step \'call CreateAccount(1,4061069327,Valid,\"SID\",out _)\'"); temp47 = this.ILsadManagedAdapterInstance.CreateAccount(1, 4061069327u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp46); this.Manager.Comment("reaching state \'S249\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp46, "accountHandle of CreateAccount, state S249"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp47, "return of CreateAccount, state S249"); this.Manager.Comment("reaching state \'S297\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp48; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp49; this.Manager.Comment("executing step \'call OpenAccount(1,False,Valid,\"SID\",out _)\'"); temp49 = this.ILsadManagedAdapterInstance.OpenAccount(1, false, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp48); this.Manager.Comment("reaching state \'S345\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:AccessDenied\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp48, "accountHandle of OpenAccount, state S345"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.AccessDenied, temp49, "return of OpenAccount, state S345"); this.Manager.Comment("reaching state \'S393\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp50; this.Manager.Comment("executing step \'call AddAccountRights(1,\"SID\",Invalid,{\"SeAssignPrimaryTokenPrivi" + "lege\"})\'"); temp50 = this.ILsadManagedAdapterInstance.AddAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S441\'"); this.Manager.Comment("checking step \'return AddAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp50, "return of AddAccountRights, state S441"); this.Manager.Comment("reaching state \'S489\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp51; this.Manager.Comment("executing step \'call RemoveAccountRights(1,\"SID\",Valid,0,{\"SeAssignPrimaryTokenPr" + "ivilege\"})\'"); temp51 = this.ILsadManagedAdapterInstance.RemoveAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), 0, new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.AddReturn(RemoveAccountRightsInfo, null, temp51); TestScenarioS7S530(); this.Manager.EndTest(); } private void TestScenarioS7S530() { this.Manager.Comment("reaching state \'S530\'"); this.Manager.ExpectReturn(this.QuiescenceTimeout, true, new ExpectedReturn(TestScenarioS7.RemoveAccountRightsInfo, null, new RemoveAccountRightsDelegate1(this.TestScenarioS7S18RemoveAccountRightsChecker))); TestScenarioS7S575(); } private void TestScenarioS7S18RemoveAccountRightsChecker(Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus @return) { this.Manager.Comment("checking step \'return RemoveAccountRights/Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), @return, "return of RemoveAccountRights, state S530"); } #endregion #region Test Starting in S2 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S2() { this.Manager.BeginTest("TestScenarioS7S2"); this.Manager.Comment("reaching state \'S2\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S3\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S97\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp52; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp53; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp53 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp52); this.Manager.Comment("reaching state \'S145\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp52, "policyHandle of OpenPolicy, state S145"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp53, "return of OpenPolicy, state S145"); this.Manager.Comment("reaching state \'S193\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp54; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp55; this.Manager.Comment("executing step \'call CreateAccount(1,4061069327,Valid,\"SID\",out _)\'"); temp55 = this.ILsadManagedAdapterInstance.CreateAccount(1, 4061069327u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp54); this.Manager.Comment("reaching state \'S241\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp54, "accountHandle of CreateAccount, state S241"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp55, "return of CreateAccount, state S241"); this.Manager.Comment("reaching state \'S289\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp56; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp57; this.Manager.Comment("executing step \'call OpenAccount(1,True,Valid,\"SID\",out _)\'"); temp57 = this.ILsadManagedAdapterInstance.OpenAccount(1, true, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp56); this.Manager.Comment("reaching state \'S337\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp56, "accountHandle of OpenAccount, state S337"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp57, "return of OpenAccount, state S337"); this.Manager.Comment("reaching state \'S385\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp58; this.Manager.Comment("executing step \'call AddAccountRights(1,\"SID\",Invalid,{\"SeAssignPrimaryTokenPrivi" + "lege\"})\'"); temp58 = this.ILsadManagedAdapterInstance.AddAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S433\'"); this.Manager.Comment("checking step \'return AddAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp58, "return of AddAccountRights, state S433"); this.Manager.Comment("reaching state \'S481\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp59; this.Manager.Comment("executing step \'call RemoveAccountRights(1,\"SID\",Invalid,0,{\"SeAssignPrimaryToken" + "Privilege\"})\'"); temp59 = this.ILsadManagedAdapterInstance.RemoveAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), 0, new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S529\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp59, "return of RemoveAccountRights, state S529"); TestScenarioS7S576(); this.Manager.EndTest(); } private void TestScenarioS7S576() { this.Manager.Comment("reaching state \'S576\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp60; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp61; this.Manager.Comment("executing step \'call Close(1,out _)\'"); temp61 = this.ILsadManagedAdapterInstance.Close(1, out temp60); this.Manager.Comment("reaching state \'S582\'"); this.Manager.Comment("checking step \'return Close/[out Null]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle.Null, temp60, "handleAfterClose of Close, state S582"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp61, "return of Close, state S582"); this.Manager.Comment("reaching state \'S587\'"); } #endregion #region Test Starting in S20 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S20() { this.Manager.BeginTest("TestScenarioS7S20"); this.Manager.Comment("reaching state \'S20\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S21\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S106\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp62; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp63; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp63 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp62); this.Manager.Comment("reaching state \'S154\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp62, "policyHandle of OpenPolicy, state S154"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp63, "return of OpenPolicy, state S154"); this.Manager.Comment("reaching state \'S202\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp64; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp65; this.Manager.Comment("executing step \'call CreateAccount(1,4061069327,Valid,\"SID\",out _)\'"); temp65 = this.ILsadManagedAdapterInstance.CreateAccount(1, 4061069327u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp64); this.Manager.Comment("reaching state \'S250\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp64, "accountHandle of CreateAccount, state S250"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp65, "return of CreateAccount, state S250"); this.Manager.Comment("reaching state \'S298\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp66; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp67; this.Manager.Comment("executing step \'call OpenAccount(1,False,Invalid,\"SID\",out _)\'"); temp67 = this.ILsadManagedAdapterInstance.OpenAccount(1, false, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), "SID", out temp66); this.Manager.Comment("reaching state \'S346\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp66, "accountHandle of OpenAccount, state S346"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp67, "return of OpenAccount, state S346"); this.Manager.Comment("reaching state \'S394\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp68; this.Manager.Comment("executing step \'call AddAccountRights(1,\"SID\",Invalid,{\"invalidvalue\"})\'"); temp68 = this.ILsadManagedAdapterInstance.AddAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S442\'"); this.Manager.Comment("checking step \'return AddAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp68, "return of AddAccountRights, state S442"); this.Manager.Comment("reaching state \'S490\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp69; this.Manager.Comment("executing step \'call RemoveAccountRights(1,\"SID\",Invalid,0,{\"invalidvalue\"})\'"); temp69 = this.ILsadManagedAdapterInstance.RemoveAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), 0, new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S537\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp69, "return of RemoveAccountRights, state S537"); TestScenarioS7S576(); this.Manager.EndTest(); } #endregion #region Test Starting in S22 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S22() { this.Manager.BeginTest("TestScenarioS7S22"); this.Manager.Comment("reaching state \'S22\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S23\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S107\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp70; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp71; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp71 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp70); this.Manager.Comment("reaching state \'S155\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp70, "policyHandle of OpenPolicy, state S155"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp71, "return of OpenPolicy, state S155"); this.Manager.Comment("reaching state \'S203\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp72; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp73; this.Manager.Comment("executing step \'call CreateAccount(1,4061069327,Valid,\"SID\",out _)\'"); temp73 = this.ILsadManagedAdapterInstance.CreateAccount(1, 4061069327u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp72); this.Manager.Comment("reaching state \'S251\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp72, "accountHandle of CreateAccount, state S251"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp73, "return of CreateAccount, state S251"); this.Manager.Comment("reaching state \'S299\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp74; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp75; this.Manager.Comment("executing step \'call OpenAccount(11,False,Invalid,\"SID\",out _)\'"); temp75 = this.ILsadManagedAdapterInstance.OpenAccount(11, false, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), "SID", out temp74); this.Manager.Comment("reaching state \'S347\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp74, "accountHandle of OpenAccount, state S347"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp75, "return of OpenAccount, state S347"); this.Manager.Comment("reaching state \'S395\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp76; this.Manager.Comment("executing step \'call AddAccountRights(11,\"SID\",Invalid,{\"SeAssignPrimaryTokenPriv" + "ilege\"})\'"); temp76 = this.ILsadManagedAdapterInstance.AddAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S443\'"); this.Manager.Comment("checking step \'return AddAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp76, "return of AddAccountRights, state S443"); this.Manager.Comment("reaching state \'S491\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp77; this.Manager.Comment("executing step \'call RemoveAccountRights(11,\"SID\",Invalid,0,{\"SeAssignPrimaryToke" + "nPrivilege\"})\'"); temp77 = this.ILsadManagedAdapterInstance.RemoveAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), 0, new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S538\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp77, "return of RemoveAccountRights, state S538"); TestScenarioS7S576(); this.Manager.EndTest(); } #endregion #region Test Starting in S24 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S24() { this.Manager.BeginTest("TestScenarioS7S24"); this.Manager.Comment("reaching state \'S24\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S25\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S108\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp78; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp79; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp79 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp78); this.Manager.Comment("reaching state \'S156\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp78, "policyHandle of OpenPolicy, state S156"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp79, "return of OpenPolicy, state S156"); this.Manager.Comment("reaching state \'S204\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp80; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp81; this.Manager.Comment("executing step \'call CreateAccount(1,4061069327,Valid,\"SID\",out _)\'"); temp81 = this.ILsadManagedAdapterInstance.CreateAccount(1, 4061069327u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp80); this.Manager.Comment("reaching state \'S252\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp80, "accountHandle of CreateAccount, state S252"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp81, "return of CreateAccount, state S252"); this.Manager.Comment("reaching state \'S300\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp82; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp83; this.Manager.Comment("executing step \'call OpenAccount(1,True,Invalid,\"SID\",out _)\'"); temp83 = this.ILsadManagedAdapterInstance.OpenAccount(1, true, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), "SID", out temp82); this.Manager.Comment("reaching state \'S348\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp82, "accountHandle of OpenAccount, state S348"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp83, "return of OpenAccount, state S348"); this.Manager.Comment("reaching state \'S396\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp84; this.Manager.Comment("executing step \'call AddAccountRights(11,\"SID\",Invalid,{\"invalidvalue\"})\'"); temp84 = this.ILsadManagedAdapterInstance.AddAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S444\'"); this.Manager.Comment("checking step \'return AddAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp84, "return of AddAccountRights, state S444"); this.Manager.Comment("reaching state \'S492\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp85; this.Manager.Comment("executing step \'call RemoveAccountRights(11,\"SID\",Invalid,0,{\"invalidvalue\"})\'"); temp85 = this.ILsadManagedAdapterInstance.RemoveAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), 0, new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S539\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp85, "return of RemoveAccountRights, state S539"); TestScenarioS7S576(); this.Manager.EndTest(); } #endregion #region Test Starting in S26 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S26() { this.Manager.BeginTest("TestScenarioS7S26"); this.Manager.Comment("reaching state \'S26\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S27\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S109\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp86; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp87; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp87 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp86); this.Manager.Comment("reaching state \'S157\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp86, "policyHandle of OpenPolicy, state S157"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp87, "return of OpenPolicy, state S157"); this.Manager.Comment("reaching state \'S205\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp88; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp89; this.Manager.Comment("executing step \'call CreateAccount(1,4061069327,Valid,\"SID\",out _)\'"); temp89 = this.ILsadManagedAdapterInstance.CreateAccount(1, 4061069327u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp88); this.Manager.Comment("reaching state \'S253\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp88, "accountHandle of CreateAccount, state S253"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp89, "return of CreateAccount, state S253"); this.Manager.Comment("reaching state \'S301\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp90; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp91; this.Manager.Comment("executing step \'call OpenAccount(11,True,Invalid,\"SID\",out _)\'"); temp91 = this.ILsadManagedAdapterInstance.OpenAccount(11, true, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), "SID", out temp90); this.Manager.Comment("reaching state \'S349\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp90, "accountHandle of OpenAccount, state S349"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp91, "return of OpenAccount, state S349"); this.Manager.Comment("reaching state \'S397\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp92; this.Manager.Comment("executing step \'call AddAccountRights(1,\"SID\",Valid,{\"invalidvalue\"})\'"); temp92 = this.ILsadManagedAdapterInstance.AddAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S445\'"); this.Manager.Comment("checking step \'return AddAccountRights/NoSuchPrivilege\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.NoSuchPrivilege, temp92, "return of AddAccountRights, state S445"); this.Manager.Comment("reaching state \'S493\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp93; this.Manager.Comment("executing step \'call RemoveAccountRights(1,\"SID\",Valid,0,{\"invalidvalue\"})\'"); temp93 = this.ILsadManagedAdapterInstance.RemoveAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), 0, new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S540\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/NoSuchPrivilege\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.NoSuchPrivilege, temp93, "return of RemoveAccountRights, state S540"); TestScenarioS7S576(); this.Manager.EndTest(); } #endregion #region Test Starting in S28 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S28() { this.Manager.BeginTest("TestScenarioS7S28"); this.Manager.Comment("reaching state \'S28\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S29\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S110\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp94; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp95; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp95 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp94); this.Manager.Comment("reaching state \'S158\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp94, "policyHandle of OpenPolicy, state S158"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp95, "return of OpenPolicy, state S158"); this.Manager.Comment("reaching state \'S206\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp96; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp97; this.Manager.Comment("executing step \'call CreateAccount(1,4061069327,Valid,\"SID\",out _)\'"); temp97 = this.ILsadManagedAdapterInstance.CreateAccount(1, 4061069327u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp96); this.Manager.Comment("reaching state \'S254\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp96, "accountHandle of CreateAccount, state S254"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp97, "return of CreateAccount, state S254"); this.Manager.Comment("reaching state \'S302\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp98; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp99; this.Manager.Comment("executing step \'call OpenAccount(11,False,Valid,\"SID\",out _)\'"); temp99 = this.ILsadManagedAdapterInstance.OpenAccount(11, false, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp98); this.Manager.Comment("reaching state \'S350\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:InvalidHandle\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp98, "accountHandle of OpenAccount, state S350"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidHandle, temp99, "return of OpenAccount, state S350"); this.Manager.Comment("reaching state \'S398\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp100; this.Manager.Comment("executing step \'call AddAccountRights(11,\"SID\",Valid,{\"SeAssignPrimaryTokenPrivil" + "ege\"})\'"); temp100 = this.ILsadManagedAdapterInstance.AddAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S446\'"); this.Manager.Comment("checking step \'return AddAccountRights/InvalidHandle\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidHandle, temp100, "return of AddAccountRights, state S446"); this.Manager.Comment("reaching state \'S494\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp101; this.Manager.Comment("executing step \'call RemoveAccountRights(11,\"SID\",Valid,0,{\"SeAssignPrimaryTokenP" + "rivilege\"})\'"); temp101 = this.ILsadManagedAdapterInstance.RemoveAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), 0, new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S541\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/InvalidHandle\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidHandle, temp101, "return of RemoveAccountRights, state S541"); TestScenarioS7S576(); this.Manager.EndTest(); } #endregion #region Test Starting in S30 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S30() { this.Manager.BeginTest("TestScenarioS7S30"); this.Manager.Comment("reaching state \'S30\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S31\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S111\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp102; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp103; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp103 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp102); this.Manager.Comment("reaching state \'S159\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp102, "policyHandle of OpenPolicy, state S159"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp103, "return of OpenPolicy, state S159"); this.Manager.Comment("reaching state \'S207\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp104; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp105; this.Manager.Comment("executing step \'call CreateAccount(1,4061069327,Valid,\"SID\",out _)\'"); temp105 = this.ILsadManagedAdapterInstance.CreateAccount(1, 4061069327u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp104); this.Manager.Comment("reaching state \'S255\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp104, "accountHandle of CreateAccount, state S255"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp105, "return of CreateAccount, state S255"); this.Manager.Comment("reaching state \'S303\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp106; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp107; this.Manager.Comment("executing step \'call OpenAccount(11,True,Valid,\"SID\",out _)\'"); temp107 = this.ILsadManagedAdapterInstance.OpenAccount(11, true, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp106); this.Manager.Comment("reaching state \'S351\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:InvalidHandle\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp106, "accountHandle of OpenAccount, state S351"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidHandle, temp107, "return of OpenAccount, state S351"); this.Manager.Comment("reaching state \'S399\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp108; this.Manager.Comment("executing step \'call AddAccountRights(11,\"SID\",Valid,{\"invalidvalue\"})\'"); temp108 = this.ILsadManagedAdapterInstance.AddAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S447\'"); this.Manager.Comment("checking step \'return AddAccountRights/InvalidHandle\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidHandle, temp108, "return of AddAccountRights, state S447"); this.Manager.Comment("reaching state \'S495\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp109; this.Manager.Comment("executing step \'call RemoveAccountRights(11,\"SID\",Valid,0,{\"invalidvalue\"})\'"); temp109 = this.ILsadManagedAdapterInstance.RemoveAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), 0, new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S542\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/InvalidHandle\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidHandle, temp109, "return of RemoveAccountRights, state S542"); TestScenarioS7S576(); this.Manager.EndTest(); } #endregion #region Test Starting in S32 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S32() { this.Manager.BeginTest("TestScenarioS7S32"); this.Manager.Comment("reaching state \'S32\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S33\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S112\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp110; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp111; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp111 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp110); this.Manager.Comment("reaching state \'S160\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp110, "policyHandle of OpenPolicy, state S160"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp111, "return of OpenPolicy, state S160"); this.Manager.Comment("reaching state \'S208\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp112; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp113; this.Manager.Comment("executing step \'call CreateAccount(1,0,Invalid,\"SID\",out _)\'"); temp113 = this.ILsadManagedAdapterInstance.CreateAccount(1, 0u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), "SID", out temp112); this.Manager.Comment("reaching state \'S256\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Invalid]:InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp112, "accountHandle of CreateAccount, state S256"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp113, "return of CreateAccount, state S256"); this.Manager.Comment("reaching state \'S304\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp114; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp115; this.Manager.Comment("executing step \'call OpenAccount(1,False,Valid,\"SID\",out _)\'"); temp115 = this.ILsadManagedAdapterInstance.OpenAccount(1, false, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp114); this.Manager.Comment("reaching state \'S352\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:AccessDenied\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp114, "accountHandle of OpenAccount, state S352"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.AccessDenied, temp115, "return of OpenAccount, state S352"); this.Manager.Comment("reaching state \'S400\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp116; this.Manager.Comment("executing step \'call AddAccountRights(1,\"SID\",Valid,{\"SeAssignPrimaryTokenPrivile" + "ge\"})\'"); temp116 = this.ILsadManagedAdapterInstance.AddAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S448\'"); this.Manager.Comment("checking step \'return AddAccountRights/Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp116, "return of AddAccountRights, state S448"); this.Manager.Comment("reaching state \'S496\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp117; this.Manager.Comment("executing step \'call RemoveAccountRights(1,\"SID\",Valid,0,{\"SeAssignPrimaryTokenPr" + "ivilege\"})\'"); temp117 = this.ILsadManagedAdapterInstance.RemoveAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), 0, new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S543\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/AccessDenied\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.AccessDenied, temp117, "return of RemoveAccountRights, state S543"); TestScenarioS7S578(); this.Manager.EndTest(); } private void TestScenarioS7S578() { this.Manager.Comment("reaching state \'S578\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp118; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp119; this.Manager.Comment("executing step \'call Close(1,out _)\'"); temp119 = this.ILsadManagedAdapterInstance.Close(1, out temp118); this.Manager.Comment("reaching state \'S584\'"); this.Manager.Comment("checking step \'return Close/[out Null]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle.Null, temp118, "handleAfterClose of Close, state S584"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp119, "return of Close, state S584"); this.Manager.Comment("reaching state \'S589\'"); } #endregion #region Test Starting in S34 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S34() { this.Manager.BeginTest("TestScenarioS7S34"); this.Manager.Comment("reaching state \'S34\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S35\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S113\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp120; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp121; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp121 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp120); this.Manager.Comment("reaching state \'S161\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp120, "policyHandle of OpenPolicy, state S161"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp121, "return of OpenPolicy, state S161"); this.Manager.Comment("reaching state \'S209\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp122; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp123; this.Manager.Comment("executing step \'call CreateAccount(1,0,Invalid,\"SID\",out _)\'"); temp123 = this.ILsadManagedAdapterInstance.CreateAccount(1, 0u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), "SID", out temp122); this.Manager.Comment("reaching state \'S257\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Invalid]:InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp122, "accountHandle of CreateAccount, state S257"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp123, "return of CreateAccount, state S257"); this.Manager.Comment("reaching state \'S305\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp124; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp125; this.Manager.Comment("executing step \'call OpenAccount(1,False,Valid,\"SID\",out _)\'"); temp125 = this.ILsadManagedAdapterInstance.OpenAccount(1, false, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp124); this.Manager.Comment("reaching state \'S353\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:AccessDenied\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp124, "accountHandle of OpenAccount, state S353"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.AccessDenied, temp125, "return of OpenAccount, state S353"); this.Manager.Comment("reaching state \'S401\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp126; this.Manager.Comment("executing step \'call AddAccountRights(1,\"SID\",Valid,{\"SeAssignPrimaryTokenPrivile" + "ge\"})\'"); temp126 = this.ILsadManagedAdapterInstance.AddAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S449\'"); this.Manager.Comment("checking step \'return AddAccountRights/Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp126, "return of AddAccountRights, state S449"); this.Manager.Comment("reaching state \'S497\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp127; this.Manager.Comment("executing step \'call RemoveAccountRights(1,\"SID\",Valid,0,{\"invalidvalue\"})\'"); temp127 = this.ILsadManagedAdapterInstance.RemoveAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), 0, new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S544\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/AccessDenied\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.AccessDenied, temp127, "return of RemoveAccountRights, state S544"); TestScenarioS7S578(); this.Manager.EndTest(); } #endregion #region Test Starting in S36 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S36() { this.Manager.BeginTest("TestScenarioS7S36"); this.Manager.Comment("reaching state \'S36\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S37\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S114\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp128; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp129; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp129 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp128); this.Manager.Comment("reaching state \'S162\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp128, "policyHandle of OpenPolicy, state S162"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp129, "return of OpenPolicy, state S162"); this.Manager.Comment("reaching state \'S210\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp130; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp131; this.Manager.Comment("executing step \'call CreateAccount(1,0,Invalid,\"SID\",out _)\'"); temp131 = this.ILsadManagedAdapterInstance.CreateAccount(1, 0u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), "SID", out temp130); this.Manager.Comment("reaching state \'S258\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Invalid]:InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp130, "accountHandle of CreateAccount, state S258"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp131, "return of CreateAccount, state S258"); this.Manager.Comment("reaching state \'S306\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp132; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp133; this.Manager.Comment("executing step \'call OpenAccount(1,False,Valid,\"SID\",out _)\'"); temp133 = this.ILsadManagedAdapterInstance.OpenAccount(1, false, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp132); this.Manager.Comment("reaching state \'S354\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:AccessDenied\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp132, "accountHandle of OpenAccount, state S354"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.AccessDenied, temp133, "return of OpenAccount, state S354"); this.Manager.Comment("reaching state \'S402\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp134; this.Manager.Comment("executing step \'call AddAccountRights(1,\"SID\",Valid,{\"SeAssignPrimaryTokenPrivile" + "ge\"})\'"); temp134 = this.ILsadManagedAdapterInstance.AddAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S450\'"); this.Manager.Comment("checking step \'return AddAccountRights/Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp134, "return of AddAccountRights, state S450"); this.Manager.Comment("reaching state \'S498\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp135; this.Manager.Comment("executing step \'call RemoveAccountRights(1,\"SID\",Invalid,0,{\"SeAssignPrimaryToken" + "Privilege\"})\'"); temp135 = this.ILsadManagedAdapterInstance.RemoveAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), 0, new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S545\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp135, "return of RemoveAccountRights, state S545"); TestScenarioS7S578(); this.Manager.EndTest(); } #endregion #region Test Starting in S38 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S38() { this.Manager.BeginTest("TestScenarioS7S38"); this.Manager.Comment("reaching state \'S38\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S39\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S115\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp136; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp137; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp137 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp136); this.Manager.Comment("reaching state \'S163\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp136, "policyHandle of OpenPolicy, state S163"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp137, "return of OpenPolicy, state S163"); this.Manager.Comment("reaching state \'S211\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp138; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp139; this.Manager.Comment("executing step \'call CreateAccount(1,0,Invalid,\"SID\",out _)\'"); temp139 = this.ILsadManagedAdapterInstance.CreateAccount(1, 0u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), "SID", out temp138); this.Manager.Comment("reaching state \'S259\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Invalid]:InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp138, "accountHandle of CreateAccount, state S259"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp139, "return of CreateAccount, state S259"); this.Manager.Comment("reaching state \'S307\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp140; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp141; this.Manager.Comment("executing step \'call OpenAccount(1,False,Valid,\"SID\",out _)\'"); temp141 = this.ILsadManagedAdapterInstance.OpenAccount(1, false, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp140); this.Manager.Comment("reaching state \'S355\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:AccessDenied\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp140, "accountHandle of OpenAccount, state S355"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.AccessDenied, temp141, "return of OpenAccount, state S355"); this.Manager.Comment("reaching state \'S403\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp142; this.Manager.Comment("executing step \'call AddAccountRights(1,\"SID\",Valid,{\"SeAssignPrimaryTokenPrivile" + "ge\"})\'"); temp142 = this.ILsadManagedAdapterInstance.AddAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S451\'"); this.Manager.Comment("checking step \'return AddAccountRights/Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp142, "return of AddAccountRights, state S451"); this.Manager.Comment("reaching state \'S499\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp143; this.Manager.Comment("executing step \'call RemoveAccountRights(1,\"SID\",Invalid,0,{\"invalidvalue\"})\'"); temp143 = this.ILsadManagedAdapterInstance.RemoveAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), 0, new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S546\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp143, "return of RemoveAccountRights, state S546"); TestScenarioS7S578(); this.Manager.EndTest(); } #endregion #region Test Starting in S4 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S4() { this.Manager.BeginTest("TestScenarioS7S4"); this.Manager.Comment("reaching state \'S4\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S5\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S98\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp144; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp145; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp145 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp144); this.Manager.Comment("reaching state \'S146\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp144, "policyHandle of OpenPolicy, state S146"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp145, "return of OpenPolicy, state S146"); this.Manager.Comment("reaching state \'S194\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp146; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp147; this.Manager.Comment("executing step \'call CreateAccount(1,4061069327,Valid,\"SID\",out _)\'"); temp147 = this.ILsadManagedAdapterInstance.CreateAccount(1, 4061069327u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp146); this.Manager.Comment("reaching state \'S242\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp146, "accountHandle of CreateAccount, state S242"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp147, "return of CreateAccount, state S242"); this.Manager.Comment("reaching state \'S290\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp148; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp149; this.Manager.Comment("executing step \'call OpenAccount(1,True,Valid,\"SID\",out _)\'"); temp149 = this.ILsadManagedAdapterInstance.OpenAccount(1, true, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp148); this.Manager.Comment("reaching state \'S338\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp148, "accountHandle of OpenAccount, state S338"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp149, "return of OpenAccount, state S338"); this.Manager.Comment("reaching state \'S386\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp150; this.Manager.Comment("executing step \'call AddAccountRights(1,\"SID\",Valid,{\"SeAssignPrimaryTokenPrivile" + "ge\"})\'"); temp150 = this.ILsadManagedAdapterInstance.AddAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S434\'"); this.Manager.Comment("checking step \'return AddAccountRights/Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp150, "return of AddAccountRights, state S434"); this.Manager.Comment("reaching state \'S482\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp151; this.Manager.Comment("executing step \'call RemoveAccountRights(1,\"SID\",Valid,0,{\"SeAssignPrimaryTokenPr" + "ivilege\"})\'"); temp151 = this.ILsadManagedAdapterInstance.RemoveAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), 0, new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.AddReturn(RemoveAccountRightsInfo, null, temp151); TestScenarioS7S530(); this.Manager.EndTest(); } #endregion #region Test Starting in S40 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S40() { this.Manager.BeginTest("TestScenarioS7S40"); this.Manager.Comment("reaching state \'S40\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S41\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S116\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp152; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp153; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp153 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp152); this.Manager.Comment("reaching state \'S164\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp152, "policyHandle of OpenPolicy, state S164"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp153, "return of OpenPolicy, state S164"); this.Manager.Comment("reaching state \'S212\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp154; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp155; this.Manager.Comment("executing step \'call CreateAccount(1,0,Invalid,\"SID\",out _)\'"); temp155 = this.ILsadManagedAdapterInstance.CreateAccount(1, 0u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), "SID", out temp154); this.Manager.Comment("reaching state \'S260\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Invalid]:InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp154, "accountHandle of CreateAccount, state S260"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp155, "return of CreateAccount, state S260"); this.Manager.Comment("reaching state \'S308\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp156; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp157; this.Manager.Comment("executing step \'call OpenAccount(1,False,Valid,\"SID\",out _)\'"); temp157 = this.ILsadManagedAdapterInstance.OpenAccount(1, false, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp156); this.Manager.Comment("reaching state \'S356\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:AccessDenied\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp156, "accountHandle of OpenAccount, state S356"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.AccessDenied, temp157, "return of OpenAccount, state S356"); this.Manager.Comment("reaching state \'S404\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp158; this.Manager.Comment("executing step \'call AddAccountRights(1,\"SID\",Valid,{\"SeAssignPrimaryTokenPrivile" + "ge\"})\'"); temp158 = this.ILsadManagedAdapterInstance.AddAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S452\'"); this.Manager.Comment("checking step \'return AddAccountRights/Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp158, "return of AddAccountRights, state S452"); this.Manager.Comment("reaching state \'S500\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp159; this.Manager.Comment("executing step \'call RemoveAccountRights(11,\"SID\",Invalid,0,{\"SeAssignPrimaryToke" + "nPrivilege\"})\'"); temp159 = this.ILsadManagedAdapterInstance.RemoveAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), 0, new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S547\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp159, "return of RemoveAccountRights, state S547"); TestScenarioS7S578(); this.Manager.EndTest(); } #endregion #region Test Starting in S42 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S42() { this.Manager.BeginTest("TestScenarioS7S42"); this.Manager.Comment("reaching state \'S42\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S43\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S117\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp160; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp161; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp161 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp160); this.Manager.Comment("reaching state \'S165\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp160, "policyHandle of OpenPolicy, state S165"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp161, "return of OpenPolicy, state S165"); this.Manager.Comment("reaching state \'S213\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp162; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp163; this.Manager.Comment("executing step \'call CreateAccount(1,0,Invalid,\"SID\",out _)\'"); temp163 = this.ILsadManagedAdapterInstance.CreateAccount(1, 0u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), "SID", out temp162); this.Manager.Comment("reaching state \'S261\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Invalid]:InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp162, "accountHandle of CreateAccount, state S261"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp163, "return of CreateAccount, state S261"); this.Manager.Comment("reaching state \'S309\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp164; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp165; this.Manager.Comment("executing step \'call OpenAccount(1,False,Valid,\"SID\",out _)\'"); temp165 = this.ILsadManagedAdapterInstance.OpenAccount(1, false, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp164); this.Manager.Comment("reaching state \'S357\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:AccessDenied\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp164, "accountHandle of OpenAccount, state S357"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.AccessDenied, temp165, "return of OpenAccount, state S357"); this.Manager.Comment("reaching state \'S405\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp166; this.Manager.Comment("executing step \'call AddAccountRights(1,\"SID\",Valid,{\"SeAssignPrimaryTokenPrivile" + "ge\"})\'"); temp166 = this.ILsadManagedAdapterInstance.AddAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S453\'"); this.Manager.Comment("checking step \'return AddAccountRights/Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp166, "return of AddAccountRights, state S453"); this.Manager.Comment("reaching state \'S501\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp167; this.Manager.Comment("executing step \'call RemoveAccountRights(11,\"SID\",Invalid,0,{\"invalidvalue\"})\'"); temp167 = this.ILsadManagedAdapterInstance.RemoveAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), 0, new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S548\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp167, "return of RemoveAccountRights, state S548"); TestScenarioS7S578(); this.Manager.EndTest(); } #endregion #region Test Starting in S44 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S44() { this.Manager.BeginTest("TestScenarioS7S44"); this.Manager.Comment("reaching state \'S44\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S45\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S118\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp168; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp169; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp169 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp168); this.Manager.Comment("reaching state \'S166\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp168, "policyHandle of OpenPolicy, state S166"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp169, "return of OpenPolicy, state S166"); this.Manager.Comment("reaching state \'S214\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp170; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp171; this.Manager.Comment("executing step \'call CreateAccount(1,0,Invalid,\"SID\",out _)\'"); temp171 = this.ILsadManagedAdapterInstance.CreateAccount(1, 0u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), "SID", out temp170); this.Manager.Comment("reaching state \'S262\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Invalid]:InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp170, "accountHandle of CreateAccount, state S262"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp171, "return of CreateAccount, state S262"); this.Manager.Comment("reaching state \'S310\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp172; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp173; this.Manager.Comment("executing step \'call OpenAccount(1,False,Valid,\"SID\",out _)\'"); temp173 = this.ILsadManagedAdapterInstance.OpenAccount(1, false, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp172); this.Manager.Comment("reaching state \'S358\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:AccessDenied\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp172, "accountHandle of OpenAccount, state S358"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.AccessDenied, temp173, "return of OpenAccount, state S358"); this.Manager.Comment("reaching state \'S406\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp174; this.Manager.Comment("executing step \'call AddAccountRights(1,\"SID\",Valid,{\"SeAssignPrimaryTokenPrivile" + "ge\"})\'"); temp174 = this.ILsadManagedAdapterInstance.AddAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S454\'"); this.Manager.Comment("checking step \'return AddAccountRights/Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp174, "return of AddAccountRights, state S454"); this.Manager.Comment("reaching state \'S502\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp175; this.Manager.Comment("executing step \'call RemoveAccountRights(11,\"SID\",Valid,0,{\"SeAssignPrimaryTokenP" + "rivilege\"})\'"); temp175 = this.ILsadManagedAdapterInstance.RemoveAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), 0, new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S549\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/InvalidHandle\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidHandle, temp175, "return of RemoveAccountRights, state S549"); TestScenarioS7S578(); this.Manager.EndTest(); } #endregion #region Test Starting in S46 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S46() { this.Manager.BeginTest("TestScenarioS7S46"); this.Manager.Comment("reaching state \'S46\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S47\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S119\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp176; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp177; this.Manager.Comment("executing step \'call OpenPolicy(Null,1,out _)\'"); temp177 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 1u, out temp176); this.Manager.Comment("reaching state \'S167\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp176, "policyHandle of OpenPolicy, state S167"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp177, "return of OpenPolicy, state S167"); this.Manager.Comment("reaching state \'S215\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp178; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp179; this.Manager.Comment("executing step \'call CreateAccount(1,0,Valid,\"SID\",out _)\'"); temp179 = this.ILsadManagedAdapterInstance.CreateAccount(1, 0u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp178); this.Manager.Comment("reaching state \'S263\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Invalid]:AccessDenied\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp178, "accountHandle of CreateAccount, state S263"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.AccessDenied, temp179, "return of CreateAccount, state S263"); this.Manager.Comment("reaching state \'S311\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp180; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp181; this.Manager.Comment("executing step \'call OpenAccount(1,False,Valid,\"SID\",out _)\'"); temp181 = this.ILsadManagedAdapterInstance.OpenAccount(1, false, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp180); this.Manager.Comment("reaching state \'S359\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:AccessDenied\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp180, "accountHandle of OpenAccount, state S359"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.AccessDenied, temp181, "return of OpenAccount, state S359"); this.Manager.Comment("reaching state \'S407\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp182; this.Manager.Comment("executing step \'call AddAccountRights(1,\"SID\",Valid,{\"SeAssignPrimaryTokenPrivile" + "ge\"})\'"); temp182 = this.ILsadManagedAdapterInstance.AddAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S455\'"); this.Manager.Comment("checking step \'return AddAccountRights/AccessDenied\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.AccessDenied, temp182, "return of AddAccountRights, state S455"); this.Manager.Comment("reaching state \'S503\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp183; this.Manager.Comment("executing step \'call RemoveAccountRights(1,\"SID\",Invalid,0,{\"SeAssignPrimaryToken" + "Privilege\"})\'"); temp183 = this.ILsadManagedAdapterInstance.RemoveAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), 0, new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S550\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp183, "return of RemoveAccountRights, state S550"); TestScenarioS7S579(); this.Manager.EndTest(); } private void TestScenarioS7S579() { this.Manager.Comment("reaching state \'S579\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp184; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp185; this.Manager.Comment("executing step \'call Close(1,out _)\'"); temp185 = this.ILsadManagedAdapterInstance.Close(1, out temp184); this.Manager.AddReturn(CloseInfo, null, temp184, temp185); TestScenarioS7S581(); } #endregion #region Test Starting in S48 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S48() { this.Manager.BeginTest("TestScenarioS7S48"); this.Manager.Comment("reaching state \'S48\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S49\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S120\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp186; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp187; this.Manager.Comment("executing step \'call OpenPolicy(Null,1,out _)\'"); temp187 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 1u, out temp186); this.Manager.Comment("reaching state \'S168\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp186, "policyHandle of OpenPolicy, state S168"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp187, "return of OpenPolicy, state S168"); this.Manager.Comment("reaching state \'S216\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp188; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp189; this.Manager.Comment("executing step \'call CreateAccount(1,4061069327,Valid,\"SID\",out _)\'"); temp189 = this.ILsadManagedAdapterInstance.CreateAccount(1, 4061069327u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp188); this.Manager.Comment("reaching state \'S264\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Invalid]:AccessDenied\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp188, "accountHandle of CreateAccount, state S264"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.AccessDenied, temp189, "return of CreateAccount, state S264"); this.Manager.Comment("reaching state \'S312\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp190; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp191; this.Manager.Comment("executing step \'call OpenAccount(1,False,Invalid,\"SID\",out _)\'"); temp191 = this.ILsadManagedAdapterInstance.OpenAccount(1, false, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), "SID", out temp190); this.Manager.Comment("reaching state \'S360\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp190, "accountHandle of OpenAccount, state S360"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp191, "return of OpenAccount, state S360"); this.Manager.Comment("reaching state \'S408\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp192; this.Manager.Comment("executing step \'call AddAccountRights(1,\"SID\",Valid,{\"invalidvalue\"})\'"); temp192 = this.ILsadManagedAdapterInstance.AddAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S456\'"); this.Manager.Comment("checking step \'return AddAccountRights/AccessDenied\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.AccessDenied, temp192, "return of AddAccountRights, state S456"); this.Manager.Comment("reaching state \'S504\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp193; this.Manager.Comment("executing step \'call RemoveAccountRights(1,\"SID\",Invalid,0,{\"invalidvalue\"})\'"); temp193 = this.ILsadManagedAdapterInstance.RemoveAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), 0, new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S551\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp193, "return of RemoveAccountRights, state S551"); TestScenarioS7S579(); this.Manager.EndTest(); } #endregion #region Test Starting in S50 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S50() { this.Manager.BeginTest("TestScenarioS7S50"); this.Manager.Comment("reaching state \'S50\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S51\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S121\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp194; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp195; this.Manager.Comment("executing step \'call OpenPolicy(Null,1,out _)\'"); temp195 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 1u, out temp194); this.Manager.Comment("reaching state \'S169\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp194, "policyHandle of OpenPolicy, state S169"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp195, "return of OpenPolicy, state S169"); this.Manager.Comment("reaching state \'S217\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp196; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp197; this.Manager.Comment("executing step \'call CreateAccount(1,0,Invalid,\"SID\",out _)\'"); temp197 = this.ILsadManagedAdapterInstance.CreateAccount(1, 0u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), "SID", out temp196); this.Manager.Comment("reaching state \'S265\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Invalid]:InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp196, "accountHandle of CreateAccount, state S265"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp197, "return of CreateAccount, state S265"); this.Manager.Comment("reaching state \'S313\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp198; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp199; this.Manager.Comment("executing step \'call OpenAccount(11,False,Invalid,\"SID\",out _)\'"); temp199 = this.ILsadManagedAdapterInstance.OpenAccount(11, false, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), "SID", out temp198); this.Manager.Comment("reaching state \'S361\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp198, "accountHandle of OpenAccount, state S361"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp199, "return of OpenAccount, state S361"); this.Manager.Comment("reaching state \'S409\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp200; this.Manager.Comment("executing step \'call AddAccountRights(1,\"SID\",Invalid,{\"SeAssignPrimaryTokenPrivi" + "lege\"})\'"); temp200 = this.ILsadManagedAdapterInstance.AddAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S457\'"); this.Manager.Comment("checking step \'return AddAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp200, "return of AddAccountRights, state S457"); this.Manager.Comment("reaching state \'S505\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp201; this.Manager.Comment("executing step \'call RemoveAccountRights(11,\"SID\",Invalid,0,{\"SeAssignPrimaryToke" + "nPrivilege\"})\'"); temp201 = this.ILsadManagedAdapterInstance.RemoveAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), 0, new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S552\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp201, "return of RemoveAccountRights, state S552"); TestScenarioS7S579(); this.Manager.EndTest(); } #endregion #region Test Starting in S52 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S52() { this.Manager.BeginTest("TestScenarioS7S52"); this.Manager.Comment("reaching state \'S52\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S53\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S122\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp202; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp203; this.Manager.Comment("executing step \'call OpenPolicy(Null,1,out _)\'"); temp203 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 1u, out temp202); this.Manager.Comment("reaching state \'S170\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp202, "policyHandle of OpenPolicy, state S170"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp203, "return of OpenPolicy, state S170"); this.Manager.Comment("reaching state \'S218\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp204; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp205; this.Manager.Comment("executing step \'call CreateAccount(11,0,Invalid,\"SID\",out _)\'"); temp205 = this.ILsadManagedAdapterInstance.CreateAccount(11, 0u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), "SID", out temp204); this.Manager.Comment("reaching state \'S266\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Invalid]:InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp204, "accountHandle of CreateAccount, state S266"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp205, "return of CreateAccount, state S266"); this.Manager.Comment("reaching state \'S314\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp206; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp207; this.Manager.Comment("executing step \'call OpenAccount(1,True,Invalid,\"SID\",out _)\'"); temp207 = this.ILsadManagedAdapterInstance.OpenAccount(1, true, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), "SID", out temp206); this.Manager.Comment("reaching state \'S362\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp206, "accountHandle of OpenAccount, state S362"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp207, "return of OpenAccount, state S362"); this.Manager.Comment("reaching state \'S410\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp208; this.Manager.Comment("executing step \'call AddAccountRights(1,\"SID\",Invalid,{\"invalidvalue\"})\'"); temp208 = this.ILsadManagedAdapterInstance.AddAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S458\'"); this.Manager.Comment("checking step \'return AddAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp208, "return of AddAccountRights, state S458"); this.Manager.Comment("reaching state \'S506\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp209; this.Manager.Comment("executing step \'call RemoveAccountRights(11,\"SID\",Invalid,0,{\"invalidvalue\"})\'"); temp209 = this.ILsadManagedAdapterInstance.RemoveAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), 0, new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S553\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp209, "return of RemoveAccountRights, state S553"); TestScenarioS7S579(); this.Manager.EndTest(); } #endregion #region Test Starting in S54 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S54() { this.Manager.BeginTest("TestScenarioS7S54"); this.Manager.Comment("reaching state \'S54\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S55\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S123\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp210; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp211; this.Manager.Comment("executing step \'call OpenPolicy(Null,1,out _)\'"); temp211 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 1u, out temp210); this.Manager.Comment("reaching state \'S171\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp210, "policyHandle of OpenPolicy, state S171"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp211, "return of OpenPolicy, state S171"); this.Manager.Comment("reaching state \'S219\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp212; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp213; this.Manager.Comment("executing step \'call CreateAccount(1,4061069327,Invalid,\"SID\",out _)\'"); temp213 = this.ILsadManagedAdapterInstance.CreateAccount(1, 4061069327u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), "SID", out temp212); this.Manager.Comment("reaching state \'S267\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Invalid]:InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp212, "accountHandle of CreateAccount, state S267"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp213, "return of CreateAccount, state S267"); this.Manager.Comment("reaching state \'S315\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp214; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp215; this.Manager.Comment("executing step \'call OpenAccount(11,True,Invalid,\"SID\",out _)\'"); temp215 = this.ILsadManagedAdapterInstance.OpenAccount(11, true, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), "SID", out temp214); this.Manager.Comment("reaching state \'S363\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp214, "accountHandle of OpenAccount, state S363"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp215, "return of OpenAccount, state S363"); this.Manager.Comment("reaching state \'S411\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp216; this.Manager.Comment("executing step \'call AddAccountRights(11,\"SID\",Invalid,{\"SeAssignPrimaryTokenPriv" + "ilege\"})\'"); temp216 = this.ILsadManagedAdapterInstance.AddAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S459\'"); this.Manager.Comment("checking step \'return AddAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp216, "return of AddAccountRights, state S459"); this.Manager.Comment("reaching state \'S507\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp217; this.Manager.Comment("executing step \'call RemoveAccountRights(1,\"SID\",Valid,0,{\"SeAssignPrimaryTokenPr" + "ivilege\"})\'"); temp217 = this.ILsadManagedAdapterInstance.RemoveAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), 0, new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S554\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/ObjectNameNotFound\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.ObjectNameNotFound, temp217, "return of RemoveAccountRights, state S554"); TestScenarioS7S579(); this.Manager.EndTest(); } #endregion #region Test Starting in S56 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S56() { this.Manager.BeginTest("TestScenarioS7S56"); this.Manager.Comment("reaching state \'S56\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S57\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S124\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp218; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp219; this.Manager.Comment("executing step \'call OpenPolicy(Null,1,out _)\'"); temp219 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 1u, out temp218); this.Manager.Comment("reaching state \'S172\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp218, "policyHandle of OpenPolicy, state S172"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp219, "return of OpenPolicy, state S172"); this.Manager.Comment("reaching state \'S220\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp220; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp221; this.Manager.Comment("executing step \'call CreateAccount(11,4061069327,Invalid,\"SID\",out _)\'"); temp221 = this.ILsadManagedAdapterInstance.CreateAccount(11, 4061069327u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), "SID", out temp220); this.Manager.Comment("reaching state \'S268\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Invalid]:InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp220, "accountHandle of CreateAccount, state S268"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp221, "return of CreateAccount, state S268"); this.Manager.Comment("reaching state \'S316\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp222; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp223; this.Manager.Comment("executing step \'call OpenAccount(1,True,Valid,\"SID\",out _)\'"); temp223 = this.ILsadManagedAdapterInstance.OpenAccount(1, true, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp222); this.Manager.Comment("reaching state \'S364\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:ObjectNameNotFound\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp222, "accountHandle of OpenAccount, state S364"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.ObjectNameNotFound, temp223, "return of OpenAccount, state S364"); this.Manager.Comment("reaching state \'S412\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp224; this.Manager.Comment("executing step \'call AddAccountRights(11,\"SID\",Invalid,{\"invalidvalue\"})\'"); temp224 = this.ILsadManagedAdapterInstance.AddAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S460\'"); this.Manager.Comment("checking step \'return AddAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp224, "return of AddAccountRights, state S460"); this.Manager.Comment("reaching state \'S508\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp225; this.Manager.Comment("executing step \'call RemoveAccountRights(1,\"SID\",Valid,0,{\"invalidvalue\"})\'"); temp225 = this.ILsadManagedAdapterInstance.RemoveAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), 0, new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S555\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/ObjectNameNotFound\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.ObjectNameNotFound, temp225, "return of RemoveAccountRights, state S555"); TestScenarioS7S579(); this.Manager.EndTest(); } #endregion #region Test Starting in S58 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S58() { this.Manager.BeginTest("TestScenarioS7S58"); this.Manager.Comment("reaching state \'S58\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S59\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S125\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp226; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp227; this.Manager.Comment("executing step \'call OpenPolicy(Null,1,out _)\'"); temp227 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 1u, out temp226); this.Manager.Comment("reaching state \'S173\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp226, "policyHandle of OpenPolicy, state S173"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp227, "return of OpenPolicy, state S173"); this.Manager.Comment("reaching state \'S221\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp228; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp229; this.Manager.Comment("executing step \'call CreateAccount(11,0,Valid,\"SID\",out _)\'"); temp229 = this.ILsadManagedAdapterInstance.CreateAccount(11, 0u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp228); this.Manager.Comment("reaching state \'S269\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Invalid]:InvalidHandle\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp228, "accountHandle of CreateAccount, state S269"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidHandle, temp229, "return of CreateAccount, state S269"); this.Manager.Comment("reaching state \'S317\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp230; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp231; this.Manager.Comment("executing step \'call OpenAccount(11,False,Valid,\"SID\",out _)\'"); temp231 = this.ILsadManagedAdapterInstance.OpenAccount(11, false, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp230); this.Manager.Comment("reaching state \'S365\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:InvalidHandle\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp230, "accountHandle of OpenAccount, state S365"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidHandle, temp231, "return of OpenAccount, state S365"); this.Manager.Comment("reaching state \'S413\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp232; this.Manager.Comment("executing step \'call AddAccountRights(11,\"SID\",Valid,{\"SeAssignPrimaryTokenPrivil" + "ege\"})\'"); temp232 = this.ILsadManagedAdapterInstance.AddAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S461\'"); this.Manager.Comment("checking step \'return AddAccountRights/InvalidHandle\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidHandle, temp232, "return of AddAccountRights, state S461"); this.Manager.Comment("reaching state \'S509\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp233; this.Manager.Comment("executing step \'call RemoveAccountRights(11,\"SID\",Valid,0,{\"SeAssignPrimaryTokenP" + "rivilege\"})\'"); temp233 = this.ILsadManagedAdapterInstance.RemoveAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), 0, new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S556\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/InvalidHandle\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidHandle, temp233, "return of RemoveAccountRights, state S556"); TestScenarioS7S579(); this.Manager.EndTest(); } #endregion #region Test Starting in S6 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S6() { this.Manager.BeginTest("TestScenarioS7S6"); this.Manager.Comment("reaching state \'S6\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S7\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S99\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp234; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp235; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp235 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp234); this.Manager.Comment("reaching state \'S147\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp234, "policyHandle of OpenPolicy, state S147"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp235, "return of OpenPolicy, state S147"); this.Manager.Comment("reaching state \'S195\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp236; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp237; this.Manager.Comment("executing step \'call CreateAccount(1,4061069327,Valid,\"SID\",out _)\'"); temp237 = this.ILsadManagedAdapterInstance.CreateAccount(1, 4061069327u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp236); this.Manager.Comment("reaching state \'S243\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp236, "accountHandle of CreateAccount, state S243"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp237, "return of CreateAccount, state S243"); this.Manager.Comment("reaching state \'S291\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp238; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp239; this.Manager.Comment("executing step \'call OpenAccount(1,True,Valid,\"SID\",out _)\'"); temp239 = this.ILsadManagedAdapterInstance.OpenAccount(1, true, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp238); this.Manager.Comment("reaching state \'S339\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp238, "accountHandle of OpenAccount, state S339"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp239, "return of OpenAccount, state S339"); this.Manager.Comment("reaching state \'S387\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp240; this.Manager.Comment("executing step \'call AddAccountRights(1,\"SID\",Valid,{\"SeAssignPrimaryTokenPrivile" + "ge\"})\'"); temp240 = this.ILsadManagedAdapterInstance.AddAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S435\'"); this.Manager.Comment("checking step \'return AddAccountRights/Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp240, "return of AddAccountRights, state S435"); this.Manager.Comment("reaching state \'S483\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp241; this.Manager.Comment("executing step \'call RemoveAccountRights(1,\"SID\",Invalid,0,{\"SeAssignPrimaryToken" + "Privilege\"})\'"); temp241 = this.ILsadManagedAdapterInstance.RemoveAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), 0, new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S531\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp241, "return of RemoveAccountRights, state S531"); TestScenarioS7S577(); this.Manager.EndTest(); } #endregion #region Test Starting in S60 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S60() { this.Manager.BeginTest("TestScenarioS7S60"); this.Manager.Comment("reaching state \'S60\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S61\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S126\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp242; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp243; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp243 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp242); this.Manager.Comment("reaching state \'S174\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp242, "policyHandle of OpenPolicy, state S174"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp243, "return of OpenPolicy, state S174"); this.Manager.Comment("reaching state \'S222\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp244; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp245; this.Manager.Comment("executing step \'call CreateAccount(1,0,Valid,\"SID\",out _)\'"); temp245 = this.ILsadManagedAdapterInstance.CreateAccount(1, 0u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp244); this.Manager.Comment("reaching state \'S270\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp244, "accountHandle of CreateAccount, state S270"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp245, "return of CreateAccount, state S270"); this.Manager.Comment("reaching state \'S318\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp246; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp247; this.Manager.Comment("executing step \'call OpenAccount(1,True,Valid,\"SID\",out _)\'"); temp247 = this.ILsadManagedAdapterInstance.OpenAccount(1, true, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp246); this.Manager.Comment("reaching state \'S366\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp246, "accountHandle of OpenAccount, state S366"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp247, "return of OpenAccount, state S366"); this.Manager.Comment("reaching state \'S414\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp248; this.Manager.Comment("executing step \'call AddAccountRights(1,\"SID\",Valid,{\"SeAssignPrimaryTokenPrivile" + "ge\"})\'"); temp248 = this.ILsadManagedAdapterInstance.AddAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S462\'"); this.Manager.Comment("checking step \'return AddAccountRights/AccessDenied\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.AccessDenied, temp248, "return of AddAccountRights, state S462"); this.Manager.Comment("reaching state \'S510\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp249; this.Manager.Comment("executing step \'call RemoveAccountRights(1,\"SID\",Valid,0,{\"SeAssignPrimaryTokenPr" + "ivilege\"})\'"); temp249 = this.ILsadManagedAdapterInstance.RemoveAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), 0, new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S557\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/AccessDenied\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.AccessDenied, temp249, "return of RemoveAccountRights, state S557"); TestScenarioS7S580(); this.Manager.EndTest(); } private void TestScenarioS7S580() { this.Manager.Comment("reaching state \'S580\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp250; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp251; this.Manager.Comment("executing step \'call Close(1,out _)\'"); temp251 = this.ILsadManagedAdapterInstance.Close(1, out temp250); this.Manager.Comment("reaching state \'S585\'"); this.Manager.Comment("checking step \'return Close/[out Null]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle.Null, temp250, "handleAfterClose of Close, state S585"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp251, "return of Close, state S585"); this.Manager.Comment("reaching state \'S590\'"); } #endregion #region Test Starting in S62 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S62() { this.Manager.BeginTest("TestScenarioS7S62"); this.Manager.Comment("reaching state \'S62\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S63\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S127\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp252; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp253; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp253 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp252); this.Manager.Comment("reaching state \'S175\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp252, "policyHandle of OpenPolicy, state S175"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp253, "return of OpenPolicy, state S175"); this.Manager.Comment("reaching state \'S223\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp254; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp255; this.Manager.Comment("executing step \'call CreateAccount(1,0,Valid,\"SID\",out _)\'"); temp255 = this.ILsadManagedAdapterInstance.CreateAccount(1, 0u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp254); this.Manager.Comment("reaching state \'S271\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp254, "accountHandle of CreateAccount, state S271"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp255, "return of CreateAccount, state S271"); this.Manager.Comment("reaching state \'S319\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp256; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp257; this.Manager.Comment("executing step \'call OpenAccount(1,False,Valid,\"SID\",out _)\'"); temp257 = this.ILsadManagedAdapterInstance.OpenAccount(1, false, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp256); this.Manager.Comment("reaching state \'S367\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:AccessDenied\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp256, "accountHandle of OpenAccount, state S367"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.AccessDenied, temp257, "return of OpenAccount, state S367"); this.Manager.Comment("reaching state \'S415\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp258; this.Manager.Comment("executing step \'call AddAccountRights(1,\"SID\",Valid,{\"invalidvalue\"})\'"); temp258 = this.ILsadManagedAdapterInstance.AddAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S463\'"); this.Manager.Comment("checking step \'return AddAccountRights/AccessDenied\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.AccessDenied, temp258, "return of AddAccountRights, state S463"); this.Manager.Comment("reaching state \'S511\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp259; this.Manager.Comment("executing step \'call RemoveAccountRights(1,\"SID\",Valid,0,{\"invalidvalue\"})\'"); temp259 = this.ILsadManagedAdapterInstance.RemoveAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), 0, new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S558\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/AccessDenied\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.AccessDenied, temp259, "return of RemoveAccountRights, state S558"); TestScenarioS7S580(); this.Manager.EndTest(); } #endregion #region Test Starting in S64 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S64() { this.Manager.BeginTest("TestScenarioS7S64"); this.Manager.Comment("reaching state \'S64\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S65\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S128\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp260; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp261; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp261 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp260); this.Manager.Comment("reaching state \'S176\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp260, "policyHandle of OpenPolicy, state S176"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp261, "return of OpenPolicy, state S176"); this.Manager.Comment("reaching state \'S224\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp262; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp263; this.Manager.Comment("executing step \'call CreateAccount(1,0,Valid,\"SID\",out _)\'"); temp263 = this.ILsadManagedAdapterInstance.CreateAccount(1, 0u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp262); this.Manager.Comment("reaching state \'S272\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp262, "accountHandle of CreateAccount, state S272"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp263, "return of CreateAccount, state S272"); this.Manager.Comment("reaching state \'S320\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp264; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp265; this.Manager.Comment("executing step \'call OpenAccount(1,False,Invalid,\"SID\",out _)\'"); temp265 = this.ILsadManagedAdapterInstance.OpenAccount(1, false, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), "SID", out temp264); this.Manager.Comment("reaching state \'S368\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp264, "accountHandle of OpenAccount, state S368"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp265, "return of OpenAccount, state S368"); this.Manager.Comment("reaching state \'S416\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp266; this.Manager.Comment("executing step \'call AddAccountRights(1,\"SID\",Invalid,{\"SeAssignPrimaryTokenPrivi" + "lege\"})\'"); temp266 = this.ILsadManagedAdapterInstance.AddAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S464\'"); this.Manager.Comment("checking step \'return AddAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp266, "return of AddAccountRights, state S464"); this.Manager.Comment("reaching state \'S512\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp267; this.Manager.Comment("executing step \'call RemoveAccountRights(1,\"SID\",Invalid,0,{\"SeAssignPrimaryToken" + "Privilege\"})\'"); temp267 = this.ILsadManagedAdapterInstance.RemoveAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), 0, new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S559\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp267, "return of RemoveAccountRights, state S559"); TestScenarioS7S580(); this.Manager.EndTest(); } #endregion #region Test Starting in S66 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S66() { this.Manager.BeginTest("TestScenarioS7S66"); this.Manager.Comment("reaching state \'S66\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S67\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S129\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp268; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp269; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp269 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp268); this.Manager.Comment("reaching state \'S177\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp268, "policyHandle of OpenPolicy, state S177"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp269, "return of OpenPolicy, state S177"); this.Manager.Comment("reaching state \'S225\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp270; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp271; this.Manager.Comment("executing step \'call CreateAccount(1,0,Valid,\"SID\",out _)\'"); temp271 = this.ILsadManagedAdapterInstance.CreateAccount(1, 0u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp270); this.Manager.Comment("reaching state \'S273\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp270, "accountHandle of CreateAccount, state S273"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp271, "return of CreateAccount, state S273"); this.Manager.Comment("reaching state \'S321\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp272; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp273; this.Manager.Comment("executing step \'call OpenAccount(11,False,Invalid,\"SID\",out _)\'"); temp273 = this.ILsadManagedAdapterInstance.OpenAccount(11, false, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), "SID", out temp272); this.Manager.Comment("reaching state \'S369\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp272, "accountHandle of OpenAccount, state S369"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp273, "return of OpenAccount, state S369"); this.Manager.Comment("reaching state \'S417\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp274; this.Manager.Comment("executing step \'call AddAccountRights(1,\"SID\",Invalid,{\"invalidvalue\"})\'"); temp274 = this.ILsadManagedAdapterInstance.AddAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S465\'"); this.Manager.Comment("checking step \'return AddAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp274, "return of AddAccountRights, state S465"); this.Manager.Comment("reaching state \'S513\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp275; this.Manager.Comment("executing step \'call RemoveAccountRights(1,\"SID\",Invalid,0,{\"invalidvalue\"})\'"); temp275 = this.ILsadManagedAdapterInstance.RemoveAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), 0, new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S560\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp275, "return of RemoveAccountRights, state S560"); TestScenarioS7S580(); this.Manager.EndTest(); } #endregion #region Test Starting in S68 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S68() { this.Manager.BeginTest("TestScenarioS7S68"); this.Manager.Comment("reaching state \'S68\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S69\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S130\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp276; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp277; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp277 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp276); this.Manager.Comment("reaching state \'S178\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp276, "policyHandle of OpenPolicy, state S178"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp277, "return of OpenPolicy, state S178"); this.Manager.Comment("reaching state \'S226\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp278; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp279; this.Manager.Comment("executing step \'call CreateAccount(1,0,Valid,\"SID\",out _)\'"); temp279 = this.ILsadManagedAdapterInstance.CreateAccount(1, 0u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp278); this.Manager.Comment("reaching state \'S274\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp278, "accountHandle of CreateAccount, state S274"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp279, "return of CreateAccount, state S274"); this.Manager.Comment("reaching state \'S322\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp280; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp281; this.Manager.Comment("executing step \'call OpenAccount(1,True,Invalid,\"SID\",out _)\'"); temp281 = this.ILsadManagedAdapterInstance.OpenAccount(1, true, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), "SID", out temp280); this.Manager.Comment("reaching state \'S370\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp280, "accountHandle of OpenAccount, state S370"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp281, "return of OpenAccount, state S370"); this.Manager.Comment("reaching state \'S418\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp282; this.Manager.Comment("executing step \'call AddAccountRights(11,\"SID\",Invalid,{\"SeAssignPrimaryTokenPriv" + "ilege\"})\'"); temp282 = this.ILsadManagedAdapterInstance.AddAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S466\'"); this.Manager.Comment("checking step \'return AddAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp282, "return of AddAccountRights, state S466"); this.Manager.Comment("reaching state \'S514\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp283; this.Manager.Comment("executing step \'call RemoveAccountRights(11,\"SID\",Invalid,0,{\"SeAssignPrimaryToke" + "nPrivilege\"})\'"); temp283 = this.ILsadManagedAdapterInstance.RemoveAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), 0, new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S561\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp283, "return of RemoveAccountRights, state S561"); TestScenarioS7S580(); this.Manager.EndTest(); } #endregion #region Test Starting in S70 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S70() { this.Manager.BeginTest("TestScenarioS7S70"); this.Manager.Comment("reaching state \'S70\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S71\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S131\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp284; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp285; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp285 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp284); this.Manager.Comment("reaching state \'S179\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp284, "policyHandle of OpenPolicy, state S179"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp285, "return of OpenPolicy, state S179"); this.Manager.Comment("reaching state \'S227\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp286; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp287; this.Manager.Comment("executing step \'call CreateAccount(1,0,Valid,\"SID\",out _)\'"); temp287 = this.ILsadManagedAdapterInstance.CreateAccount(1, 0u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp286); this.Manager.Comment("reaching state \'S275\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp286, "accountHandle of CreateAccount, state S275"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp287, "return of CreateAccount, state S275"); this.Manager.Comment("reaching state \'S323\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp288; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp289; this.Manager.Comment("executing step \'call OpenAccount(11,True,Invalid,\"SID\",out _)\'"); temp289 = this.ILsadManagedAdapterInstance.OpenAccount(11, true, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), "SID", out temp288); this.Manager.Comment("reaching state \'S371\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp288, "accountHandle of OpenAccount, state S371"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp289, "return of OpenAccount, state S371"); this.Manager.Comment("reaching state \'S419\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp290; this.Manager.Comment("executing step \'call AddAccountRights(11,\"SID\",Invalid,{\"invalidvalue\"})\'"); temp290 = this.ILsadManagedAdapterInstance.AddAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S467\'"); this.Manager.Comment("checking step \'return AddAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp290, "return of AddAccountRights, state S467"); this.Manager.Comment("reaching state \'S515\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp291; this.Manager.Comment("executing step \'call RemoveAccountRights(11,\"SID\",Invalid,0,{\"invalidvalue\"})\'"); temp291 = this.ILsadManagedAdapterInstance.RemoveAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), 0, new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S562\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp291, "return of RemoveAccountRights, state S562"); TestScenarioS7S580(); this.Manager.EndTest(); } #endregion #region Test Starting in S72 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S72() { this.Manager.BeginTest("TestScenarioS7S72"); this.Manager.Comment("reaching state \'S72\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S73\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S132\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp292; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp293; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp293 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp292); this.Manager.Comment("reaching state \'S180\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp292, "policyHandle of OpenPolicy, state S180"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp293, "return of OpenPolicy, state S180"); this.Manager.Comment("reaching state \'S228\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp294; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp295; this.Manager.Comment("executing step \'call CreateAccount(1,0,Valid,\"SID\",out _)\'"); temp295 = this.ILsadManagedAdapterInstance.CreateAccount(1, 0u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp294); this.Manager.Comment("reaching state \'S276\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp294, "accountHandle of CreateAccount, state S276"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp295, "return of CreateAccount, state S276"); this.Manager.Comment("reaching state \'S324\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp296; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp297; this.Manager.Comment("executing step \'call OpenAccount(11,False,Valid,\"SID\",out _)\'"); temp297 = this.ILsadManagedAdapterInstance.OpenAccount(11, false, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp296); this.Manager.Comment("reaching state \'S372\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:InvalidHandle\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp296, "accountHandle of OpenAccount, state S372"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidHandle, temp297, "return of OpenAccount, state S372"); this.Manager.Comment("reaching state \'S420\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp298; this.Manager.Comment("executing step \'call AddAccountRights(11,\"SID\",Valid,{\"SeAssignPrimaryTokenPrivil" + "ege\"})\'"); temp298 = this.ILsadManagedAdapterInstance.AddAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S468\'"); this.Manager.Comment("checking step \'return AddAccountRights/InvalidHandle\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidHandle, temp298, "return of AddAccountRights, state S468"); this.Manager.Comment("reaching state \'S516\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp299; this.Manager.Comment("executing step \'call RemoveAccountRights(11,\"SID\",Valid,0,{\"SeAssignPrimaryTokenP" + "rivilege\"})\'"); temp299 = this.ILsadManagedAdapterInstance.RemoveAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), 0, new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S563\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/InvalidHandle\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidHandle, temp299, "return of RemoveAccountRights, state S563"); TestScenarioS7S580(); this.Manager.EndTest(); } #endregion #region Test Starting in S74 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S74() { this.Manager.BeginTest("TestScenarioS7S74"); this.Manager.Comment("reaching state \'S74\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S75\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S133\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp300; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp301; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp301 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp300); this.Manager.Comment("reaching state \'S181\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp300, "policyHandle of OpenPolicy, state S181"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp301, "return of OpenPolicy, state S181"); this.Manager.Comment("reaching state \'S229\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp302; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp303; this.Manager.Comment("executing step \'call CreateAccount(1,0,Invalid,\"SID\",out _)\'"); temp303 = this.ILsadManagedAdapterInstance.CreateAccount(1, 0u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), "SID", out temp302); this.Manager.Comment("reaching state \'S277\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Invalid]:InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp302, "accountHandle of CreateAccount, state S277"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp303, "return of CreateAccount, state S277"); this.Manager.Comment("reaching state \'S325\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp304; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp305; this.Manager.Comment("executing step \'call OpenAccount(1,False,Valid,\"SID\",out _)\'"); temp305 = this.ILsadManagedAdapterInstance.OpenAccount(1, false, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp304); this.Manager.Comment("reaching state \'S373\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:AccessDenied\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp304, "accountHandle of OpenAccount, state S373"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.AccessDenied, temp305, "return of OpenAccount, state S373"); this.Manager.Comment("reaching state \'S421\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp306; this.Manager.Comment("executing step \'call AddAccountRights(1,\"SID\",Invalid,{\"SeAssignPrimaryTokenPrivi" + "lege\"})\'"); temp306 = this.ILsadManagedAdapterInstance.AddAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S469\'"); this.Manager.Comment("checking step \'return AddAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp306, "return of AddAccountRights, state S469"); this.Manager.Comment("reaching state \'S517\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp307; this.Manager.Comment("executing step \'call RemoveAccountRights(1,\"SID\",Invalid,0,{\"SeAssignPrimaryToken" + "Privilege\"})\'"); temp307 = this.ILsadManagedAdapterInstance.RemoveAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), 0, new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S564\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp307, "return of RemoveAccountRights, state S564"); TestScenarioS7S575(); this.Manager.EndTest(); } #endregion #region Test Starting in S76 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S76() { this.Manager.BeginTest("TestScenarioS7S76"); this.Manager.Comment("reaching state \'S76\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S77\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S134\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp308; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp309; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp309 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp308); this.Manager.Comment("reaching state \'S182\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp308, "policyHandle of OpenPolicy, state S182"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp309, "return of OpenPolicy, state S182"); this.Manager.Comment("reaching state \'S230\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp310; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp311; this.Manager.Comment("executing step \'call CreateAccount(1,0,Invalid,\"SID\",out _)\'"); temp311 = this.ILsadManagedAdapterInstance.CreateAccount(1, 0u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), "SID", out temp310); this.Manager.Comment("reaching state \'S278\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Invalid]:InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp310, "accountHandle of CreateAccount, state S278"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp311, "return of CreateAccount, state S278"); this.Manager.Comment("reaching state \'S326\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp312; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp313; this.Manager.Comment("executing step \'call OpenAccount(1,False,Invalid,\"SID\",out _)\'"); temp313 = this.ILsadManagedAdapterInstance.OpenAccount(1, false, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), "SID", out temp312); this.Manager.Comment("reaching state \'S374\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp312, "accountHandle of OpenAccount, state S374"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp313, "return of OpenAccount, state S374"); this.Manager.Comment("reaching state \'S422\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp314; this.Manager.Comment("executing step \'call AddAccountRights(1,\"SID\",Invalid,{\"SeAssignPrimaryTokenPrivi" + "lege\"})\'"); temp314 = this.ILsadManagedAdapterInstance.AddAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S470\'"); this.Manager.Comment("checking step \'return AddAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp314, "return of AddAccountRights, state S470"); this.Manager.Comment("reaching state \'S518\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp315; this.Manager.Comment("executing step \'call RemoveAccountRights(1,\"SID\",Invalid,0,{\"invalidvalue\"})\'"); temp315 = this.ILsadManagedAdapterInstance.RemoveAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), 0, new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S565\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp315, "return of RemoveAccountRights, state S565"); TestScenarioS7S575(); this.Manager.EndTest(); } #endregion #region Test Starting in S78 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S78() { this.Manager.BeginTest("TestScenarioS7S78"); this.Manager.Comment("reaching state \'S78\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S79\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S135\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp316; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp317; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp317 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp316); this.Manager.Comment("reaching state \'S183\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp316, "policyHandle of OpenPolicy, state S183"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp317, "return of OpenPolicy, state S183"); this.Manager.Comment("reaching state \'S231\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp318; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp319; this.Manager.Comment("executing step \'call CreateAccount(1,0,Invalid,\"SID\",out _)\'"); temp319 = this.ILsadManagedAdapterInstance.CreateAccount(1, 0u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), "SID", out temp318); this.Manager.Comment("reaching state \'S279\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Invalid]:InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp318, "accountHandle of CreateAccount, state S279"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp319, "return of CreateAccount, state S279"); this.Manager.Comment("reaching state \'S327\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp320; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp321; this.Manager.Comment("executing step \'call OpenAccount(1,False,Valid,\"SID\",out _)\'"); temp321 = this.ILsadManagedAdapterInstance.OpenAccount(1, false, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp320); this.Manager.Comment("reaching state \'S375\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:AccessDenied\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp320, "accountHandle of OpenAccount, state S375"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.AccessDenied, temp321, "return of OpenAccount, state S375"); this.Manager.Comment("reaching state \'S423\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp322; this.Manager.Comment("executing step \'call AddAccountRights(1,\"SID\",Valid,{\"SeAssignPrimaryTokenPrivile" + "ge\"})\'"); temp322 = this.ILsadManagedAdapterInstance.AddAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S471\'"); this.Manager.Comment("checking step \'return AddAccountRights/Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp322, "return of AddAccountRights, state S471"); this.Manager.Comment("reaching state \'S519\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp323; this.Manager.Comment("executing step \'call RemoveAccountRights(11,\"SID\",Valid,0,{\"invalidvalue\"})\'"); temp323 = this.ILsadManagedAdapterInstance.RemoveAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), 0, new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S566\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/InvalidHandle\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidHandle, temp323, "return of RemoveAccountRights, state S566"); TestScenarioS7S578(); this.Manager.EndTest(); } #endregion #region Test Starting in S8 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S8() { this.Manager.BeginTest("TestScenarioS7S8"); this.Manager.Comment("reaching state \'S8\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S9\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S100\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp324; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp325; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp325 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp324); this.Manager.Comment("reaching state \'S148\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp324, "policyHandle of OpenPolicy, state S148"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp325, "return of OpenPolicy, state S148"); this.Manager.Comment("reaching state \'S196\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp326; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp327; this.Manager.Comment("executing step \'call CreateAccount(1,4061069327,Valid,\"SID\",out _)\'"); temp327 = this.ILsadManagedAdapterInstance.CreateAccount(1, 4061069327u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp326); this.Manager.Comment("reaching state \'S244\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp326, "accountHandle of CreateAccount, state S244"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp327, "return of CreateAccount, state S244"); this.Manager.Comment("reaching state \'S292\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp328; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp329; this.Manager.Comment("executing step \'call OpenAccount(1,True,Valid,\"SID\",out _)\'"); temp329 = this.ILsadManagedAdapterInstance.OpenAccount(1, true, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp328); this.Manager.Comment("reaching state \'S340\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp328, "accountHandle of OpenAccount, state S340"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp329, "return of OpenAccount, state S340"); this.Manager.Comment("reaching state \'S388\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp330; this.Manager.Comment("executing step \'call AddAccountRights(1,\"SID\",Valid,{\"SeAssignPrimaryTokenPrivile" + "ge\"})\'"); temp330 = this.ILsadManagedAdapterInstance.AddAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S436\'"); this.Manager.Comment("checking step \'return AddAccountRights/Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp330, "return of AddAccountRights, state S436"); this.Manager.Comment("reaching state \'S484\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp331; this.Manager.Comment("executing step \'call RemoveAccountRights(1,\"SID\",Invalid,0,{\"invalidvalue\"})\'"); temp331 = this.ILsadManagedAdapterInstance.RemoveAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), 0, new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S532\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp331, "return of RemoveAccountRights, state S532"); TestScenarioS7S577(); this.Manager.EndTest(); } #endregion #region Test Starting in S80 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S80() { this.Manager.BeginTest("TestScenarioS7S80"); this.Manager.Comment("reaching state \'S80\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S81\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S136\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp332; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp333; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp333 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp332); this.Manager.Comment("reaching state \'S184\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp332, "policyHandle of OpenPolicy, state S184"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp333, "return of OpenPolicy, state S184"); this.Manager.Comment("reaching state \'S232\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp334; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp335; this.Manager.Comment("executing step \'call CreateAccount(1,4061069327,Valid,\"SID\",out _)\'"); temp335 = this.ILsadManagedAdapterInstance.CreateAccount(1, 4061069327u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp334); this.Manager.Comment("reaching state \'S280\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp334, "accountHandle of CreateAccount, state S280"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp335, "return of CreateAccount, state S280"); this.Manager.Comment("reaching state \'S328\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp336; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp337; this.Manager.Comment("executing step \'call OpenAccount(1,True,Valid,\"SID\",out _)\'"); temp337 = this.ILsadManagedAdapterInstance.OpenAccount(1, true, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp336); this.Manager.Comment("reaching state \'S376\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp336, "accountHandle of OpenAccount, state S376"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp337, "return of OpenAccount, state S376"); this.Manager.Comment("reaching state \'S424\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp338; this.Manager.Comment("executing step \'call AddAccountRights(1,\"SID\",Valid,{\"SeAssignPrimaryTokenPrivile" + "ge\"})\'"); temp338 = this.ILsadManagedAdapterInstance.AddAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S472\'"); this.Manager.Comment("checking step \'return AddAccountRights/Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp338, "return of AddAccountRights, state S472"); this.Manager.Comment("reaching state \'S520\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp339; this.Manager.Comment("executing step \'call RemoveAccountRights(11,\"SID\",Valid,0,{\"invalidvalue\"})\'"); temp339 = this.ILsadManagedAdapterInstance.RemoveAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), 0, new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S567\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/InvalidHandle\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidHandle, temp339, "return of RemoveAccountRights, state S567"); TestScenarioS7S577(); this.Manager.EndTest(); } #endregion #region Test Starting in S82 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S82() { this.Manager.BeginTest("TestScenarioS7S82"); this.Manager.Comment("reaching state \'S82\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S83\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S137\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp340; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp341; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp341 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp340); this.Manager.Comment("reaching state \'S185\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp340, "policyHandle of OpenPolicy, state S185"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp341, "return of OpenPolicy, state S185"); this.Manager.Comment("reaching state \'S233\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp342; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp343; this.Manager.Comment("executing step \'call CreateAccount(1,0,Invalid,\"SID\",out _)\'"); temp343 = this.ILsadManagedAdapterInstance.CreateAccount(1, 0u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), "SID", out temp342); this.Manager.Comment("reaching state \'S281\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Invalid]:InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp342, "accountHandle of CreateAccount, state S281"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp343, "return of CreateAccount, state S281"); this.Manager.Comment("reaching state \'S329\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp344; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp345; this.Manager.Comment("executing step \'call OpenAccount(11,False,Invalid,\"SID\",out _)\'"); temp345 = this.ILsadManagedAdapterInstance.OpenAccount(11, false, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), "SID", out temp344); this.Manager.Comment("reaching state \'S377\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp344, "accountHandle of OpenAccount, state S377"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp345, "return of OpenAccount, state S377"); this.Manager.Comment("reaching state \'S425\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp346; this.Manager.Comment("executing step \'call AddAccountRights(1,\"SID\",Invalid,{\"invalidvalue\"})\'"); temp346 = this.ILsadManagedAdapterInstance.AddAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S473\'"); this.Manager.Comment("checking step \'return AddAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp346, "return of AddAccountRights, state S473"); this.Manager.Comment("reaching state \'S521\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp347; this.Manager.Comment("executing step \'call RemoveAccountRights(11,\"SID\",Invalid,0,{\"invalidvalue\"})\'"); temp347 = this.ILsadManagedAdapterInstance.RemoveAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), 0, new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S568\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp347, "return of RemoveAccountRights, state S568"); TestScenarioS7S575(); this.Manager.EndTest(); } #endregion #region Test Starting in S84 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S84() { this.Manager.BeginTest("TestScenarioS7S84"); this.Manager.Comment("reaching state \'S84\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S85\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S138\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp348; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp349; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp349 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp348); this.Manager.Comment("reaching state \'S186\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp348, "policyHandle of OpenPolicy, state S186"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp349, "return of OpenPolicy, state S186"); this.Manager.Comment("reaching state \'S234\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp350; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp351; this.Manager.Comment("executing step \'call CreateAccount(11,0,Invalid,\"SID\",out _)\'"); temp351 = this.ILsadManagedAdapterInstance.CreateAccount(11, 0u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), "SID", out temp350); this.Manager.Comment("reaching state \'S282\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Invalid]:InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp350, "accountHandle of CreateAccount, state S282"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp351, "return of CreateAccount, state S282"); this.Manager.Comment("reaching state \'S330\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp352; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp353; this.Manager.Comment("executing step \'call OpenAccount(1,True,Invalid,\"SID\",out _)\'"); temp353 = this.ILsadManagedAdapterInstance.OpenAccount(1, true, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), "SID", out temp352); this.Manager.Comment("reaching state \'S378\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp352, "accountHandle of OpenAccount, state S378"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp353, "return of OpenAccount, state S378"); this.Manager.Comment("reaching state \'S426\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp354; this.Manager.Comment("executing step \'call AddAccountRights(11,\"SID\",Invalid,{\"SeAssignPrimaryTokenPriv" + "ilege\"})\'"); temp354 = this.ILsadManagedAdapterInstance.AddAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S474\'"); this.Manager.Comment("checking step \'return AddAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp354, "return of AddAccountRights, state S474"); this.Manager.Comment("reaching state \'S522\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp355; this.Manager.Comment("executing step \'call RemoveAccountRights(11,\"SID\",Invalid,0,{\"SeAssignPrimaryToke" + "nPrivilege\"})\'"); temp355 = this.ILsadManagedAdapterInstance.RemoveAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), 0, new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S569\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp355, "return of RemoveAccountRights, state S569"); TestScenarioS7S575(); this.Manager.EndTest(); } #endregion #region Test Starting in S86 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S86() { this.Manager.BeginTest("TestScenarioS7S86"); this.Manager.Comment("reaching state \'S86\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S87\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S139\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp356; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp357; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp357 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp356); this.Manager.Comment("reaching state \'S187\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp356, "policyHandle of OpenPolicy, state S187"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp357, "return of OpenPolicy, state S187"); this.Manager.Comment("reaching state \'S235\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp358; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp359; this.Manager.Comment("executing step \'call CreateAccount(1,4061069327,Invalid,\"SID\",out _)\'"); temp359 = this.ILsadManagedAdapterInstance.CreateAccount(1, 4061069327u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), "SID", out temp358); this.Manager.Comment("reaching state \'S283\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Invalid]:InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp358, "accountHandle of CreateAccount, state S283"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp359, "return of CreateAccount, state S283"); this.Manager.Comment("reaching state \'S331\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp360; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp361; this.Manager.Comment("executing step \'call OpenAccount(11,True,Invalid,\"SID\",out _)\'"); temp361 = this.ILsadManagedAdapterInstance.OpenAccount(11, true, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), "SID", out temp360); this.Manager.Comment("reaching state \'S379\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp360, "accountHandle of OpenAccount, state S379"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp361, "return of OpenAccount, state S379"); this.Manager.Comment("reaching state \'S427\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp362; this.Manager.Comment("executing step \'call AddAccountRights(11,\"SID\",Invalid,{\"invalidvalue\"})\'"); temp362 = this.ILsadManagedAdapterInstance.AddAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S475\'"); this.Manager.Comment("checking step \'return AddAccountRights/InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp362, "return of AddAccountRights, state S475"); this.Manager.Comment("reaching state \'S523\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp363; this.Manager.Comment("executing step \'call RemoveAccountRights(1,\"SID\",Valid,0,{\"SeAssignPrimaryTokenPr" + "ivilege\"})\'"); temp363 = this.ILsadManagedAdapterInstance.RemoveAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), 0, new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S570\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/ObjectNameNotFound\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.ObjectNameNotFound, temp363, "return of RemoveAccountRights, state S570"); TestScenarioS7S575(); this.Manager.EndTest(); } #endregion #region Test Starting in S88 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S88() { this.Manager.BeginTest("TestScenarioS7S88"); this.Manager.Comment("reaching state \'S88\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S89\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S140\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp364; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp365; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp365 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp364); this.Manager.Comment("reaching state \'S188\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp364, "policyHandle of OpenPolicy, state S188"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp365, "return of OpenPolicy, state S188"); this.Manager.Comment("reaching state \'S236\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp366; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp367; this.Manager.Comment("executing step \'call CreateAccount(11,4061069327,Invalid,\"SID\",out _)\'"); temp367 = this.ILsadManagedAdapterInstance.CreateAccount(11, 4061069327u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(1)), "SID", out temp366); this.Manager.Comment("reaching state \'S284\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Invalid]:InvalidParameter\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp366, "accountHandle of CreateAccount, state S284"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidParameter, temp367, "return of CreateAccount, state S284"); this.Manager.Comment("reaching state \'S332\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp368; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp369; this.Manager.Comment("executing step \'call OpenAccount(1,True,Valid,\"SID\",out _)\'"); temp369 = this.ILsadManagedAdapterInstance.OpenAccount(1, true, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp368); this.Manager.Comment("reaching state \'S380\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:ObjectNameNotFound\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp368, "accountHandle of OpenAccount, state S380"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.ObjectNameNotFound, temp369, "return of OpenAccount, state S380"); this.Manager.Comment("reaching state \'S428\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp370; this.Manager.Comment("executing step \'call AddAccountRights(1,\"SID\",Valid,{\"invalidvalue\"})\'"); temp370 = this.ILsadManagedAdapterInstance.AddAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S476\'"); this.Manager.Comment("checking step \'return AddAccountRights/NoSuchPrivilege\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.NoSuchPrivilege, temp370, "return of AddAccountRights, state S476"); this.Manager.Comment("reaching state \'S524\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp371; this.Manager.Comment("executing step \'call RemoveAccountRights(1,\"SID\",Valid,0,{\"invalidvalue\"})\'"); temp371 = this.ILsadManagedAdapterInstance.RemoveAccountRights(1, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), 0, new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S571\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/ObjectNameNotFound\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.ObjectNameNotFound, temp371, "return of RemoveAccountRights, state S571"); TestScenarioS7S575(); this.Manager.EndTest(); } #endregion #region Test Starting in S90 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S90() { this.Manager.BeginTest("TestScenarioS7S90"); this.Manager.Comment("reaching state \'S90\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S91\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S141\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp372; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp373; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp373 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp372); this.Manager.Comment("reaching state \'S189\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp372, "policyHandle of OpenPolicy, state S189"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp373, "return of OpenPolicy, state S189"); this.Manager.Comment("reaching state \'S237\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp374; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp375; this.Manager.Comment("executing step \'call CreateAccount(11,0,Valid,\"SID\",out _)\'"); temp375 = this.ILsadManagedAdapterInstance.CreateAccount(11, 0u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp374); this.Manager.Comment("reaching state \'S285\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Invalid]:InvalidHandle\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp374, "accountHandle of CreateAccount, state S285"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidHandle, temp375, "return of CreateAccount, state S285"); this.Manager.Comment("reaching state \'S333\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp376; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp377; this.Manager.Comment("executing step \'call OpenAccount(11,False,Valid,\"SID\",out _)\'"); temp377 = this.ILsadManagedAdapterInstance.OpenAccount(11, false, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp376); this.Manager.Comment("reaching state \'S381\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:InvalidHandle\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp376, "accountHandle of OpenAccount, state S381"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidHandle, temp377, "return of OpenAccount, state S381"); this.Manager.Comment("reaching state \'S429\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp378; this.Manager.Comment("executing step \'call AddAccountRights(11,\"SID\",Valid,{\"SeAssignPrimaryTokenPrivil" + "ege\"})\'"); temp378 = this.ILsadManagedAdapterInstance.AddAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S477\'"); this.Manager.Comment("checking step \'return AddAccountRights/InvalidHandle\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidHandle, temp378, "return of AddAccountRights, state S477"); this.Manager.Comment("reaching state \'S525\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp379; this.Manager.Comment("executing step \'call RemoveAccountRights(11,\"SID\",Valid,0,{\"SeAssignPrimaryTokenP" + "rivilege\"})\'"); temp379 = this.ILsadManagedAdapterInstance.RemoveAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), 0, new List<string> { "SeAssignPrimaryTokenPrivilege" }); this.Manager.Comment("reaching state \'S572\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/InvalidHandle\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidHandle, temp379, "return of RemoveAccountRights, state S572"); TestScenarioS7S575(); this.Manager.EndTest(); } #endregion #region Test Starting in S92 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S92() { this.Manager.BeginTest("TestScenarioS7S92"); this.Manager.Comment("reaching state \'S92\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S93\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S142\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp380; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp381; this.Manager.Comment("executing step \'call OpenPolicy(Null,16,out _)\'"); temp381 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 16u, out temp380); this.Manager.Comment("reaching state \'S190\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp380, "policyHandle of OpenPolicy, state S190"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp381, "return of OpenPolicy, state S190"); this.Manager.Comment("reaching state \'S238\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp382; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp383; this.Manager.Comment("executing step \'call CreateAccount(1,0,Valid,\"SID\",out _)\'"); temp383 = this.ILsadManagedAdapterInstance.CreateAccount(1, 0u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp382); this.Manager.Comment("reaching state \'S286\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp382, "accountHandle of CreateAccount, state S286"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp383, "return of CreateAccount, state S286"); this.Manager.Comment("reaching state \'S334\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp384; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp385; this.Manager.Comment("executing step \'call OpenAccount(11,True,Valid,\"SID\",out _)\'"); temp385 = this.ILsadManagedAdapterInstance.OpenAccount(11, true, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp384); this.Manager.Comment("reaching state \'S382\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:InvalidHandle\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp384, "accountHandle of OpenAccount, state S382"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidHandle, temp385, "return of OpenAccount, state S382"); this.Manager.Comment("reaching state \'S430\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp386; this.Manager.Comment("executing step \'call AddAccountRights(11,\"SID\",Valid,{\"invalidvalue\"})\'"); temp386 = this.ILsadManagedAdapterInstance.AddAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S478\'"); this.Manager.Comment("checking step \'return AddAccountRights/InvalidHandle\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidHandle, temp386, "return of AddAccountRights, state S478"); this.Manager.Comment("reaching state \'S526\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp387; this.Manager.Comment("executing step \'call RemoveAccountRights(11,\"SID\",Valid,0,{\"invalidvalue\"})\'"); temp387 = this.ILsadManagedAdapterInstance.RemoveAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), 0, new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S573\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/InvalidHandle\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidHandle, temp387, "return of RemoveAccountRights, state S573"); TestScenarioS7S580(); this.Manager.EndTest(); } #endregion #region Test Starting in S94 [TestCategory("PDC")] [TestCategory("DomainWin2008R2")] [TestCategory("ForestWin2008R2")] [TestCategory("MS-LSAD")] [Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute()] public void LSAD_TestScenarioS7S94() { this.Manager.BeginTest("TestScenarioS7S94"); this.Manager.Comment("reaching state \'S94\'"); this.Manager.Comment("executing step \'call Initialize(DomainController,Disable,Windows2k8,2,True)\'"); this.ILsadManagedAdapterInstance.Initialize(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ProtocolServerConfig)(0)), ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AnonymousAccess)(0)), Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Server.Windows2k8, 2, true); this.Manager.Comment("reaching state \'S95\'"); this.Manager.Comment("checking step \'return Initialize\'"); this.Manager.Comment("reaching state \'S143\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp388; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp389; this.Manager.Comment("executing step \'call OpenPolicy(Null,1,out _)\'"); temp389 = this.ILsadManagedAdapterInstance.OpenPolicy(((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.RootDirectory)(0)), 1u, out temp388); this.Manager.Comment("reaching state \'S191\'"); this.Manager.Comment("checking step \'return OpenPolicy/[out Valid]:Success\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(0)), temp388, "policyHandle of OpenPolicy, state S191"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus)(0)), temp389, "return of OpenPolicy, state S191"); this.Manager.Comment("reaching state \'S239\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp390; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp391; this.Manager.Comment("executing step \'call CreateAccount(11,4061069327,Valid,\"SID\",out _)\'"); temp391 = this.ILsadManagedAdapterInstance.CreateAccount(11, 4061069327u, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp390); this.Manager.Comment("reaching state \'S287\'"); this.Manager.Comment("checking step \'return CreateAccount/[out Invalid]:InvalidHandle\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp390, "accountHandle of CreateAccount, state S287"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidHandle, temp391, "return of CreateAccount, state S287"); this.Manager.Comment("reaching state \'S335\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle temp392; Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp393; this.Manager.Comment("executing step \'call OpenAccount(11,True,Valid,\"SID\",out _)\'"); temp393 = this.ILsadManagedAdapterInstance.OpenAccount(11, true, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), "SID", out temp392); this.Manager.Comment("reaching state \'S383\'"); this.Manager.Comment("checking step \'return OpenAccount/[out Invalid]:InvalidHandle\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle>(this.Manager, ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.Handle)(1)), temp392, "accountHandle of OpenAccount, state S383"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidHandle, temp393, "return of OpenAccount, state S383"); this.Manager.Comment("reaching state \'S431\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp394; this.Manager.Comment("executing step \'call AddAccountRights(11,\"SID\",Valid,{\"invalidvalue\"})\'"); temp394 = this.ILsadManagedAdapterInstance.AddAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S479\'"); this.Manager.Comment("checking step \'return AddAccountRights/InvalidHandle\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidHandle, temp394, "return of AddAccountRights, state S479"); this.Manager.Comment("reaching state \'S527\'"); Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus temp395; this.Manager.Comment("executing step \'call RemoveAccountRights(11,\"SID\",Valid,0,{\"invalidvalue\"})\'"); temp395 = this.ILsadManagedAdapterInstance.RemoveAccountRights(11, "SID", ((Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.AccountSid)(0)), 0, new List<string> { "invalidvalue" }); this.Manager.Comment("reaching state \'S574\'"); this.Manager.Comment("checking step \'return RemoveAccountRights/InvalidHandle\'"); TestManagerHelpers.AssertAreEqual<Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus>(this.Manager, Microsoft.Protocols.TestSuites.ActiveDirectory.Lsad.ErrorStatus.InvalidHandle, temp395, "return of RemoveAccountRights, state S574"); TestScenarioS7S579(); this.Manager.EndTest(); } #endregion } }
102.75929
343
0.721397
[ "MIT" ]
G-arj/WindowsProtocolTestSuites
TestSuites/ADFamily/src/TestSuite/MS-LSAD/TestScenarioS7.cs
312,491
C#
using System.Collections.Generic; using System.Threading.Tasks; using SharedLib; namespace SteamLib.Models { public interface ISteamReportManager { /// <summary> /// Gets a report /// </summary> /// <param name="id"></param> /// <returns></returns> Task<ISteamReport> GetReport(long id); /// <summary> /// Creates or updates a report /// </summary> /// <param name="request"></param> /// <returns></returns> Task<ISteamReport> GenerateReport(ISteamReportGenerationRequest request); /// <summary> /// Gets existing reports /// </summary> /// <param name="timeRange"></param> /// <returns></returns> Task<IEnumerable<ISteamReport>> GetReports(TimeRange timeRange); /// <summary> /// Gets existing reports /// </summary> /// <param name="timeRange"></param> /// <param name="userID"></param> /// <returns></returns> Task<IEnumerable<ISteamReport>> GetReports(TimeRange timeRange, long userID); /// <summary> /// Re-generates the report /// </summary> /// <param name="id"></param> /// <returns></returns> Task RefreshReport(long id); /// <summary> /// Re-generates the report /// </summary> /// <param name="report"></param> /// <returns></returns> Task RefreshReport(ISteamReport report); /// <summary> /// Gets report tempalate /// </summary> /// <param name="id"></param> /// <returns></returns> Task<ISteamReportTemplate> GetReportTemplate(long id); /// <summary> /// Gets report subscriptions /// </summary> /// <returns></returns> Task<IEnumerable<ISteamReportSubscription>> GetReportSubscriptions(); /// <summary> /// Gets report subscriptions for user /// </summary> /// <param name="userID"></param> /// <returns></returns> Task<IEnumerable<ISteamReportSubscription>> GetReportSubscriptions(long userID); } }
26.975309
88
0.544622
[ "MIT" ]
LazyTarget/MyLife
Libraries/Steam/SteamLib.Models/Interfaces/ISteamReportManager.cs
2,187
C#
using System; namespace LeBoyLib { /// <summary> /// Emulates a Z80 Gameboy CPU, more specifically a Sharp LR35902 which is a Z80 minus a few instructions, with more logical operations and a sound generator. /// </summary> public partial class GBZ80 { /// <summary> /// Get the full 256x256 background map /// </summary> /// <param name="MapSelect">Map address select (true = starts @9C00h, false @9800h)</param> /// <param name="AddrSelect">Tiles address select (true = unsigned 8000-8FFF, false = signed 8800-97FF)</param> /// <returns>A 256x256x4 byte array with RGBA color coded on four bytes</returns> public byte[] GetBackground(bool MapSelect, bool AddrSelect) { byte[] buffer = new byte[256 * 256 * 4]; byte[] BgPalette = new byte[4]; byte rawPalette = Memory[0xFF47]; BgPalette[0] = (byte)(rawPalette & 0x03); BgPalette[1] = (byte)((rawPalette & 0x0C) >> 2); BgPalette[2] = (byte)((rawPalette & 0x30) >> 4); BgPalette[3] = (byte)((rawPalette & 0xC0) >> 6); for (int y = 0; y < 256; y++) { for (int x = 0; x < 256; x++) { // bg0 int xTile = x / 8; int yTile = y / 8; int xInTile = x % 8; int yInTile = y % 8; int tileId = xTile + yTile * 32; int TileMapAddr; if (MapSelect == true) { TileMapAddr = 0x9C00; } else TileMapAddr = 0x9800; byte tileNb = Memory[TileMapAddr + tileId]; int tileDataStartAddr; if (AddrSelect == true) // unsigned $8000-8FFF tileDataStartAddr = 0x8000 + tileNb * 16; else // signed $8800-97FF (9000 = 0) { sbyte id = (sbyte)tileNb; if (id >= 0) tileDataStartAddr = 0x9000 + id * 16; else tileDataStartAddr = 0x8800 + (id + 128) * 16; } byte tileData0 = Memory[tileDataStartAddr + yInTile * 2]; byte tileData1 = Memory[tileDataStartAddr + yInTile * 2 + 1]; tileData0 = (byte)((byte)(tileData0 << xInTile) >> 7); tileData1 = (byte)((byte)(tileData1 << xInTile) >> 7); int colorId = (tileData1 << 1) + tileData0; byte color = (byte)((3 - BgPalette[colorId]) * 85); byte[] ColorData = { color, color, color, 255 }; // B G R buffer[(x + y * 256) * 4] = ColorData[0]; buffer[(x + y * 256) * 4 + 1] = ColorData[1]; buffer[(x + y * 256) * 4 + 2] = ColorData[2]; buffer[(x + y * 256) * 4 + 3] = ColorData[3]; } } return buffer; } /// <summary> /// Get tile bank 0 /// </summary> /// <returns>A 128x192x4 byte array with RGBA color coded on four bytes</returns> public byte[] GetTiles() { byte[] buffer = new byte[128 * 192 * 4]; byte[] BgPalette = new byte[4]; byte rawPalette = Memory[0xFF47]; BgPalette[0] = (byte)(rawPalette & 0x03); BgPalette[1] = (byte)((rawPalette & 0x0C) >> 2); BgPalette[2] = (byte)((rawPalette & 0x30) >> 4); BgPalette[3] = (byte)((rawPalette & 0xC0) >> 6); for (int y = 0; y < 192; y++) { for (int x = 0; x < 128; x++) { // bg0 int xTile = x / 8; int yTile = y / 8; int xInTile = x % 8; int yInTile = y % 8; int tileId = xTile + yTile * 16; int tileDataStartAddr = 0x8000 + tileId * 16; byte tileData0 = Memory[tileDataStartAddr + yInTile * 2]; byte tileData1 = Memory[tileDataStartAddr + yInTile * 2 + 1]; tileData0 = (byte)((byte)(tileData0 << xInTile) >> 7); tileData1 = (byte)((byte)(tileData1 << xInTile) >> 7); int colorId = (tileData1 << 1) + tileData0; byte color = (byte)((3 - BgPalette[colorId]) * 85); byte[] ColorData = { color, color, color, 255 }; // B G R buffer[(x + y * 128) * 4] = ColorData[0]; buffer[(x + y * 128) * 4 + 1] = ColorData[1]; buffer[(x + y * 128) * 4 + 2] = ColorData[2]; buffer[(x + y * 128) * 4 + 3] = ColorData[3]; } } return buffer; } } }
38.5
162
0.431326
[ "MIT" ]
Memorix101/LeBoy
LeBoyLib/CPU/GBZ80.Debug.cs
5,084
C#
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace EvoANTCore { public interface IWorldObject { int PositionX { get; } int PositionY { get; } void Update(); } }
14.588235
33
0.729839
[ "MIT" ]
Celarix/Misc
EvoANTCore/IWorldObject.cs
250
C#
using Xamarin.Forms; using Xamarin.Forms.Xaml; [assembly: XamlCompilation(XamlCompilationOptions.Compile)] namespace XamarinNDKSample { public partial class App : Application { public App() { InitializeComponent(); //int res = XamCppLibCS.Add(3, 5); MainPage = new MainPage(); } protected override void OnStart() { // Handle when your app starts } protected override void OnSleep() { // Handle when your app sleeps } protected override void OnResume() { // Handle when your app resumes } } }
19.970588
59
0.546392
[ "Apache-2.0" ]
Rytisgit/Xamarin
XamarinNDKSample/XamarinNDKSample/XamarinNDKSample/App.xaml.cs
681
C#
// This file is auto-generated, don't edit it. Thanks. using System; using System.Collections.Generic; using System.IO; using Tea; namespace AntChain.SDK.DEMO.Models { public class StatusDemoGatewayCheckRequest : TeaModel { [NameInMap("auth_token")] [Validation(Required=false)] public string AuthToken { get; set; } [NameInMap("product_instance_id")] [Validation(Required=false)] public string ProductInstanceId { get; set; } [NameInMap("region_name")] [Validation(Required=false)] public string RegionName { get; set; } // ffff [NameInMap("aaaa")] [Validation(Required=false)] public long? Aaaa { get; set; } // ddddd [NameInMap("same")] [Validation(Required=false)] public List<DemoClass> Same { get; set; } } }
23.459459
59
0.615207
[ "MIT" ]
sdk-team/antchain-openapi-prod-sdk
DEMO/csharp/core/Models/StatusDemoGatewayCheckRequest.cs
868
C#
using System.Windows; using WslToolbox.Gui.Views; namespace WslToolbox.Gui.Commands { public class ShowApplicationCommand : GenericCommand { private readonly MainView _mainView; public ShowApplicationCommand(MainView mainView) { _mainView = mainView; IsExecutable = _ => _mainView.WindowState == WindowState.Minimized; IsExecutableDefault = IsExecutable; } public override void Execute(object parameter) { _mainView.WindowState = WindowState.Normal; _mainView.Show(); } } }
26.304348
79
0.636364
[ "MIT" ]
FalconNL93/WslToolbox
WslToolbox.Gui/Commands/ShowApplicationCommand.cs
607
C#
// Copyright 2005-2010 Gallio Project - http://www.gallio.org/ // Portions Copyright 2000-2004 Jonathan de Halleux // // 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. using System; using System.Collections.Generic; using System.Linq; using System.Text; using Gallio.Common.Markup; using Gallio.Common.Markup.Tags; using MbUnit.Framework; namespace Gallio.Tests.Common.Markup { [TestsOn(typeof(StructuredStream))] public class StructuredStreamTest { [Test] public void ConstructorThrowsIfNameIsNull() { Assert.Throws<ArgumentNullException>(() => new StructuredStream(null)); } [Test] public void ConstructorCreatesAnEmptyStream() { StructuredStream stream = new StructuredStream("name"); Assert.AreEqual("name", stream.Name); Assert.IsEmpty(stream.Body.Contents); } [Test] public void NameCanBeSetToNonNull() { StructuredStream stream = new StructuredStream("name"); stream.Name = "foo"; Assert.AreEqual("foo", stream.Name); } [Test] public void NameCannotBeSetToNull() { StructuredStream stream = new StructuredStream("name"); Assert.Throws<ArgumentNullException>(() => stream.Name = null); } [Test] public void BodyCanBeSetToNonNull() { BodyTag newBody = new BodyTag(); StructuredStream stream = new StructuredStream("name"); stream.Body = newBody; Assert.AreSame(newBody, stream.Body); } [Test] public void BodyCannotBeSetToNull() { StructuredStream stream = new StructuredStream("name"); Assert.Throws<ArgumentNullException>(() => stream.Body = null); } [Test] public void WriteToThrowsIfWriterIsNull() { StructuredStream stream = new StructuredStream("name"); Assert.Throws<ArgumentNullException>(() => stream.WriteTo(null)); } [Test] public void WriteToReproducesTheBodyOfTheStream() { StructuredStream stream = new StructuredStream("name") { Body = new BodyTag() { Contents = { new TextTag("text") } } }; StructuredTextWriter writer = new StructuredTextWriter(); stream.WriteTo(writer); writer.Close(); Assert.AreEqual(stream.ToString(), writer.ToString()); } [Test] public void ToStringPrintsTheBody() { StructuredStream stream = new StructuredStream("name") { Body = new BodyTag() { Contents = { new TextTag("text") } } }; Assert.AreEqual("text", stream.ToString()); } } }
29.818182
83
0.566519
[ "ECL-2.0", "Apache-2.0" ]
citizenmatt/gallio
src/Gallio/Gallio.Tests/Common/Markup/StructuredStreamTest.cs
3,608
C#
using System.Collections.Generic; using Content.Shared.Sound; using Robust.Shared.GameObjects; using Robust.Shared.Serialization.Manager.Attributes; namespace Content.Server.Storage.Components { /// <summary> /// Spawns items when used in hand. /// </summary> [RegisterComponent] public class SpawnItemsOnUseComponent : Component { /// <summary> /// The list of entities to spawn, with amounts and orGroups. /// </summary> /// <returns></returns> [DataField("items", required: true)] public List<EntitySpawnEntry> Items = new List<EntitySpawnEntry>(); /// <summary> /// A sound to play when the items are spawned. For example, gift boxes being unwrapped. /// </summary> [DataField("sound", required: true)] public SoundSpecifier? Sound = null; /// <summary> /// How many uses before the item should delete itself. /// </summary> /// <returns></returns> [DataField("uses")] public int Uses = 1; } }
30.885714
100
0.60407
[ "MIT" ]
AzzyIsNotHere/space-station-14
Content.Server/Storage/Components/SpawnItemsOnUseComponent.cs
1,081
C#
/* The MIT License (MIT) Copyright (c) 2014 Kolibri 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. */ using System; using System.Runtime.InteropServices; using System.Text; namespace Dotc.Common { public static class ClipboardHelper { public enum ResultCode { Success = 0, ErrorOpenClipboard = 1, ErrorGlobalAlloc = 2, ErrorGlobalLock = 3, ErrorSetClipboardData = 4, ErrorOutOfMemoryException = 5, ErrorArgumentOutOfRangeException = 6, ErrorException = 7, ErrorInvalidArgs = 8, ErrorGetLastError = 9 }; public class Result { public ResultCode ResultCode { get; internal set; } public uint LastError { get; internal set; } public bool OK => ResultCode.Success == ResultCode; } [STAThread] public static Result PushStringToClipboard(string message) { var isAscii = (message != null && (message == Encoding.ASCII.GetString(Encoding.ASCII.GetBytes(message)))); if (!isAscii) { return PushUnicodeStringToClipboard(message); } else { return PushAnsiStringToClipboard(message); } } [STAThread] public static Result PushUnicodeStringToClipboard(string message) { return __PushStringToClipboard(message, CF_UNICODETEXT); } [STAThread] public static Result PushAnsiStringToClipboard(string message) { return __PushStringToClipboard(message, CF_TEXT); } // ReSharper disable InconsistentNaming const uint CF_TEXT = 1; const uint CF_UNICODETEXT = 13; // ReSharper restore InconsistentNaming [STAThread] private static Result __PushStringToClipboard(string message, uint format) { try { try { if (message == null) { return new Result {ResultCode = ResultCode.ErrorInvalidArgs}; } if (!NativeMethods.OpenClipboard(IntPtr.Zero)) { var lastError = NativeMethods.GetLastError(); return new Result {ResultCode = ResultCode.ErrorOpenClipboard, LastError = lastError}; } if (!NativeMethods.EmptyClipboard()) { var lastError = NativeMethods.GetLastError(); return new Result { ResultCode = ResultCode.ErrorOpenClipboard, LastError = lastError }; } try { uint sizeOfChar; switch (format) { case CF_TEXT: sizeOfChar = 1; break; case CF_UNICODETEXT: sizeOfChar = 2; break; default: throw new ArgumentOutOfRangeException("format"); } var characters = (uint) message.Length; uint bytes = (characters + 1)*sizeOfChar; // ReSharper disable once InconsistentNaming const int GMEM_MOVABLE = 0x0002; // ReSharper disable once InconsistentNaming const int GMEM_ZEROINIT = 0x0040; // ReSharper disable once InconsistentNaming const int GHND = GMEM_MOVABLE | GMEM_ZEROINIT; // IMPORTANT: SetClipboardData requires memory that was acquired with GlobalAlloc using GMEM_MOVABLE. var hGlobal = NativeMethods.GlobalAlloc(GHND, (UIntPtr) bytes); if (hGlobal == IntPtr.Zero) { var lastError = NativeMethods.GetLastError(); return new Result {ResultCode = ResultCode.ErrorGlobalAlloc, LastError =lastError}; } try { // IMPORTANT: Marshal.StringToHGlobalUni allocates using LocalAlloc with LMEM_FIXED. // Note that LMEM_FIXED implies that LocalLock / LocalUnlock is not required. IntPtr source; switch (format) { case CF_TEXT: source = Marshal.StringToHGlobalAnsi(message); break; case CF_UNICODETEXT: source = Marshal.StringToHGlobalUni(message); break; default: throw new ArgumentOutOfRangeException("format"); } try { var target = NativeMethods.GlobalLock(hGlobal); if (target == IntPtr.Zero) { var lastError = NativeMethods.GetLastError(); return new Result { ResultCode = ResultCode.ErrorGlobalLock, LastError = lastError }; } try { NativeMethods.CopyMemory(target, source, bytes); } finally { var ignore = NativeMethods.GlobalUnlock(target); } if (NativeMethods.SetClipboardData(format, hGlobal).ToInt64() != 0) { // IMPORTANT: SetClipboardData takes ownership of hGlobal upon success. hGlobal = IntPtr.Zero; } else { var lastError = NativeMethods.GetLastError(); return new Result { ResultCode = ResultCode.ErrorSetClipboardData, LastError = lastError }; } } finally { // Marshal.StringToHGlobalUni actually allocates with LocalAlloc, thus we should theorhetically use LocalFree to free the memory... // ... but Marshal.FreeHGlobal actully uses a corresponding version of LocalFree internally, so this works, even though it doesn't // behave exactly as expected. Marshal.FreeHGlobal(source); } } catch (OutOfMemoryException) { var lastError = NativeMethods.GetLastError(); return new Result { ResultCode = ResultCode.ErrorOutOfMemoryException, LastError = lastError }; } catch (ArgumentOutOfRangeException) { var lastError = NativeMethods.GetLastError(); return new Result { ResultCode = ResultCode.ErrorArgumentOutOfRangeException, LastError = lastError }; } finally { if (hGlobal != IntPtr.Zero) { var ignore = NativeMethods.GlobalFree(hGlobal); } } } finally { NativeMethods.CloseClipboard(); } return new Result {ResultCode = ResultCode.Success}; } catch (Exception) { var lastError = NativeMethods.GetLastError(); return new Result {ResultCode = ResultCode.ErrorException, LastError = lastError}; } } catch (Exception) { return new Result {ResultCode = ResultCode.ErrorGetLastError}; } } } }
39.103704
164
0.443076
[ "MIT" ]
bgiot/mqexplorerplus
src/Dotc.Common/ClipboardHelper.cs
10,560
C#
// <auto-generated> // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/cloud/asset/v1/assets.proto // </auto-generated> #pragma warning disable 1591, 0612, 3021 #region Designer generated code using pb = global::Google.Protobuf; using pbc = global::Google.Protobuf.Collections; using pbr = global::Google.Protobuf.Reflection; using scg = global::System.Collections.Generic; namespace Google.Cloud.Asset.V1 { /// <summary>Holder for reflection information generated from google/cloud/asset/v1/assets.proto</summary> public static partial class AssetsReflection { #region Descriptor /// <summary>File descriptor for google/cloud/asset/v1/assets.proto</summary> public static pbr::FileDescriptor Descriptor { get { return descriptor; } } private static pbr::FileDescriptor descriptor; static AssetsReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "CiJnb29nbGUvY2xvdWQvYXNzZXQvdjEvYXNzZXRzLnByb3RvEhVnb29nbGUu", "Y2xvdWQuYXNzZXQudjEaGWdvb2dsZS9hcGkvcmVzb3VyY2UucHJvdG8aKWdv", "b2dsZS9jbG91ZC9vcmdwb2xpY3kvdjEvb3JncG9saWN5LnByb3RvGhpnb29n", "bGUvaWFtL3YxL3BvbGljeS5wcm90bxo6Z29vZ2xlL2lkZW50aXR5L2FjY2Vz", "c2NvbnRleHRtYW5hZ2VyL3YxL2FjY2Vzc19sZXZlbC5wcm90bxo7Z29vZ2xl", "L2lkZW50aXR5L2FjY2Vzc2NvbnRleHRtYW5hZ2VyL3YxL2FjY2Vzc19wb2xp", "Y3kucHJvdG8aKGdvb2dsZS9jbG91ZC9vc2NvbmZpZy92MS9pbnZlbnRvcnku", "cHJvdG8aP2dvb2dsZS9pZGVudGl0eS9hY2Nlc3Njb250ZXh0bWFuYWdlci92", "MS9zZXJ2aWNlX3BlcmltZXRlci5wcm90bxoZZ29vZ2xlL3Byb3RvYnVmL2Fu", "eS5wcm90bxocZ29vZ2xlL3Byb3RvYnVmL3N0cnVjdC5wcm90bxofZ29vZ2xl", "L3Byb3RvYnVmL3RpbWVzdGFtcC5wcm90bxoVZ29vZ2xlL3JwYy9jb2RlLnBy", "b3RvGhxnb29nbGUvYXBpL2Fubm90YXRpb25zLnByb3RvIvUCCg1UZW1wb3Jh", "bEFzc2V0EjEKBndpbmRvdxgBIAEoCzIhLmdvb2dsZS5jbG91ZC5hc3NldC52", "MS5UaW1lV2luZG93Eg8KB2RlbGV0ZWQYAiABKAgSKwoFYXNzZXQYAyABKAsy", "HC5nb29nbGUuY2xvdWQuYXNzZXQudjEuQXNzZXQSTwoRcHJpb3JfYXNzZXRf", "c3RhdGUYBCABKA4yNC5nb29nbGUuY2xvdWQuYXNzZXQudjEuVGVtcG9yYWxB", "c3NldC5QcmlvckFzc2V0U3RhdGUSMQoLcHJpb3JfYXNzZXQYBSABKAsyHC5n", "b29nbGUuY2xvdWQuYXNzZXQudjEuQXNzZXQibwoPUHJpb3JBc3NldFN0YXRl", "EiEKHVBSSU9SX0FTU0VUX1NUQVRFX1VOU1BFQ0lGSUVEEAASCwoHUFJFU0VO", "VBABEgsKB0lOVkFMSUQQAhISCg5ET0VTX05PVF9FWElTVBADEgsKB0RFTEVU", "RUQQBCJqCgpUaW1lV2luZG93Ei4KCnN0YXJ0X3RpbWUYASABKAsyGi5nb29n", "bGUucHJvdG9idWYuVGltZXN0YW1wEiwKCGVuZF90aW1lGAIgASgLMhouZ29v", "Z2xlLnByb3RvYnVmLlRpbWVzdGFtcCL1BAoFQXNzZXQSLwoLdXBkYXRlX3Rp", "bWUYCyABKAsyGi5nb29nbGUucHJvdG9idWYuVGltZXN0YW1wEgwKBG5hbWUY", "ASABKAkSEgoKYXNzZXRfdHlwZRgCIAEoCRIxCghyZXNvdXJjZRgDIAEoCzIf", "Lmdvb2dsZS5jbG91ZC5hc3NldC52MS5SZXNvdXJjZRIpCgppYW1fcG9saWN5", "GAQgASgLMhUuZ29vZ2xlLmlhbS52MS5Qb2xpY3kSNQoKb3JnX3BvbGljeRgG", "IAMoCzIhLmdvb2dsZS5jbG91ZC5vcmdwb2xpY3kudjEuUG9saWN5Ek4KDWFj", "Y2Vzc19wb2xpY3kYByABKAsyNS5nb29nbGUuaWRlbnRpdHkuYWNjZXNzY29u", "dGV4dG1hbmFnZXIudjEuQWNjZXNzUG9saWN5SAASTAoMYWNjZXNzX2xldmVs", "GAggASgLMjQuZ29vZ2xlLmlkZW50aXR5LmFjY2Vzc2NvbnRleHRtYW5hZ2Vy", "LnYxLkFjY2Vzc0xldmVsSAASVgoRc2VydmljZV9wZXJpbWV0ZXIYCSABKAsy", "OS5nb29nbGUuaWRlbnRpdHkuYWNjZXNzY29udGV4dG1hbmFnZXIudjEuU2Vy", "dmljZVBlcmltZXRlckgAEjkKDG9zX2ludmVudG9yeRgMIAEoCzIjLmdvb2ds", "ZS5jbG91ZC5vc2NvbmZpZy52MS5JbnZlbnRvcnkSEQoJYW5jZXN0b3JzGAog", "AygJOifqQSQKH2Nsb3VkYXNzZXQuZ29vZ2xlYXBpcy5jb20vQXNzZXQSASpC", "FwoVYWNjZXNzX2NvbnRleHRfcG9saWN5IrIBCghSZXNvdXJjZRIPCgd2ZXJz", "aW9uGAEgASgJEh4KFmRpc2NvdmVyeV9kb2N1bWVudF91cmkYAiABKAkSFgoO", "ZGlzY292ZXJ5X25hbWUYAyABKAkSFAoMcmVzb3VyY2VfdXJsGAQgASgJEg4K", "BnBhcmVudBgFIAEoCRIlCgRkYXRhGAYgASgLMhcuZ29vZ2xlLnByb3RvYnVm", "LlN0cnVjdBIQCghsb2NhdGlvbhgIIAEoCSLMAgoUUmVzb3VyY2VTZWFyY2hS", "ZXN1bHQSDAoEbmFtZRgBIAEoCRISCgphc3NldF90eXBlGAIgASgJEg8KB3By", "b2plY3QYAyABKAkSFAoMZGlzcGxheV9uYW1lGAQgASgJEhMKC2Rlc2NyaXB0", "aW9uGAUgASgJEhAKCGxvY2F0aW9uGAYgASgJEkcKBmxhYmVscxgHIAMoCzI3", "Lmdvb2dsZS5jbG91ZC5hc3NldC52MS5SZXNvdXJjZVNlYXJjaFJlc3VsdC5M", "YWJlbHNFbnRyeRIUCgxuZXR3b3JrX3RhZ3MYCCADKAkSNgoVYWRkaXRpb25h", "bF9hdHRyaWJ1dGVzGAkgASgLMhcuZ29vZ2xlLnByb3RvYnVmLlN0cnVjdBot", "CgtMYWJlbHNFbnRyeRILCgNrZXkYASABKAkSDQoFdmFsdWUYAiABKAk6AjgB", "ItQDChVJYW1Qb2xpY3lTZWFyY2hSZXN1bHQSEAoIcmVzb3VyY2UYASABKAkS", "DwoHcHJvamVjdBgCIAEoCRIlCgZwb2xpY3kYAyABKAsyFS5nb29nbGUuaWFt", "LnYxLlBvbGljeRJNCgtleHBsYW5hdGlvbhgEIAEoCzI4Lmdvb2dsZS5jbG91", "ZC5hc3NldC52MS5JYW1Qb2xpY3lTZWFyY2hSZXN1bHQuRXhwbGFuYXRpb24a", "oQIKC0V4cGxhbmF0aW9uEm0KE21hdGNoZWRfcGVybWlzc2lvbnMYASADKAsy", "UC5nb29nbGUuY2xvdWQuYXNzZXQudjEuSWFtUG9saWN5U2VhcmNoUmVzdWx0", "LkV4cGxhbmF0aW9uLk1hdGNoZWRQZXJtaXNzaW9uc0VudHJ5GiIKC1Blcm1p", "c3Npb25zEhMKC3Blcm1pc3Npb25zGAEgAygJGn8KF01hdGNoZWRQZXJtaXNz", "aW9uc0VudHJ5EgsKA2tleRgBIAEoCRJTCgV2YWx1ZRgCIAEoCzJELmdvb2ds", "ZS5jbG91ZC5hc3NldC52MS5JYW1Qb2xpY3lTZWFyY2hSZXN1bHQuRXhwbGFu", "YXRpb24uUGVybWlzc2lvbnM6AjgBIkcKFklhbVBvbGljeUFuYWx5c2lzU3Rh", "dGUSHgoEY29kZRgBIAEoDjIQLmdvb2dsZS5ycGMuQ29kZRINCgVjYXVzZRgC", "IAEoCSLhCAoXSWFtUG9saWN5QW5hbHlzaXNSZXN1bHQSIwobYXR0YWNoZWRf", "cmVzb3VyY2VfZnVsbF9uYW1lGAEgASgJEisKC2lhbV9iaW5kaW5nGAIgASgL", "MhYuZ29vZ2xlLmlhbS52MS5CaW5kaW5nEl4KFGFjY2Vzc19jb250cm9sX2xp", "c3RzGAMgAygLMkAuZ29vZ2xlLmNsb3VkLmFzc2V0LnYxLklhbVBvbGljeUFu", "YWx5c2lzUmVzdWx0LkFjY2Vzc0NvbnRyb2xMaXN0ElIKDWlkZW50aXR5X2xp", "c3QYBCABKAsyOy5nb29nbGUuY2xvdWQuYXNzZXQudjEuSWFtUG9saWN5QW5h", "bHlzaXNSZXN1bHQuSWRlbnRpdHlMaXN0EhYKDmZ1bGx5X2V4cGxvcmVkGAUg", "ASgIGm0KCFJlc291cmNlEhoKEmZ1bGxfcmVzb3VyY2VfbmFtZRgBIAEoCRJF", "Cg5hbmFseXNpc19zdGF0ZRgCIAEoCzItLmdvb2dsZS5jbG91ZC5hc3NldC52", "MS5JYW1Qb2xpY3lBbmFseXNpc1N0YXRlGoUBCgZBY2Nlc3MSDgoEcm9sZRgB", "IAEoCUgAEhQKCnBlcm1pc3Npb24YAiABKAlIABJFCg5hbmFseXNpc19zdGF0", "ZRgDIAEoCzItLmdvb2dsZS5jbG91ZC5hc3NldC52MS5JYW1Qb2xpY3lBbmFs", "eXNpc1N0YXRlQg4KDG9uZW9mX2FjY2VzcxpfCghJZGVudGl0eRIMCgRuYW1l", "GAEgASgJEkUKDmFuYWx5c2lzX3N0YXRlGAIgASgLMi0uZ29vZ2xlLmNsb3Vk", "LmFzc2V0LnYxLklhbVBvbGljeUFuYWx5c2lzU3RhdGUaMAoERWRnZRITCgtz", "b3VyY2Vfbm9kZRgBIAEoCRITCgt0YXJnZXRfbm9kZRgCIAEoCRr1AQoRQWNj", "ZXNzQ29udHJvbExpc3QSSgoJcmVzb3VyY2VzGAEgAygLMjcuZ29vZ2xlLmNs", "b3VkLmFzc2V0LnYxLklhbVBvbGljeUFuYWx5c2lzUmVzdWx0LlJlc291cmNl", "EkcKCGFjY2Vzc2VzGAIgAygLMjUuZ29vZ2xlLmNsb3VkLmFzc2V0LnYxLklh", "bVBvbGljeUFuYWx5c2lzUmVzdWx0LkFjY2VzcxJLCg5yZXNvdXJjZV9lZGdl", "cxgDIAMoCzIzLmdvb2dsZS5jbG91ZC5hc3NldC52MS5JYW1Qb2xpY3lBbmFs", "eXNpc1Jlc3VsdC5FZGdlGqUBCgxJZGVudGl0eUxpc3QSSwoKaWRlbnRpdGll", "cxgBIAMoCzI3Lmdvb2dsZS5jbG91ZC5hc3NldC52MS5JYW1Qb2xpY3lBbmFs", "eXNpc1Jlc3VsdC5JZGVudGl0eRJICgtncm91cF9lZGdlcxgCIAMoCzIzLmdv", "b2dsZS5jbG91ZC5hc3NldC52MS5JYW1Qb2xpY3lBbmFseXNpc1Jlc3VsdC5F", "ZGdlQpgBChljb20uZ29vZ2xlLmNsb3VkLmFzc2V0LnYxQgpBc3NldFByb3Rv", "UAFaOmdvb2dsZS5nb2xhbmcub3JnL2dlbnByb3RvL2dvb2dsZWFwaXMvY2xv", "dWQvYXNzZXQvdjE7YXNzZXT4AQGqAhVHb29nbGUuQ2xvdWQuQXNzZXQuVjHK", "AhVHb29nbGVcQ2xvdWRcQXNzZXRcVjFiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Google.Api.ResourceReflection.Descriptor, global::Google.Cloud.OrgPolicy.V1.OrgpolicyReflection.Descriptor, global::Google.Cloud.Iam.V1.PolicyReflection.Descriptor, global::Google.Identity.AccessContextManager.V1.AccessLevelReflection.Descriptor, global::Google.Identity.AccessContextManager.V1.AccessPolicyReflection.Descriptor, global::Google.Cloud.OsConfig.V1.InventoryReflection.Descriptor, global::Google.Identity.AccessContextManager.V1.ServicePerimeterReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.AnyReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor, global::Google.Rpc.CodeReflection.Descriptor, global::Google.Api.AnnotationsReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Asset.V1.TemporalAsset), global::Google.Cloud.Asset.V1.TemporalAsset.Parser, new[]{ "Window", "Deleted", "Asset", "PriorAssetState", "PriorAsset" }, null, new[]{ typeof(global::Google.Cloud.Asset.V1.TemporalAsset.Types.PriorAssetState) }, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Asset.V1.TimeWindow), global::Google.Cloud.Asset.V1.TimeWindow.Parser, new[]{ "StartTime", "EndTime" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Asset.V1.Asset), global::Google.Cloud.Asset.V1.Asset.Parser, new[]{ "UpdateTime", "Name", "AssetType", "Resource", "IamPolicy", "OrgPolicy", "AccessPolicy", "AccessLevel", "ServicePerimeter", "OsInventory", "Ancestors" }, new[]{ "AccessContextPolicy" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Asset.V1.Resource), global::Google.Cloud.Asset.V1.Resource.Parser, new[]{ "Version", "DiscoveryDocumentUri", "DiscoveryName", "ResourceUrl", "Parent", "Data", "Location" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Asset.V1.ResourceSearchResult), global::Google.Cloud.Asset.V1.ResourceSearchResult.Parser, new[]{ "Name", "AssetType", "Project", "DisplayName", "Description", "Location", "Labels", "NetworkTags", "AdditionalAttributes" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, }), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Asset.V1.IamPolicySearchResult), global::Google.Cloud.Asset.V1.IamPolicySearchResult.Parser, new[]{ "Resource", "Project", "Policy", "Explanation" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Asset.V1.IamPolicySearchResult.Types.Explanation), global::Google.Cloud.Asset.V1.IamPolicySearchResult.Types.Explanation.Parser, new[]{ "MatchedPermissions" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Asset.V1.IamPolicySearchResult.Types.Explanation.Types.Permissions), global::Google.Cloud.Asset.V1.IamPolicySearchResult.Types.Explanation.Types.Permissions.Parser, new[]{ "Permissions_" }, null, null, null, null), null, })}), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Asset.V1.IamPolicyAnalysisState), global::Google.Cloud.Asset.V1.IamPolicyAnalysisState.Parser, new[]{ "Code", "Cause" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult), global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Parser, new[]{ "AttachedResourceFullName", "IamBinding", "AccessControlLists", "IdentityList", "FullyExplored" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.Resource), global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.Resource.Parser, new[]{ "FullResourceName", "AnalysisState" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.Access), global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.Access.Parser, new[]{ "Role", "Permission", "AnalysisState" }, new[]{ "OneofAccess" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.Identity), global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.Identity.Parser, new[]{ "Name", "AnalysisState" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.Edge), global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.Edge.Parser, new[]{ "SourceNode", "TargetNode" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.AccessControlList), global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.AccessControlList.Parser, new[]{ "Resources", "Accesses", "ResourceEdges" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.IdentityList), global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.IdentityList.Parser, new[]{ "Identities", "GroupEdges" }, null, null, null, null)}) })); } #endregion } #region Messages /// <summary> /// An asset in Google Cloud and its temporal metadata, including the time window /// when it was observed and its status during that window. /// </summary> public sealed partial class TemporalAsset : pb::IMessage<TemporalAsset> #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { private static readonly pb::MessageParser<TemporalAsset> _parser = new pb::MessageParser<TemporalAsset>(() => new TemporalAsset()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<TemporalAsset> Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Cloud.Asset.V1.AssetsReflection.Descriptor.MessageTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TemporalAsset() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TemporalAsset(TemporalAsset other) : this() { window_ = other.window_ != null ? other.window_.Clone() : null; deleted_ = other.deleted_; asset_ = other.asset_ != null ? other.asset_.Clone() : null; priorAssetState_ = other.priorAssetState_; priorAsset_ = other.priorAsset_ != null ? other.priorAsset_.Clone() : null; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TemporalAsset Clone() { return new TemporalAsset(this); } /// <summary>Field number for the "window" field.</summary> public const int WindowFieldNumber = 1; private global::Google.Cloud.Asset.V1.TimeWindow window_; /// <summary> /// The time window when the asset data and state was observed. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Cloud.Asset.V1.TimeWindow Window { get { return window_; } set { window_ = value; } } /// <summary>Field number for the "deleted" field.</summary> public const int DeletedFieldNumber = 2; private bool deleted_; /// <summary> /// Whether the asset has been deleted or not. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Deleted { get { return deleted_; } set { deleted_ = value; } } /// <summary>Field number for the "asset" field.</summary> public const int AssetFieldNumber = 3; private global::Google.Cloud.Asset.V1.Asset asset_; /// <summary> /// An asset in Google Cloud. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Cloud.Asset.V1.Asset Asset { get { return asset_; } set { asset_ = value; } } /// <summary>Field number for the "prior_asset_state" field.</summary> public const int PriorAssetStateFieldNumber = 4; private global::Google.Cloud.Asset.V1.TemporalAsset.Types.PriorAssetState priorAssetState_ = global::Google.Cloud.Asset.V1.TemporalAsset.Types.PriorAssetState.Unspecified; /// <summary> /// State of prior_asset. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Cloud.Asset.V1.TemporalAsset.Types.PriorAssetState PriorAssetState { get { return priorAssetState_; } set { priorAssetState_ = value; } } /// <summary>Field number for the "prior_asset" field.</summary> public const int PriorAssetFieldNumber = 5; private global::Google.Cloud.Asset.V1.Asset priorAsset_; /// <summary> /// Prior copy of the asset. Populated if prior_asset_state is PRESENT. /// Currently this is only set for responses in Real-Time Feed. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Cloud.Asset.V1.Asset PriorAsset { get { return priorAsset_; } set { priorAsset_ = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as TemporalAsset); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(TemporalAsset other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } if (!object.Equals(Window, other.Window)) return false; if (Deleted != other.Deleted) return false; if (!object.Equals(Asset, other.Asset)) return false; if (PriorAssetState != other.PriorAssetState) return false; if (!object.Equals(PriorAsset, other.PriorAsset)) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (window_ != null) hash ^= Window.GetHashCode(); if (Deleted != false) hash ^= Deleted.GetHashCode(); if (asset_ != null) hash ^= Asset.GetHashCode(); if (PriorAssetState != global::Google.Cloud.Asset.V1.TemporalAsset.Types.PriorAssetState.Unspecified) hash ^= PriorAssetState.GetHashCode(); if (priorAsset_ != null) hash ^= PriorAsset.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return hash; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else if (window_ != null) { output.WriteRawTag(10); output.WriteMessage(Window); } if (Deleted != false) { output.WriteRawTag(16); output.WriteBool(Deleted); } if (asset_ != null) { output.WriteRawTag(26); output.WriteMessage(Asset); } if (PriorAssetState != global::Google.Cloud.Asset.V1.TemporalAsset.Types.PriorAssetState.Unspecified) { output.WriteRawTag(32); output.WriteEnum((int) PriorAssetState); } if (priorAsset_ != null) { output.WriteRawTag(42); output.WriteMessage(PriorAsset); } if (_unknownFields != null) { _unknownFields.WriteTo(output); } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { if (window_ != null) { output.WriteRawTag(10); output.WriteMessage(Window); } if (Deleted != false) { output.WriteRawTag(16); output.WriteBool(Deleted); } if (asset_ != null) { output.WriteRawTag(26); output.WriteMessage(Asset); } if (PriorAssetState != global::Google.Cloud.Asset.V1.TemporalAsset.Types.PriorAssetState.Unspecified) { output.WriteRawTag(32); output.WriteEnum((int) PriorAssetState); } if (priorAsset_ != null) { output.WriteRawTag(42); output.WriteMessage(PriorAsset); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } } #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (window_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Window); } if (Deleted != false) { size += 1 + 1; } if (asset_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Asset); } if (PriorAssetState != global::Google.Cloud.Asset.V1.TemporalAsset.Types.PriorAssetState.Unspecified) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) PriorAssetState); } if (priorAsset_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(PriorAsset); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } return size; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(TemporalAsset other) { if (other == null) { return; } if (other.window_ != null) { if (window_ == null) { Window = new global::Google.Cloud.Asset.V1.TimeWindow(); } Window.MergeFrom(other.Window); } if (other.Deleted != false) { Deleted = other.Deleted; } if (other.asset_ != null) { if (asset_ == null) { Asset = new global::Google.Cloud.Asset.V1.Asset(); } Asset.MergeFrom(other.Asset); } if (other.PriorAssetState != global::Google.Cloud.Asset.V1.TemporalAsset.Types.PriorAssetState.Unspecified) { PriorAssetState = other.PriorAssetState; } if (other.priorAsset_ != null) { if (priorAsset_ == null) { PriorAsset = new global::Google.Cloud.Asset.V1.Asset(); } PriorAsset.MergeFrom(other.PriorAsset); } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE input.ReadRawMessage(this); #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { if (window_ == null) { Window = new global::Google.Cloud.Asset.V1.TimeWindow(); } input.ReadMessage(Window); break; } case 16: { Deleted = input.ReadBool(); break; } case 26: { if (asset_ == null) { Asset = new global::Google.Cloud.Asset.V1.Asset(); } input.ReadMessage(Asset); break; } case 32: { PriorAssetState = (global::Google.Cloud.Asset.V1.TemporalAsset.Types.PriorAssetState) input.ReadEnum(); break; } case 42: { if (priorAsset_ == null) { PriorAsset = new global::Google.Cloud.Asset.V1.Asset(); } input.ReadMessage(PriorAsset); break; } } } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { if (window_ == null) { Window = new global::Google.Cloud.Asset.V1.TimeWindow(); } input.ReadMessage(Window); break; } case 16: { Deleted = input.ReadBool(); break; } case 26: { if (asset_ == null) { Asset = new global::Google.Cloud.Asset.V1.Asset(); } input.ReadMessage(Asset); break; } case 32: { PriorAssetState = (global::Google.Cloud.Asset.V1.TemporalAsset.Types.PriorAssetState) input.ReadEnum(); break; } case 42: { if (priorAsset_ == null) { PriorAsset = new global::Google.Cloud.Asset.V1.Asset(); } input.ReadMessage(PriorAsset); break; } } } } #endif #region Nested types /// <summary>Container for nested types declared in the TemporalAsset message type.</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static partial class Types { /// <summary> /// State of prior asset. /// </summary> public enum PriorAssetState { /// <summary> /// prior_asset is not applicable for the current asset. /// </summary> [pbr::OriginalName("PRIOR_ASSET_STATE_UNSPECIFIED")] Unspecified = 0, /// <summary> /// prior_asset is populated correctly. /// </summary> [pbr::OriginalName("PRESENT")] Present = 1, /// <summary> /// Failed to set prior_asset. /// </summary> [pbr::OriginalName("INVALID")] Invalid = 2, /// <summary> /// Current asset is the first known state. /// </summary> [pbr::OriginalName("DOES_NOT_EXIST")] DoesNotExist = 3, /// <summary> /// prior_asset is a deletion. /// </summary> [pbr::OriginalName("DELETED")] Deleted = 4, } } #endregion } /// <summary> /// A time window specified by its `start_time` and `end_time`. /// </summary> public sealed partial class TimeWindow : pb::IMessage<TimeWindow> #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { private static readonly pb::MessageParser<TimeWindow> _parser = new pb::MessageParser<TimeWindow>(() => new TimeWindow()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<TimeWindow> Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Cloud.Asset.V1.AssetsReflection.Descriptor.MessageTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TimeWindow() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TimeWindow(TimeWindow other) : this() { startTime_ = other.startTime_ != null ? other.startTime_.Clone() : null; endTime_ = other.endTime_ != null ? other.endTime_.Clone() : null; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public TimeWindow Clone() { return new TimeWindow(this); } /// <summary>Field number for the "start_time" field.</summary> public const int StartTimeFieldNumber = 1; private global::Google.Protobuf.WellKnownTypes.Timestamp startTime_; /// <summary> /// Start time of the time window (exclusive). /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.Timestamp StartTime { get { return startTime_; } set { startTime_ = value; } } /// <summary>Field number for the "end_time" field.</summary> public const int EndTimeFieldNumber = 2; private global::Google.Protobuf.WellKnownTypes.Timestamp endTime_; /// <summary> /// End time of the time window (inclusive). If not specified, the current /// timestamp is used instead. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.Timestamp EndTime { get { return endTime_; } set { endTime_ = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as TimeWindow); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(TimeWindow other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } if (!object.Equals(StartTime, other.StartTime)) return false; if (!object.Equals(EndTime, other.EndTime)) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (startTime_ != null) hash ^= StartTime.GetHashCode(); if (endTime_ != null) hash ^= EndTime.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return hash; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else if (startTime_ != null) { output.WriteRawTag(10); output.WriteMessage(StartTime); } if (endTime_ != null) { output.WriteRawTag(18); output.WriteMessage(EndTime); } if (_unknownFields != null) { _unknownFields.WriteTo(output); } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { if (startTime_ != null) { output.WriteRawTag(10); output.WriteMessage(StartTime); } if (endTime_ != null) { output.WriteRawTag(18); output.WriteMessage(EndTime); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } } #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (startTime_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(StartTime); } if (endTime_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(EndTime); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } return size; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(TimeWindow other) { if (other == null) { return; } if (other.startTime_ != null) { if (startTime_ == null) { StartTime = new global::Google.Protobuf.WellKnownTypes.Timestamp(); } StartTime.MergeFrom(other.StartTime); } if (other.endTime_ != null) { if (endTime_ == null) { EndTime = new global::Google.Protobuf.WellKnownTypes.Timestamp(); } EndTime.MergeFrom(other.EndTime); } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE input.ReadRawMessage(this); #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { if (startTime_ == null) { StartTime = new global::Google.Protobuf.WellKnownTypes.Timestamp(); } input.ReadMessage(StartTime); break; } case 18: { if (endTime_ == null) { EndTime = new global::Google.Protobuf.WellKnownTypes.Timestamp(); } input.ReadMessage(EndTime); break; } } } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { if (startTime_ == null) { StartTime = new global::Google.Protobuf.WellKnownTypes.Timestamp(); } input.ReadMessage(StartTime); break; } case 18: { if (endTime_ == null) { EndTime = new global::Google.Protobuf.WellKnownTypes.Timestamp(); } input.ReadMessage(EndTime); break; } } } } #endif } /// <summary> /// An asset in Google Cloud. An asset can be any resource in the Google Cloud /// [resource /// hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy), /// a resource outside the Google Cloud resource hierarchy (such as Google /// Kubernetes Engine clusters and objects), or a policy (e.g. Cloud IAM policy). /// See [Supported asset /// types](https://cloud.google.com/asset-inventory/docs/supported-asset-types) /// for more information. /// </summary> public sealed partial class Asset : pb::IMessage<Asset> #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { private static readonly pb::MessageParser<Asset> _parser = new pb::MessageParser<Asset>(() => new Asset()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<Asset> Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Cloud.Asset.V1.AssetsReflection.Descriptor.MessageTypes[2]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Asset() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Asset(Asset other) : this() { updateTime_ = other.updateTime_ != null ? other.updateTime_.Clone() : null; name_ = other.name_; assetType_ = other.assetType_; resource_ = other.resource_ != null ? other.resource_.Clone() : null; iamPolicy_ = other.iamPolicy_ != null ? other.iamPolicy_.Clone() : null; orgPolicy_ = other.orgPolicy_.Clone(); osInventory_ = other.osInventory_ != null ? other.osInventory_.Clone() : null; ancestors_ = other.ancestors_.Clone(); switch (other.AccessContextPolicyCase) { case AccessContextPolicyOneofCase.AccessPolicy: AccessPolicy = other.AccessPolicy.Clone(); break; case AccessContextPolicyOneofCase.AccessLevel: AccessLevel = other.AccessLevel.Clone(); break; case AccessContextPolicyOneofCase.ServicePerimeter: ServicePerimeter = other.ServicePerimeter.Clone(); break; } _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Asset Clone() { return new Asset(this); } /// <summary>Field number for the "update_time" field.</summary> public const int UpdateTimeFieldNumber = 11; private global::Google.Protobuf.WellKnownTypes.Timestamp updateTime_; /// <summary> /// The last update timestamp of an asset. update_time is updated when /// create/update/delete operation is performed. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.Timestamp UpdateTime { get { return updateTime_; } set { updateTime_ = value; } } /// <summary>Field number for the "name" field.</summary> public const int NameFieldNumber = 1; private string name_ = ""; /// <summary> /// The full name of the asset. Example: /// `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1` /// /// See [Resource /// names](https://cloud.google.com/apis/design/resource_names#full_resource_name) /// for more information. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { get { return name_; } set { name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// <summary>Field number for the "asset_type" field.</summary> public const int AssetTypeFieldNumber = 2; private string assetType_ = ""; /// <summary> /// The type of the asset. Example: `compute.googleapis.com/Disk` /// /// See [Supported asset /// types](https://cloud.google.com/asset-inventory/docs/supported-asset-types) /// for more information. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string AssetType { get { return assetType_; } set { assetType_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// <summary>Field number for the "resource" field.</summary> public const int ResourceFieldNumber = 3; private global::Google.Cloud.Asset.V1.Resource resource_; /// <summary> /// A representation of the resource. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Cloud.Asset.V1.Resource Resource { get { return resource_; } set { resource_ = value; } } /// <summary>Field number for the "iam_policy" field.</summary> public const int IamPolicyFieldNumber = 4; private global::Google.Cloud.Iam.V1.Policy iamPolicy_; /// <summary> /// A representation of the Cloud IAM policy set on a Google Cloud resource. /// There can be a maximum of one Cloud IAM policy set on any given resource. /// In addition, Cloud IAM policies inherit their granted access scope from any /// policies set on parent resources in the resource hierarchy. Therefore, the /// effectively policy is the union of both the policy set on this resource /// and each policy set on all of the resource's ancestry resource levels in /// the hierarchy. See /// [this topic](https://cloud.google.com/iam/docs/policies#inheritance) for /// more information. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Cloud.Iam.V1.Policy IamPolicy { get { return iamPolicy_; } set { iamPolicy_ = value; } } /// <summary>Field number for the "org_policy" field.</summary> public const int OrgPolicyFieldNumber = 6; private static readonly pb::FieldCodec<global::Google.Cloud.OrgPolicy.V1.Policy> _repeated_orgPolicy_codec = pb::FieldCodec.ForMessage(50, global::Google.Cloud.OrgPolicy.V1.Policy.Parser); private readonly pbc::RepeatedField<global::Google.Cloud.OrgPolicy.V1.Policy> orgPolicy_ = new pbc::RepeatedField<global::Google.Cloud.OrgPolicy.V1.Policy>(); /// <summary> /// A representation of an [organization /// policy](https://cloud.google.com/resource-manager/docs/organization-policy/overview#organization_policy). /// There can be more than one organization policy with different constraints /// set on a given resource. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField<global::Google.Cloud.OrgPolicy.V1.Policy> OrgPolicy { get { return orgPolicy_; } } /// <summary>Field number for the "access_policy" field.</summary> public const int AccessPolicyFieldNumber = 7; /// <summary> /// Please also refer to the [access policy user /// guide](https://cloud.google.com/access-context-manager/docs/overview#access-policies). /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Identity.AccessContextManager.V1.AccessPolicy AccessPolicy { get { return accessContextPolicyCase_ == AccessContextPolicyOneofCase.AccessPolicy ? (global::Google.Identity.AccessContextManager.V1.AccessPolicy) accessContextPolicy_ : null; } set { accessContextPolicy_ = value; accessContextPolicyCase_ = value == null ? AccessContextPolicyOneofCase.None : AccessContextPolicyOneofCase.AccessPolicy; } } /// <summary>Field number for the "access_level" field.</summary> public const int AccessLevelFieldNumber = 8; /// <summary> /// Please also refer to the [access level user /// guide](https://cloud.google.com/access-context-manager/docs/overview#access-levels). /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Identity.AccessContextManager.V1.AccessLevel AccessLevel { get { return accessContextPolicyCase_ == AccessContextPolicyOneofCase.AccessLevel ? (global::Google.Identity.AccessContextManager.V1.AccessLevel) accessContextPolicy_ : null; } set { accessContextPolicy_ = value; accessContextPolicyCase_ = value == null ? AccessContextPolicyOneofCase.None : AccessContextPolicyOneofCase.AccessLevel; } } /// <summary>Field number for the "service_perimeter" field.</summary> public const int ServicePerimeterFieldNumber = 9; /// <summary> /// Please also refer to the [service perimeter user /// guide](https://cloud.google.com/vpc-service-controls/docs/overview). /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Identity.AccessContextManager.V1.ServicePerimeter ServicePerimeter { get { return accessContextPolicyCase_ == AccessContextPolicyOneofCase.ServicePerimeter ? (global::Google.Identity.AccessContextManager.V1.ServicePerimeter) accessContextPolicy_ : null; } set { accessContextPolicy_ = value; accessContextPolicyCase_ = value == null ? AccessContextPolicyOneofCase.None : AccessContextPolicyOneofCase.ServicePerimeter; } } /// <summary>Field number for the "os_inventory" field.</summary> public const int OsInventoryFieldNumber = 12; private global::Google.Cloud.OsConfig.V1.Inventory osInventory_; /// <summary> /// A representation of runtime OS Inventory information. See [this /// topic](https://cloud.google.com/compute/docs/instances/os-inventory-management) /// for more information. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Cloud.OsConfig.V1.Inventory OsInventory { get { return osInventory_; } set { osInventory_ = value; } } /// <summary>Field number for the "ancestors" field.</summary> public const int AncestorsFieldNumber = 10; private static readonly pb::FieldCodec<string> _repeated_ancestors_codec = pb::FieldCodec.ForString(82); private readonly pbc::RepeatedField<string> ancestors_ = new pbc::RepeatedField<string>(); /// <summary> /// The ancestry path of an asset in Google Cloud [resource /// hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy), /// represented as a list of relative resource names. An ancestry path starts /// with the closest ancestor in the hierarchy and ends at root. If the asset /// is a project, folder, or organization, the ancestry path starts from the /// asset itself. /// /// Example: `["projects/123456789", "folders/5432", "organizations/1234"]` /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField<string> Ancestors { get { return ancestors_; } } private object accessContextPolicy_; /// <summary>Enum of possible cases for the "access_context_policy" oneof.</summary> public enum AccessContextPolicyOneofCase { None = 0, AccessPolicy = 7, AccessLevel = 8, ServicePerimeter = 9, } private AccessContextPolicyOneofCase accessContextPolicyCase_ = AccessContextPolicyOneofCase.None; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public AccessContextPolicyOneofCase AccessContextPolicyCase { get { return accessContextPolicyCase_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void ClearAccessContextPolicy() { accessContextPolicyCase_ = AccessContextPolicyOneofCase.None; accessContextPolicy_ = null; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as Asset); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Asset other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } if (!object.Equals(UpdateTime, other.UpdateTime)) return false; if (Name != other.Name) return false; if (AssetType != other.AssetType) return false; if (!object.Equals(Resource, other.Resource)) return false; if (!object.Equals(IamPolicy, other.IamPolicy)) return false; if(!orgPolicy_.Equals(other.orgPolicy_)) return false; if (!object.Equals(AccessPolicy, other.AccessPolicy)) return false; if (!object.Equals(AccessLevel, other.AccessLevel)) return false; if (!object.Equals(ServicePerimeter, other.ServicePerimeter)) return false; if (!object.Equals(OsInventory, other.OsInventory)) return false; if(!ancestors_.Equals(other.ancestors_)) return false; if (AccessContextPolicyCase != other.AccessContextPolicyCase) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (updateTime_ != null) hash ^= UpdateTime.GetHashCode(); if (Name.Length != 0) hash ^= Name.GetHashCode(); if (AssetType.Length != 0) hash ^= AssetType.GetHashCode(); if (resource_ != null) hash ^= Resource.GetHashCode(); if (iamPolicy_ != null) hash ^= IamPolicy.GetHashCode(); hash ^= orgPolicy_.GetHashCode(); if (accessContextPolicyCase_ == AccessContextPolicyOneofCase.AccessPolicy) hash ^= AccessPolicy.GetHashCode(); if (accessContextPolicyCase_ == AccessContextPolicyOneofCase.AccessLevel) hash ^= AccessLevel.GetHashCode(); if (accessContextPolicyCase_ == AccessContextPolicyOneofCase.ServicePerimeter) hash ^= ServicePerimeter.GetHashCode(); if (osInventory_ != null) hash ^= OsInventory.GetHashCode(); hash ^= ancestors_.GetHashCode(); hash ^= (int) accessContextPolicyCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return hash; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else if (Name.Length != 0) { output.WriteRawTag(10); output.WriteString(Name); } if (AssetType.Length != 0) { output.WriteRawTag(18); output.WriteString(AssetType); } if (resource_ != null) { output.WriteRawTag(26); output.WriteMessage(Resource); } if (iamPolicy_ != null) { output.WriteRawTag(34); output.WriteMessage(IamPolicy); } orgPolicy_.WriteTo(output, _repeated_orgPolicy_codec); if (accessContextPolicyCase_ == AccessContextPolicyOneofCase.AccessPolicy) { output.WriteRawTag(58); output.WriteMessage(AccessPolicy); } if (accessContextPolicyCase_ == AccessContextPolicyOneofCase.AccessLevel) { output.WriteRawTag(66); output.WriteMessage(AccessLevel); } if (accessContextPolicyCase_ == AccessContextPolicyOneofCase.ServicePerimeter) { output.WriteRawTag(74); output.WriteMessage(ServicePerimeter); } ancestors_.WriteTo(output, _repeated_ancestors_codec); if (updateTime_ != null) { output.WriteRawTag(90); output.WriteMessage(UpdateTime); } if (osInventory_ != null) { output.WriteRawTag(98); output.WriteMessage(OsInventory); } if (_unknownFields != null) { _unknownFields.WriteTo(output); } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { if (Name.Length != 0) { output.WriteRawTag(10); output.WriteString(Name); } if (AssetType.Length != 0) { output.WriteRawTag(18); output.WriteString(AssetType); } if (resource_ != null) { output.WriteRawTag(26); output.WriteMessage(Resource); } if (iamPolicy_ != null) { output.WriteRawTag(34); output.WriteMessage(IamPolicy); } orgPolicy_.WriteTo(ref output, _repeated_orgPolicy_codec); if (accessContextPolicyCase_ == AccessContextPolicyOneofCase.AccessPolicy) { output.WriteRawTag(58); output.WriteMessage(AccessPolicy); } if (accessContextPolicyCase_ == AccessContextPolicyOneofCase.AccessLevel) { output.WriteRawTag(66); output.WriteMessage(AccessLevel); } if (accessContextPolicyCase_ == AccessContextPolicyOneofCase.ServicePerimeter) { output.WriteRawTag(74); output.WriteMessage(ServicePerimeter); } ancestors_.WriteTo(ref output, _repeated_ancestors_codec); if (updateTime_ != null) { output.WriteRawTag(90); output.WriteMessage(UpdateTime); } if (osInventory_ != null) { output.WriteRawTag(98); output.WriteMessage(OsInventory); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } } #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (updateTime_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(UpdateTime); } if (Name.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); } if (AssetType.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(AssetType); } if (resource_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Resource); } if (iamPolicy_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(IamPolicy); } size += orgPolicy_.CalculateSize(_repeated_orgPolicy_codec); if (accessContextPolicyCase_ == AccessContextPolicyOneofCase.AccessPolicy) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(AccessPolicy); } if (accessContextPolicyCase_ == AccessContextPolicyOneofCase.AccessLevel) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(AccessLevel); } if (accessContextPolicyCase_ == AccessContextPolicyOneofCase.ServicePerimeter) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(ServicePerimeter); } if (osInventory_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(OsInventory); } size += ancestors_.CalculateSize(_repeated_ancestors_codec); if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } return size; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Asset other) { if (other == null) { return; } if (other.updateTime_ != null) { if (updateTime_ == null) { UpdateTime = new global::Google.Protobuf.WellKnownTypes.Timestamp(); } UpdateTime.MergeFrom(other.UpdateTime); } if (other.Name.Length != 0) { Name = other.Name; } if (other.AssetType.Length != 0) { AssetType = other.AssetType; } if (other.resource_ != null) { if (resource_ == null) { Resource = new global::Google.Cloud.Asset.V1.Resource(); } Resource.MergeFrom(other.Resource); } if (other.iamPolicy_ != null) { if (iamPolicy_ == null) { IamPolicy = new global::Google.Cloud.Iam.V1.Policy(); } IamPolicy.MergeFrom(other.IamPolicy); } orgPolicy_.Add(other.orgPolicy_); if (other.osInventory_ != null) { if (osInventory_ == null) { OsInventory = new global::Google.Cloud.OsConfig.V1.Inventory(); } OsInventory.MergeFrom(other.OsInventory); } ancestors_.Add(other.ancestors_); switch (other.AccessContextPolicyCase) { case AccessContextPolicyOneofCase.AccessPolicy: if (AccessPolicy == null) { AccessPolicy = new global::Google.Identity.AccessContextManager.V1.AccessPolicy(); } AccessPolicy.MergeFrom(other.AccessPolicy); break; case AccessContextPolicyOneofCase.AccessLevel: if (AccessLevel == null) { AccessLevel = new global::Google.Identity.AccessContextManager.V1.AccessLevel(); } AccessLevel.MergeFrom(other.AccessLevel); break; case AccessContextPolicyOneofCase.ServicePerimeter: if (ServicePerimeter == null) { ServicePerimeter = new global::Google.Identity.AccessContextManager.V1.ServicePerimeter(); } ServicePerimeter.MergeFrom(other.ServicePerimeter); break; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE input.ReadRawMessage(this); #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Name = input.ReadString(); break; } case 18: { AssetType = input.ReadString(); break; } case 26: { if (resource_ == null) { Resource = new global::Google.Cloud.Asset.V1.Resource(); } input.ReadMessage(Resource); break; } case 34: { if (iamPolicy_ == null) { IamPolicy = new global::Google.Cloud.Iam.V1.Policy(); } input.ReadMessage(IamPolicy); break; } case 50: { orgPolicy_.AddEntriesFrom(input, _repeated_orgPolicy_codec); break; } case 58: { global::Google.Identity.AccessContextManager.V1.AccessPolicy subBuilder = new global::Google.Identity.AccessContextManager.V1.AccessPolicy(); if (accessContextPolicyCase_ == AccessContextPolicyOneofCase.AccessPolicy) { subBuilder.MergeFrom(AccessPolicy); } input.ReadMessage(subBuilder); AccessPolicy = subBuilder; break; } case 66: { global::Google.Identity.AccessContextManager.V1.AccessLevel subBuilder = new global::Google.Identity.AccessContextManager.V1.AccessLevel(); if (accessContextPolicyCase_ == AccessContextPolicyOneofCase.AccessLevel) { subBuilder.MergeFrom(AccessLevel); } input.ReadMessage(subBuilder); AccessLevel = subBuilder; break; } case 74: { global::Google.Identity.AccessContextManager.V1.ServicePerimeter subBuilder = new global::Google.Identity.AccessContextManager.V1.ServicePerimeter(); if (accessContextPolicyCase_ == AccessContextPolicyOneofCase.ServicePerimeter) { subBuilder.MergeFrom(ServicePerimeter); } input.ReadMessage(subBuilder); ServicePerimeter = subBuilder; break; } case 82: { ancestors_.AddEntriesFrom(input, _repeated_ancestors_codec); break; } case 90: { if (updateTime_ == null) { UpdateTime = new global::Google.Protobuf.WellKnownTypes.Timestamp(); } input.ReadMessage(UpdateTime); break; } case 98: { if (osInventory_ == null) { OsInventory = new global::Google.Cloud.OsConfig.V1.Inventory(); } input.ReadMessage(OsInventory); break; } } } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { Name = input.ReadString(); break; } case 18: { AssetType = input.ReadString(); break; } case 26: { if (resource_ == null) { Resource = new global::Google.Cloud.Asset.V1.Resource(); } input.ReadMessage(Resource); break; } case 34: { if (iamPolicy_ == null) { IamPolicy = new global::Google.Cloud.Iam.V1.Policy(); } input.ReadMessage(IamPolicy); break; } case 50: { orgPolicy_.AddEntriesFrom(ref input, _repeated_orgPolicy_codec); break; } case 58: { global::Google.Identity.AccessContextManager.V1.AccessPolicy subBuilder = new global::Google.Identity.AccessContextManager.V1.AccessPolicy(); if (accessContextPolicyCase_ == AccessContextPolicyOneofCase.AccessPolicy) { subBuilder.MergeFrom(AccessPolicy); } input.ReadMessage(subBuilder); AccessPolicy = subBuilder; break; } case 66: { global::Google.Identity.AccessContextManager.V1.AccessLevel subBuilder = new global::Google.Identity.AccessContextManager.V1.AccessLevel(); if (accessContextPolicyCase_ == AccessContextPolicyOneofCase.AccessLevel) { subBuilder.MergeFrom(AccessLevel); } input.ReadMessage(subBuilder); AccessLevel = subBuilder; break; } case 74: { global::Google.Identity.AccessContextManager.V1.ServicePerimeter subBuilder = new global::Google.Identity.AccessContextManager.V1.ServicePerimeter(); if (accessContextPolicyCase_ == AccessContextPolicyOneofCase.ServicePerimeter) { subBuilder.MergeFrom(ServicePerimeter); } input.ReadMessage(subBuilder); ServicePerimeter = subBuilder; break; } case 82: { ancestors_.AddEntriesFrom(ref input, _repeated_ancestors_codec); break; } case 90: { if (updateTime_ == null) { UpdateTime = new global::Google.Protobuf.WellKnownTypes.Timestamp(); } input.ReadMessage(UpdateTime); break; } case 98: { if (osInventory_ == null) { OsInventory = new global::Google.Cloud.OsConfig.V1.Inventory(); } input.ReadMessage(OsInventory); break; } } } } #endif } /// <summary> /// A representation of a Google Cloud resource. /// </summary> public sealed partial class Resource : pb::IMessage<Resource> #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { private static readonly pb::MessageParser<Resource> _parser = new pb::MessageParser<Resource>(() => new Resource()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<Resource> Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Cloud.Asset.V1.AssetsReflection.Descriptor.MessageTypes[3]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Resource() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Resource(Resource other) : this() { version_ = other.version_; discoveryDocumentUri_ = other.discoveryDocumentUri_; discoveryName_ = other.discoveryName_; resourceUrl_ = other.resourceUrl_; parent_ = other.parent_; data_ = other.data_ != null ? other.data_.Clone() : null; location_ = other.location_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Resource Clone() { return new Resource(this); } /// <summary>Field number for the "version" field.</summary> public const int VersionFieldNumber = 1; private string version_ = ""; /// <summary> /// The API version. Example: `v1` /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Version { get { return version_; } set { version_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// <summary>Field number for the "discovery_document_uri" field.</summary> public const int DiscoveryDocumentUriFieldNumber = 2; private string discoveryDocumentUri_ = ""; /// <summary> /// The URL of the discovery document containing the resource's JSON schema. /// Example: /// `https://www.googleapis.com/discovery/v1/apis/compute/v1/rest` /// /// This value is unspecified for resources that do not have an API based on a /// discovery document, such as Cloud Bigtable. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string DiscoveryDocumentUri { get { return discoveryDocumentUri_; } set { discoveryDocumentUri_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// <summary>Field number for the "discovery_name" field.</summary> public const int DiscoveryNameFieldNumber = 3; private string discoveryName_ = ""; /// <summary> /// The JSON schema name listed in the discovery document. Example: /// `Project` /// /// This value is unspecified for resources that do not have an API based on a /// discovery document, such as Cloud Bigtable. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string DiscoveryName { get { return discoveryName_; } set { discoveryName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// <summary>Field number for the "resource_url" field.</summary> public const int ResourceUrlFieldNumber = 4; private string resourceUrl_ = ""; /// <summary> /// The REST URL for accessing the resource. An HTTP `GET` request using this /// URL returns the resource itself. Example: /// `https://cloudresourcemanager.googleapis.com/v1/projects/my-project-123` /// /// This value is unspecified for resources without a REST API. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string ResourceUrl { get { return resourceUrl_; } set { resourceUrl_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// <summary>Field number for the "parent" field.</summary> public const int ParentFieldNumber = 5; private string parent_ = ""; /// <summary> /// The full name of the immediate parent of this resource. See /// [Resource /// Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) /// for more information. /// /// For Google Cloud assets, this value is the parent resource defined in the /// [Cloud IAM policy /// hierarchy](https://cloud.google.com/iam/docs/overview#policy_hierarchy). /// Example: /// `//cloudresourcemanager.googleapis.com/projects/my_project_123` /// /// For third-party assets, this field may be set differently. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Parent { get { return parent_; } set { parent_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// <summary>Field number for the "data" field.</summary> public const int DataFieldNumber = 6; private global::Google.Protobuf.WellKnownTypes.Struct data_; /// <summary> /// The content of the resource, in which some sensitive fields are removed /// and may not be present. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.Struct Data { get { return data_; } set { data_ = value; } } /// <summary>Field number for the "location" field.</summary> public const int LocationFieldNumber = 8; private string location_ = ""; /// <summary> /// The location of the resource in Google Cloud, such as its zone and region. /// For more information, see https://cloud.google.com/about/locations/. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Location { get { return location_; } set { location_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as Resource); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Resource other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } if (Version != other.Version) return false; if (DiscoveryDocumentUri != other.DiscoveryDocumentUri) return false; if (DiscoveryName != other.DiscoveryName) return false; if (ResourceUrl != other.ResourceUrl) return false; if (Parent != other.Parent) return false; if (!object.Equals(Data, other.Data)) return false; if (Location != other.Location) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Version.Length != 0) hash ^= Version.GetHashCode(); if (DiscoveryDocumentUri.Length != 0) hash ^= DiscoveryDocumentUri.GetHashCode(); if (DiscoveryName.Length != 0) hash ^= DiscoveryName.GetHashCode(); if (ResourceUrl.Length != 0) hash ^= ResourceUrl.GetHashCode(); if (Parent.Length != 0) hash ^= Parent.GetHashCode(); if (data_ != null) hash ^= Data.GetHashCode(); if (Location.Length != 0) hash ^= Location.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return hash; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else if (Version.Length != 0) { output.WriteRawTag(10); output.WriteString(Version); } if (DiscoveryDocumentUri.Length != 0) { output.WriteRawTag(18); output.WriteString(DiscoveryDocumentUri); } if (DiscoveryName.Length != 0) { output.WriteRawTag(26); output.WriteString(DiscoveryName); } if (ResourceUrl.Length != 0) { output.WriteRawTag(34); output.WriteString(ResourceUrl); } if (Parent.Length != 0) { output.WriteRawTag(42); output.WriteString(Parent); } if (data_ != null) { output.WriteRawTag(50); output.WriteMessage(Data); } if (Location.Length != 0) { output.WriteRawTag(66); output.WriteString(Location); } if (_unknownFields != null) { _unknownFields.WriteTo(output); } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { if (Version.Length != 0) { output.WriteRawTag(10); output.WriteString(Version); } if (DiscoveryDocumentUri.Length != 0) { output.WriteRawTag(18); output.WriteString(DiscoveryDocumentUri); } if (DiscoveryName.Length != 0) { output.WriteRawTag(26); output.WriteString(DiscoveryName); } if (ResourceUrl.Length != 0) { output.WriteRawTag(34); output.WriteString(ResourceUrl); } if (Parent.Length != 0) { output.WriteRawTag(42); output.WriteString(Parent); } if (data_ != null) { output.WriteRawTag(50); output.WriteMessage(Data); } if (Location.Length != 0) { output.WriteRawTag(66); output.WriteString(Location); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } } #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Version.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Version); } if (DiscoveryDocumentUri.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(DiscoveryDocumentUri); } if (DiscoveryName.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(DiscoveryName); } if (ResourceUrl.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(ResourceUrl); } if (Parent.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Parent); } if (data_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Data); } if (Location.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Location); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } return size; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Resource other) { if (other == null) { return; } if (other.Version.Length != 0) { Version = other.Version; } if (other.DiscoveryDocumentUri.Length != 0) { DiscoveryDocumentUri = other.DiscoveryDocumentUri; } if (other.DiscoveryName.Length != 0) { DiscoveryName = other.DiscoveryName; } if (other.ResourceUrl.Length != 0) { ResourceUrl = other.ResourceUrl; } if (other.Parent.Length != 0) { Parent = other.Parent; } if (other.data_ != null) { if (data_ == null) { Data = new global::Google.Protobuf.WellKnownTypes.Struct(); } Data.MergeFrom(other.Data); } if (other.Location.Length != 0) { Location = other.Location; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE input.ReadRawMessage(this); #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Version = input.ReadString(); break; } case 18: { DiscoveryDocumentUri = input.ReadString(); break; } case 26: { DiscoveryName = input.ReadString(); break; } case 34: { ResourceUrl = input.ReadString(); break; } case 42: { Parent = input.ReadString(); break; } case 50: { if (data_ == null) { Data = new global::Google.Protobuf.WellKnownTypes.Struct(); } input.ReadMessage(Data); break; } case 66: { Location = input.ReadString(); break; } } } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { Version = input.ReadString(); break; } case 18: { DiscoveryDocumentUri = input.ReadString(); break; } case 26: { DiscoveryName = input.ReadString(); break; } case 34: { ResourceUrl = input.ReadString(); break; } case 42: { Parent = input.ReadString(); break; } case 50: { if (data_ == null) { Data = new global::Google.Protobuf.WellKnownTypes.Struct(); } input.ReadMessage(Data); break; } case 66: { Location = input.ReadString(); break; } } } } #endif } /// <summary> /// A result of Resource Search, containing information of a cloud resource. /// </summary> public sealed partial class ResourceSearchResult : pb::IMessage<ResourceSearchResult> #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { private static readonly pb::MessageParser<ResourceSearchResult> _parser = new pb::MessageParser<ResourceSearchResult>(() => new ResourceSearchResult()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<ResourceSearchResult> Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Cloud.Asset.V1.AssetsReflection.Descriptor.MessageTypes[4]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ResourceSearchResult() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ResourceSearchResult(ResourceSearchResult other) : this() { name_ = other.name_; assetType_ = other.assetType_; project_ = other.project_; displayName_ = other.displayName_; description_ = other.description_; location_ = other.location_; labels_ = other.labels_.Clone(); networkTags_ = other.networkTags_.Clone(); additionalAttributes_ = other.additionalAttributes_ != null ? other.additionalAttributes_.Clone() : null; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ResourceSearchResult Clone() { return new ResourceSearchResult(this); } /// <summary>Field number for the "name" field.</summary> public const int NameFieldNumber = 1; private string name_ = ""; /// <summary> /// The full resource name of this resource. Example: /// `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. /// See [Cloud Asset Inventory Resource Name /// Format](https://cloud.google.com/asset-inventory/docs/resource-name-format) /// for more information. /// /// To search against the `name`: /// /// * use a field query. Example: `name:instance1` /// * use a free text query. Example: `instance1` /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { get { return name_; } set { name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// <summary>Field number for the "asset_type" field.</summary> public const int AssetTypeFieldNumber = 2; private string assetType_ = ""; /// <summary> /// The type of this resource. Example: `compute.googleapis.com/Disk`. /// /// To search against the `asset_type`: /// /// * specify the `asset_type` field in your search request. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string AssetType { get { return assetType_; } set { assetType_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// <summary>Field number for the "project" field.</summary> public const int ProjectFieldNumber = 3; private string project_ = ""; /// <summary> /// The project that this resource belongs to, in the form of /// projects/{PROJECT_NUMBER}. /// /// To search against the `project`: /// /// * specify the `scope` field as this project in your search request. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Project { get { return project_; } set { project_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// <summary>Field number for the "display_name" field.</summary> public const int DisplayNameFieldNumber = 4; private string displayName_ = ""; /// <summary> /// The display name of this resource. /// /// To search against the `display_name`: /// /// * use a field query. Example: `displayName:"My Instance"` /// * use a free text query. Example: `"My Instance"` /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string DisplayName { get { return displayName_; } set { displayName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// <summary>Field number for the "description" field.</summary> public const int DescriptionFieldNumber = 5; private string description_ = ""; /// <summary> /// One or more paragraphs of text description of this resource. Maximum length /// could be up to 1M bytes. /// /// To search against the `description`: /// /// * use a field query. Example: `description:"*important instance*"` /// * use a free text query. Example: `"*important instance*"` /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Description { get { return description_; } set { description_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// <summary>Field number for the "location" field.</summary> public const int LocationFieldNumber = 6; private string location_ = ""; /// <summary> /// Location can be `global`, regional like `us-east1`, or zonal like /// `us-west1-b`. /// /// To search against the `location`: /// /// * use a field query. Example: `location:us-west*` /// * use a free text query. Example: `us-west*` /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Location { get { return location_; } set { location_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// <summary>Field number for the "labels" field.</summary> public const int LabelsFieldNumber = 7; private static readonly pbc::MapField<string, string>.Codec _map_labels_codec = new pbc::MapField<string, string>.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForString(18, ""), 58); private readonly pbc::MapField<string, string> labels_ = new pbc::MapField<string, string>(); /// <summary> /// Labels associated with this resource. See [Labelling and grouping GCP /// resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources) /// for more information. /// /// To search against the `labels`: /// /// * use a field query: /// - query on any label's key or value. Example: `labels:prod` /// - query by a given label. Example: `labels.env:prod` /// - query by a given label's existence. Example: `labels.env:*` /// * use a free text query. Example: `prod` /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField<string, string> Labels { get { return labels_; } } /// <summary>Field number for the "network_tags" field.</summary> public const int NetworkTagsFieldNumber = 8; private static readonly pb::FieldCodec<string> _repeated_networkTags_codec = pb::FieldCodec.ForString(66); private readonly pbc::RepeatedField<string> networkTags_ = new pbc::RepeatedField<string>(); /// <summary> /// Network tags associated with this resource. Like labels, network tags are a /// type of annotations used to group GCP resources. See [Labelling GCP /// resources](https://cloud.google.com/blog/products/gcp/labelling-and-grouping-your-google-cloud-platform-resources) /// for more information. /// /// To search against the `network_tags`: /// /// * use a field query. Example: `networkTags:internal` /// * use a free text query. Example: `internal` /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField<string> NetworkTags { get { return networkTags_; } } /// <summary>Field number for the "additional_attributes" field.</summary> public const int AdditionalAttributesFieldNumber = 9; private global::Google.Protobuf.WellKnownTypes.Struct additionalAttributes_; /// <summary> /// The additional searchable attributes of this resource. The attributes may /// vary from one resource type to another. Examples: `projectId` for Project, /// `dnsName` for DNS ManagedZone. This field contains a subset of the resource /// metadata fields that are returned by the List or Get APIs provided by the /// corresponding GCP service (e.g., Compute Engine). see [API references and /// supported searchable /// attributes](https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_asset_types) /// for more information. /// /// You can search values of these fields through free text search. However, /// you should not consume the field programically as the field names and /// values may change as the GCP service updates to a new incompatible API /// version. /// /// To search against the `additional_attributes`: /// /// * use a free text query to match the attributes values. Example: to search /// `additional_attributes = { dnsName: "foobar" }`, you can issue a query /// `foobar`. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Protobuf.WellKnownTypes.Struct AdditionalAttributes { get { return additionalAttributes_; } set { additionalAttributes_ = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as ResourceSearchResult); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(ResourceSearchResult other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } if (Name != other.Name) return false; if (AssetType != other.AssetType) return false; if (Project != other.Project) return false; if (DisplayName != other.DisplayName) return false; if (Description != other.Description) return false; if (Location != other.Location) return false; if (!Labels.Equals(other.Labels)) return false; if(!networkTags_.Equals(other.networkTags_)) return false; if (!object.Equals(AdditionalAttributes, other.AdditionalAttributes)) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); if (AssetType.Length != 0) hash ^= AssetType.GetHashCode(); if (Project.Length != 0) hash ^= Project.GetHashCode(); if (DisplayName.Length != 0) hash ^= DisplayName.GetHashCode(); if (Description.Length != 0) hash ^= Description.GetHashCode(); if (Location.Length != 0) hash ^= Location.GetHashCode(); hash ^= Labels.GetHashCode(); hash ^= networkTags_.GetHashCode(); if (additionalAttributes_ != null) hash ^= AdditionalAttributes.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return hash; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else if (Name.Length != 0) { output.WriteRawTag(10); output.WriteString(Name); } if (AssetType.Length != 0) { output.WriteRawTag(18); output.WriteString(AssetType); } if (Project.Length != 0) { output.WriteRawTag(26); output.WriteString(Project); } if (DisplayName.Length != 0) { output.WriteRawTag(34); output.WriteString(DisplayName); } if (Description.Length != 0) { output.WriteRawTag(42); output.WriteString(Description); } if (Location.Length != 0) { output.WriteRawTag(50); output.WriteString(Location); } labels_.WriteTo(output, _map_labels_codec); networkTags_.WriteTo(output, _repeated_networkTags_codec); if (additionalAttributes_ != null) { output.WriteRawTag(74); output.WriteMessage(AdditionalAttributes); } if (_unknownFields != null) { _unknownFields.WriteTo(output); } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { if (Name.Length != 0) { output.WriteRawTag(10); output.WriteString(Name); } if (AssetType.Length != 0) { output.WriteRawTag(18); output.WriteString(AssetType); } if (Project.Length != 0) { output.WriteRawTag(26); output.WriteString(Project); } if (DisplayName.Length != 0) { output.WriteRawTag(34); output.WriteString(DisplayName); } if (Description.Length != 0) { output.WriteRawTag(42); output.WriteString(Description); } if (Location.Length != 0) { output.WriteRawTag(50); output.WriteString(Location); } labels_.WriteTo(ref output, _map_labels_codec); networkTags_.WriteTo(ref output, _repeated_networkTags_codec); if (additionalAttributes_ != null) { output.WriteRawTag(74); output.WriteMessage(AdditionalAttributes); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } } #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Name.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); } if (AssetType.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(AssetType); } if (Project.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Project); } if (DisplayName.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(DisplayName); } if (Description.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Description); } if (Location.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Location); } size += labels_.CalculateSize(_map_labels_codec); size += networkTags_.CalculateSize(_repeated_networkTags_codec); if (additionalAttributes_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(AdditionalAttributes); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } return size; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(ResourceSearchResult other) { if (other == null) { return; } if (other.Name.Length != 0) { Name = other.Name; } if (other.AssetType.Length != 0) { AssetType = other.AssetType; } if (other.Project.Length != 0) { Project = other.Project; } if (other.DisplayName.Length != 0) { DisplayName = other.DisplayName; } if (other.Description.Length != 0) { Description = other.Description; } if (other.Location.Length != 0) { Location = other.Location; } labels_.Add(other.labels_); networkTags_.Add(other.networkTags_); if (other.additionalAttributes_ != null) { if (additionalAttributes_ == null) { AdditionalAttributes = new global::Google.Protobuf.WellKnownTypes.Struct(); } AdditionalAttributes.MergeFrom(other.AdditionalAttributes); } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE input.ReadRawMessage(this); #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Name = input.ReadString(); break; } case 18: { AssetType = input.ReadString(); break; } case 26: { Project = input.ReadString(); break; } case 34: { DisplayName = input.ReadString(); break; } case 42: { Description = input.ReadString(); break; } case 50: { Location = input.ReadString(); break; } case 58: { labels_.AddEntriesFrom(input, _map_labels_codec); break; } case 66: { networkTags_.AddEntriesFrom(input, _repeated_networkTags_codec); break; } case 74: { if (additionalAttributes_ == null) { AdditionalAttributes = new global::Google.Protobuf.WellKnownTypes.Struct(); } input.ReadMessage(AdditionalAttributes); break; } } } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { Name = input.ReadString(); break; } case 18: { AssetType = input.ReadString(); break; } case 26: { Project = input.ReadString(); break; } case 34: { DisplayName = input.ReadString(); break; } case 42: { Description = input.ReadString(); break; } case 50: { Location = input.ReadString(); break; } case 58: { labels_.AddEntriesFrom(ref input, _map_labels_codec); break; } case 66: { networkTags_.AddEntriesFrom(ref input, _repeated_networkTags_codec); break; } case 74: { if (additionalAttributes_ == null) { AdditionalAttributes = new global::Google.Protobuf.WellKnownTypes.Struct(); } input.ReadMessage(AdditionalAttributes); break; } } } } #endif } /// <summary> /// A result of IAM Policy search, containing information of an IAM policy. /// </summary> public sealed partial class IamPolicySearchResult : pb::IMessage<IamPolicySearchResult> #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { private static readonly pb::MessageParser<IamPolicySearchResult> _parser = new pb::MessageParser<IamPolicySearchResult>(() => new IamPolicySearchResult()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<IamPolicySearchResult> Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Cloud.Asset.V1.AssetsReflection.Descriptor.MessageTypes[5]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public IamPolicySearchResult() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public IamPolicySearchResult(IamPolicySearchResult other) : this() { resource_ = other.resource_; project_ = other.project_; policy_ = other.policy_ != null ? other.policy_.Clone() : null; explanation_ = other.explanation_ != null ? other.explanation_.Clone() : null; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public IamPolicySearchResult Clone() { return new IamPolicySearchResult(this); } /// <summary>Field number for the "resource" field.</summary> public const int ResourceFieldNumber = 1; private string resource_ = ""; /// <summary> /// The full resource name of the resource associated with this IAM policy. /// Example: /// `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. /// See [Cloud Asset Inventory Resource Name /// Format](https://cloud.google.com/asset-inventory/docs/resource-name-format) /// for more information. /// /// To search against the `resource`: /// /// * use a field query. Example: `resource:organizations/123` /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Resource { get { return resource_; } set { resource_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// <summary>Field number for the "project" field.</summary> public const int ProjectFieldNumber = 2; private string project_ = ""; /// <summary> /// The project that the associated GCP resource belongs to, in the form of /// projects/{PROJECT_NUMBER}. If an IAM policy is set on a resource (like VM /// instance, Cloud Storage bucket), the project field will indicate the /// project that contains the resource. If an IAM policy is set on a folder or /// orgnization, the project field will be empty. /// /// To search against the `project`: /// /// * specify the `scope` field as this project in your search request. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Project { get { return project_; } set { project_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// <summary>Field number for the "policy" field.</summary> public const int PolicyFieldNumber = 3; private global::Google.Cloud.Iam.V1.Policy policy_; /// <summary> /// The IAM policy directly set on the given resource. Note that the original /// IAM policy can contain multiple bindings. This only contains the bindings /// that match the given query. For queries that don't contain a constrain on /// policies (e.g., an empty query), this contains all the bindings. /// /// To search against the `policy` bindings: /// /// * use a field query: /// - query by the policy contained members. Example: /// `policy:amy@gmail.com` /// - query by the policy contained roles. Example: /// `policy:roles/compute.admin` /// - query by the policy contained roles' included permissions. Example: /// `policy.role.permissions:compute.instances.create` /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Cloud.Iam.V1.Policy Policy { get { return policy_; } set { policy_ = value; } } /// <summary>Field number for the "explanation" field.</summary> public const int ExplanationFieldNumber = 4; private global::Google.Cloud.Asset.V1.IamPolicySearchResult.Types.Explanation explanation_; /// <summary> /// Explanation about the IAM policy search result. It contains additional /// information to explain why the search result matches the query. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Cloud.Asset.V1.IamPolicySearchResult.Types.Explanation Explanation { get { return explanation_; } set { explanation_ = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as IamPolicySearchResult); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(IamPolicySearchResult other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } if (Resource != other.Resource) return false; if (Project != other.Project) return false; if (!object.Equals(Policy, other.Policy)) return false; if (!object.Equals(Explanation, other.Explanation)) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Resource.Length != 0) hash ^= Resource.GetHashCode(); if (Project.Length != 0) hash ^= Project.GetHashCode(); if (policy_ != null) hash ^= Policy.GetHashCode(); if (explanation_ != null) hash ^= Explanation.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return hash; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else if (Resource.Length != 0) { output.WriteRawTag(10); output.WriteString(Resource); } if (Project.Length != 0) { output.WriteRawTag(18); output.WriteString(Project); } if (policy_ != null) { output.WriteRawTag(26); output.WriteMessage(Policy); } if (explanation_ != null) { output.WriteRawTag(34); output.WriteMessage(Explanation); } if (_unknownFields != null) { _unknownFields.WriteTo(output); } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { if (Resource.Length != 0) { output.WriteRawTag(10); output.WriteString(Resource); } if (Project.Length != 0) { output.WriteRawTag(18); output.WriteString(Project); } if (policy_ != null) { output.WriteRawTag(26); output.WriteMessage(Policy); } if (explanation_ != null) { output.WriteRawTag(34); output.WriteMessage(Explanation); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } } #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Resource.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Resource); } if (Project.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Project); } if (policy_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Policy); } if (explanation_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(Explanation); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } return size; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(IamPolicySearchResult other) { if (other == null) { return; } if (other.Resource.Length != 0) { Resource = other.Resource; } if (other.Project.Length != 0) { Project = other.Project; } if (other.policy_ != null) { if (policy_ == null) { Policy = new global::Google.Cloud.Iam.V1.Policy(); } Policy.MergeFrom(other.Policy); } if (other.explanation_ != null) { if (explanation_ == null) { Explanation = new global::Google.Cloud.Asset.V1.IamPolicySearchResult.Types.Explanation(); } Explanation.MergeFrom(other.Explanation); } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE input.ReadRawMessage(this); #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Resource = input.ReadString(); break; } case 18: { Project = input.ReadString(); break; } case 26: { if (policy_ == null) { Policy = new global::Google.Cloud.Iam.V1.Policy(); } input.ReadMessage(Policy); break; } case 34: { if (explanation_ == null) { Explanation = new global::Google.Cloud.Asset.V1.IamPolicySearchResult.Types.Explanation(); } input.ReadMessage(Explanation); break; } } } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { Resource = input.ReadString(); break; } case 18: { Project = input.ReadString(); break; } case 26: { if (policy_ == null) { Policy = new global::Google.Cloud.Iam.V1.Policy(); } input.ReadMessage(Policy); break; } case 34: { if (explanation_ == null) { Explanation = new global::Google.Cloud.Asset.V1.IamPolicySearchResult.Types.Explanation(); } input.ReadMessage(Explanation); break; } } } } #endif #region Nested types /// <summary>Container for nested types declared in the IamPolicySearchResult message type.</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static partial class Types { /// <summary> /// Explanation about the IAM policy search result. /// </summary> public sealed partial class Explanation : pb::IMessage<Explanation> #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { private static readonly pb::MessageParser<Explanation> _parser = new pb::MessageParser<Explanation>(() => new Explanation()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<Explanation> Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Cloud.Asset.V1.IamPolicySearchResult.Descriptor.NestedTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Explanation() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Explanation(Explanation other) : this() { matchedPermissions_ = other.matchedPermissions_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Explanation Clone() { return new Explanation(this); } /// <summary>Field number for the "matched_permissions" field.</summary> public const int MatchedPermissionsFieldNumber = 1; private static readonly pbc::MapField<string, global::Google.Cloud.Asset.V1.IamPolicySearchResult.Types.Explanation.Types.Permissions>.Codec _map_matchedPermissions_codec = new pbc::MapField<string, global::Google.Cloud.Asset.V1.IamPolicySearchResult.Types.Explanation.Types.Permissions>.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::Google.Cloud.Asset.V1.IamPolicySearchResult.Types.Explanation.Types.Permissions.Parser), 10); private readonly pbc::MapField<string, global::Google.Cloud.Asset.V1.IamPolicySearchResult.Types.Explanation.Types.Permissions> matchedPermissions_ = new pbc::MapField<string, global::Google.Cloud.Asset.V1.IamPolicySearchResult.Types.Explanation.Types.Permissions>(); /// <summary> /// The map from roles to their included permissions that match the /// permission query (i.e., a query containing `policy.role.permissions:`). /// Example: if query `policy.role.permissions:compute.disk.get` /// matches a policy binding that contains owner role, the /// matched_permissions will be `{"roles/owner": ["compute.disk.get"]}`. The /// roles can also be found in the returned `policy` bindings. Note that the /// map is populated only for requests with permission queries. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::MapField<string, global::Google.Cloud.Asset.V1.IamPolicySearchResult.Types.Explanation.Types.Permissions> MatchedPermissions { get { return matchedPermissions_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as Explanation); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Explanation other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } if (!MatchedPermissions.Equals(other.MatchedPermissions)) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= MatchedPermissions.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return hash; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else matchedPermissions_.WriteTo(output, _map_matchedPermissions_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { matchedPermissions_.WriteTo(ref output, _map_matchedPermissions_codec); if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } } #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += matchedPermissions_.CalculateSize(_map_matchedPermissions_codec); if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } return size; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Explanation other) { if (other == null) { return; } matchedPermissions_.Add(other.matchedPermissions_); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE input.ReadRawMessage(this); #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { matchedPermissions_.AddEntriesFrom(input, _map_matchedPermissions_codec); break; } } } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { matchedPermissions_.AddEntriesFrom(ref input, _map_matchedPermissions_codec); break; } } } } #endif #region Nested types /// <summary>Container for nested types declared in the Explanation message type.</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static partial class Types { /// <summary> /// IAM permissions /// </summary> public sealed partial class Permissions : pb::IMessage<Permissions> #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { private static readonly pb::MessageParser<Permissions> _parser = new pb::MessageParser<Permissions>(() => new Permissions()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<Permissions> Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Cloud.Asset.V1.IamPolicySearchResult.Types.Explanation.Descriptor.NestedTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Permissions() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Permissions(Permissions other) : this() { permissions_ = other.permissions_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Permissions Clone() { return new Permissions(this); } /// <summary>Field number for the "permissions" field.</summary> public const int Permissions_FieldNumber = 1; private static readonly pb::FieldCodec<string> _repeated_permissions_codec = pb::FieldCodec.ForString(10); private readonly pbc::RepeatedField<string> permissions_ = new pbc::RepeatedField<string>(); /// <summary> /// A list of permissions. A sample permission string: `compute.disk.get`. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField<string> Permissions_ { get { return permissions_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as Permissions); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Permissions other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } if(!permissions_.Equals(other.permissions_)) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= permissions_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return hash; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else permissions_.WriteTo(output, _repeated_permissions_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { permissions_.WriteTo(ref output, _repeated_permissions_codec); if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } } #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += permissions_.CalculateSize(_repeated_permissions_codec); if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } return size; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Permissions other) { if (other == null) { return; } permissions_.Add(other.permissions_); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE input.ReadRawMessage(this); #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { permissions_.AddEntriesFrom(input, _repeated_permissions_codec); break; } } } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { permissions_.AddEntriesFrom(ref input, _repeated_permissions_codec); break; } } } } #endif } } #endregion } } #endregion } /// <summary> /// Represents the detailed state of an entity under analysis, such as a /// resource, an identity or an access. /// </summary> public sealed partial class IamPolicyAnalysisState : pb::IMessage<IamPolicyAnalysisState> #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { private static readonly pb::MessageParser<IamPolicyAnalysisState> _parser = new pb::MessageParser<IamPolicyAnalysisState>(() => new IamPolicyAnalysisState()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<IamPolicyAnalysisState> Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Cloud.Asset.V1.AssetsReflection.Descriptor.MessageTypes[6]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public IamPolicyAnalysisState() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public IamPolicyAnalysisState(IamPolicyAnalysisState other) : this() { code_ = other.code_; cause_ = other.cause_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public IamPolicyAnalysisState Clone() { return new IamPolicyAnalysisState(this); } /// <summary>Field number for the "code" field.</summary> public const int CodeFieldNumber = 1; private global::Google.Rpc.Code code_ = global::Google.Rpc.Code.Ok; /// <summary> /// The Google standard error code that best describes the state. /// For example: /// - OK means the analysis on this entity has been successfully finished; /// - PERMISSION_DENIED means an access denied error is encountered; /// - DEADLINE_EXCEEDED means the analysis on this entity hasn't been started /// in time; /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Rpc.Code Code { get { return code_; } set { code_ = value; } } /// <summary>Field number for the "cause" field.</summary> public const int CauseFieldNumber = 2; private string cause_ = ""; /// <summary> /// The human-readable description of the cause of failure. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Cause { get { return cause_; } set { cause_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as IamPolicyAnalysisState); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(IamPolicyAnalysisState other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } if (Code != other.Code) return false; if (Cause != other.Cause) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Code != global::Google.Rpc.Code.Ok) hash ^= Code.GetHashCode(); if (Cause.Length != 0) hash ^= Cause.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return hash; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else if (Code != global::Google.Rpc.Code.Ok) { output.WriteRawTag(8); output.WriteEnum((int) Code); } if (Cause.Length != 0) { output.WriteRawTag(18); output.WriteString(Cause); } if (_unknownFields != null) { _unknownFields.WriteTo(output); } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { if (Code != global::Google.Rpc.Code.Ok) { output.WriteRawTag(8); output.WriteEnum((int) Code); } if (Cause.Length != 0) { output.WriteRawTag(18); output.WriteString(Cause); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } } #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Code != global::Google.Rpc.Code.Ok) { size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Code); } if (Cause.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Cause); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } return size; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(IamPolicyAnalysisState other) { if (other == null) { return; } if (other.Code != global::Google.Rpc.Code.Ok) { Code = other.Code; } if (other.Cause.Length != 0) { Cause = other.Cause; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE input.ReadRawMessage(this); #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 8: { Code = (global::Google.Rpc.Code) input.ReadEnum(); break; } case 18: { Cause = input.ReadString(); break; } } } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 8: { Code = (global::Google.Rpc.Code) input.ReadEnum(); break; } case 18: { Cause = input.ReadString(); break; } } } } #endif } /// <summary> /// IAM Policy analysis result, consisting of one IAM policy binding and derived /// access control lists. /// </summary> public sealed partial class IamPolicyAnalysisResult : pb::IMessage<IamPolicyAnalysisResult> #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { private static readonly pb::MessageParser<IamPolicyAnalysisResult> _parser = new pb::MessageParser<IamPolicyAnalysisResult>(() => new IamPolicyAnalysisResult()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<IamPolicyAnalysisResult> Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Cloud.Asset.V1.AssetsReflection.Descriptor.MessageTypes[7]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public IamPolicyAnalysisResult() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public IamPolicyAnalysisResult(IamPolicyAnalysisResult other) : this() { attachedResourceFullName_ = other.attachedResourceFullName_; iamBinding_ = other.iamBinding_ != null ? other.iamBinding_.Clone() : null; accessControlLists_ = other.accessControlLists_.Clone(); identityList_ = other.identityList_ != null ? other.identityList_.Clone() : null; fullyExplored_ = other.fullyExplored_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public IamPolicyAnalysisResult Clone() { return new IamPolicyAnalysisResult(this); } /// <summary>Field number for the "attached_resource_full_name" field.</summary> public const int AttachedResourceFullNameFieldNumber = 1; private string attachedResourceFullName_ = ""; /// <summary> /// The [full resource /// name](https://cloud.google.com/asset-inventory/docs/resource-name-format) /// of the resource to which the [iam_binding][google.cloud.asset.v1.IamPolicyAnalysisResult.iam_binding] policy attaches. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string AttachedResourceFullName { get { return attachedResourceFullName_; } set { attachedResourceFullName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// <summary>Field number for the "iam_binding" field.</summary> public const int IamBindingFieldNumber = 2; private global::Google.Cloud.Iam.V1.Binding iamBinding_; /// <summary> /// The Cloud IAM policy binding under analysis. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Cloud.Iam.V1.Binding IamBinding { get { return iamBinding_; } set { iamBinding_ = value; } } /// <summary>Field number for the "access_control_lists" field.</summary> public const int AccessControlListsFieldNumber = 3; private static readonly pb::FieldCodec<global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.AccessControlList> _repeated_accessControlLists_codec = pb::FieldCodec.ForMessage(26, global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.AccessControlList.Parser); private readonly pbc::RepeatedField<global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.AccessControlList> accessControlLists_ = new pbc::RepeatedField<global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.AccessControlList>(); /// <summary> /// The access control lists derived from the [iam_binding][google.cloud.asset.v1.IamPolicyAnalysisResult.iam_binding] that match or /// potentially match resource and access selectors specified in the request. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField<global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.AccessControlList> AccessControlLists { get { return accessControlLists_; } } /// <summary>Field number for the "identity_list" field.</summary> public const int IdentityListFieldNumber = 4; private global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.IdentityList identityList_; /// <summary> /// The identity list derived from members of the [iam_binding][google.cloud.asset.v1.IamPolicyAnalysisResult.iam_binding] that match or /// potentially match identity selector specified in the request. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.IdentityList IdentityList { get { return identityList_; } set { identityList_ = value; } } /// <summary>Field number for the "fully_explored" field.</summary> public const int FullyExploredFieldNumber = 5; private bool fullyExplored_; /// <summary> /// Represents whether all analyses on the [iam_binding][google.cloud.asset.v1.IamPolicyAnalysisResult.iam_binding] have successfully /// finished. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool FullyExplored { get { return fullyExplored_; } set { fullyExplored_ = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as IamPolicyAnalysisResult); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(IamPolicyAnalysisResult other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } if (AttachedResourceFullName != other.AttachedResourceFullName) return false; if (!object.Equals(IamBinding, other.IamBinding)) return false; if(!accessControlLists_.Equals(other.accessControlLists_)) return false; if (!object.Equals(IdentityList, other.IdentityList)) return false; if (FullyExplored != other.FullyExplored) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (AttachedResourceFullName.Length != 0) hash ^= AttachedResourceFullName.GetHashCode(); if (iamBinding_ != null) hash ^= IamBinding.GetHashCode(); hash ^= accessControlLists_.GetHashCode(); if (identityList_ != null) hash ^= IdentityList.GetHashCode(); if (FullyExplored != false) hash ^= FullyExplored.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return hash; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else if (AttachedResourceFullName.Length != 0) { output.WriteRawTag(10); output.WriteString(AttachedResourceFullName); } if (iamBinding_ != null) { output.WriteRawTag(18); output.WriteMessage(IamBinding); } accessControlLists_.WriteTo(output, _repeated_accessControlLists_codec); if (identityList_ != null) { output.WriteRawTag(34); output.WriteMessage(IdentityList); } if (FullyExplored != false) { output.WriteRawTag(40); output.WriteBool(FullyExplored); } if (_unknownFields != null) { _unknownFields.WriteTo(output); } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { if (AttachedResourceFullName.Length != 0) { output.WriteRawTag(10); output.WriteString(AttachedResourceFullName); } if (iamBinding_ != null) { output.WriteRawTag(18); output.WriteMessage(IamBinding); } accessControlLists_.WriteTo(ref output, _repeated_accessControlLists_codec); if (identityList_ != null) { output.WriteRawTag(34); output.WriteMessage(IdentityList); } if (FullyExplored != false) { output.WriteRawTag(40); output.WriteBool(FullyExplored); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } } #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (AttachedResourceFullName.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(AttachedResourceFullName); } if (iamBinding_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(IamBinding); } size += accessControlLists_.CalculateSize(_repeated_accessControlLists_codec); if (identityList_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(IdentityList); } if (FullyExplored != false) { size += 1 + 1; } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } return size; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(IamPolicyAnalysisResult other) { if (other == null) { return; } if (other.AttachedResourceFullName.Length != 0) { AttachedResourceFullName = other.AttachedResourceFullName; } if (other.iamBinding_ != null) { if (iamBinding_ == null) { IamBinding = new global::Google.Cloud.Iam.V1.Binding(); } IamBinding.MergeFrom(other.IamBinding); } accessControlLists_.Add(other.accessControlLists_); if (other.identityList_ != null) { if (identityList_ == null) { IdentityList = new global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.IdentityList(); } IdentityList.MergeFrom(other.IdentityList); } if (other.FullyExplored != false) { FullyExplored = other.FullyExplored; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE input.ReadRawMessage(this); #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { AttachedResourceFullName = input.ReadString(); break; } case 18: { if (iamBinding_ == null) { IamBinding = new global::Google.Cloud.Iam.V1.Binding(); } input.ReadMessage(IamBinding); break; } case 26: { accessControlLists_.AddEntriesFrom(input, _repeated_accessControlLists_codec); break; } case 34: { if (identityList_ == null) { IdentityList = new global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.IdentityList(); } input.ReadMessage(IdentityList); break; } case 40: { FullyExplored = input.ReadBool(); break; } } } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { AttachedResourceFullName = input.ReadString(); break; } case 18: { if (iamBinding_ == null) { IamBinding = new global::Google.Cloud.Iam.V1.Binding(); } input.ReadMessage(IamBinding); break; } case 26: { accessControlLists_.AddEntriesFrom(ref input, _repeated_accessControlLists_codec); break; } case 34: { if (identityList_ == null) { IdentityList = new global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.IdentityList(); } input.ReadMessage(IdentityList); break; } case 40: { FullyExplored = input.ReadBool(); break; } } } } #endif #region Nested types /// <summary>Container for nested types declared in the IamPolicyAnalysisResult message type.</summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static partial class Types { /// <summary> /// A Google Cloud resource under analysis. /// </summary> public sealed partial class Resource : pb::IMessage<Resource> #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { private static readonly pb::MessageParser<Resource> _parser = new pb::MessageParser<Resource>(() => new Resource()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<Resource> Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Descriptor.NestedTypes[0]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Resource() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Resource(Resource other) : this() { fullResourceName_ = other.fullResourceName_; analysisState_ = other.analysisState_ != null ? other.analysisState_.Clone() : null; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Resource Clone() { return new Resource(this); } /// <summary>Field number for the "full_resource_name" field.</summary> public const int FullResourceNameFieldNumber = 1; private string fullResourceName_ = ""; /// <summary> /// The [full resource /// name](https://cloud.google.com/asset-inventory/docs/resource-name-format) /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string FullResourceName { get { return fullResourceName_; } set { fullResourceName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// <summary>Field number for the "analysis_state" field.</summary> public const int AnalysisStateFieldNumber = 2; private global::Google.Cloud.Asset.V1.IamPolicyAnalysisState analysisState_; /// <summary> /// The analysis state of this resource. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Cloud.Asset.V1.IamPolicyAnalysisState AnalysisState { get { return analysisState_; } set { analysisState_ = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as Resource); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Resource other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } if (FullResourceName != other.FullResourceName) return false; if (!object.Equals(AnalysisState, other.AnalysisState)) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (FullResourceName.Length != 0) hash ^= FullResourceName.GetHashCode(); if (analysisState_ != null) hash ^= AnalysisState.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return hash; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else if (FullResourceName.Length != 0) { output.WriteRawTag(10); output.WriteString(FullResourceName); } if (analysisState_ != null) { output.WriteRawTag(18); output.WriteMessage(AnalysisState); } if (_unknownFields != null) { _unknownFields.WriteTo(output); } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { if (FullResourceName.Length != 0) { output.WriteRawTag(10); output.WriteString(FullResourceName); } if (analysisState_ != null) { output.WriteRawTag(18); output.WriteMessage(AnalysisState); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } } #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (FullResourceName.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(FullResourceName); } if (analysisState_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(AnalysisState); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } return size; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Resource other) { if (other == null) { return; } if (other.FullResourceName.Length != 0) { FullResourceName = other.FullResourceName; } if (other.analysisState_ != null) { if (analysisState_ == null) { AnalysisState = new global::Google.Cloud.Asset.V1.IamPolicyAnalysisState(); } AnalysisState.MergeFrom(other.AnalysisState); } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE input.ReadRawMessage(this); #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { FullResourceName = input.ReadString(); break; } case 18: { if (analysisState_ == null) { AnalysisState = new global::Google.Cloud.Asset.V1.IamPolicyAnalysisState(); } input.ReadMessage(AnalysisState); break; } } } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { FullResourceName = input.ReadString(); break; } case 18: { if (analysisState_ == null) { AnalysisState = new global::Google.Cloud.Asset.V1.IamPolicyAnalysisState(); } input.ReadMessage(AnalysisState); break; } } } } #endif } /// <summary> /// An IAM role or permission under analysis. /// </summary> public sealed partial class Access : pb::IMessage<Access> #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { private static readonly pb::MessageParser<Access> _parser = new pb::MessageParser<Access>(() => new Access()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<Access> Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Descriptor.NestedTypes[1]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Access() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Access(Access other) : this() { analysisState_ = other.analysisState_ != null ? other.analysisState_.Clone() : null; switch (other.OneofAccessCase) { case OneofAccessOneofCase.Role: Role = other.Role; break; case OneofAccessOneofCase.Permission: Permission = other.Permission; break; } _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Access Clone() { return new Access(this); } /// <summary>Field number for the "role" field.</summary> public const int RoleFieldNumber = 1; /// <summary> /// The role. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Role { get { return oneofAccessCase_ == OneofAccessOneofCase.Role ? (string) oneofAccess_ : ""; } set { oneofAccess_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); oneofAccessCase_ = OneofAccessOneofCase.Role; } } /// <summary>Field number for the "permission" field.</summary> public const int PermissionFieldNumber = 2; /// <summary> /// The permission. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Permission { get { return oneofAccessCase_ == OneofAccessOneofCase.Permission ? (string) oneofAccess_ : ""; } set { oneofAccess_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); oneofAccessCase_ = OneofAccessOneofCase.Permission; } } /// <summary>Field number for the "analysis_state" field.</summary> public const int AnalysisStateFieldNumber = 3; private global::Google.Cloud.Asset.V1.IamPolicyAnalysisState analysisState_; /// <summary> /// The analysis state of this access. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Cloud.Asset.V1.IamPolicyAnalysisState AnalysisState { get { return analysisState_; } set { analysisState_ = value; } } private object oneofAccess_; /// <summary>Enum of possible cases for the "oneof_access" oneof.</summary> public enum OneofAccessOneofCase { None = 0, Role = 1, Permission = 2, } private OneofAccessOneofCase oneofAccessCase_ = OneofAccessOneofCase.None; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public OneofAccessOneofCase OneofAccessCase { get { return oneofAccessCase_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void ClearOneofAccess() { oneofAccessCase_ = OneofAccessOneofCase.None; oneofAccess_ = null; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as Access); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Access other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } if (Role != other.Role) return false; if (Permission != other.Permission) return false; if (!object.Equals(AnalysisState, other.AnalysisState)) return false; if (OneofAccessCase != other.OneofAccessCase) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (oneofAccessCase_ == OneofAccessOneofCase.Role) hash ^= Role.GetHashCode(); if (oneofAccessCase_ == OneofAccessOneofCase.Permission) hash ^= Permission.GetHashCode(); if (analysisState_ != null) hash ^= AnalysisState.GetHashCode(); hash ^= (int) oneofAccessCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return hash; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else if (oneofAccessCase_ == OneofAccessOneofCase.Role) { output.WriteRawTag(10); output.WriteString(Role); } if (oneofAccessCase_ == OneofAccessOneofCase.Permission) { output.WriteRawTag(18); output.WriteString(Permission); } if (analysisState_ != null) { output.WriteRawTag(26); output.WriteMessage(AnalysisState); } if (_unknownFields != null) { _unknownFields.WriteTo(output); } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { if (oneofAccessCase_ == OneofAccessOneofCase.Role) { output.WriteRawTag(10); output.WriteString(Role); } if (oneofAccessCase_ == OneofAccessOneofCase.Permission) { output.WriteRawTag(18); output.WriteString(Permission); } if (analysisState_ != null) { output.WriteRawTag(26); output.WriteMessage(AnalysisState); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } } #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (oneofAccessCase_ == OneofAccessOneofCase.Role) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Role); } if (oneofAccessCase_ == OneofAccessOneofCase.Permission) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Permission); } if (analysisState_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(AnalysisState); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } return size; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Access other) { if (other == null) { return; } if (other.analysisState_ != null) { if (analysisState_ == null) { AnalysisState = new global::Google.Cloud.Asset.V1.IamPolicyAnalysisState(); } AnalysisState.MergeFrom(other.AnalysisState); } switch (other.OneofAccessCase) { case OneofAccessOneofCase.Role: Role = other.Role; break; case OneofAccessOneofCase.Permission: Permission = other.Permission; break; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE input.ReadRawMessage(this); #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Role = input.ReadString(); break; } case 18: { Permission = input.ReadString(); break; } case 26: { if (analysisState_ == null) { AnalysisState = new global::Google.Cloud.Asset.V1.IamPolicyAnalysisState(); } input.ReadMessage(AnalysisState); break; } } } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { Role = input.ReadString(); break; } case 18: { Permission = input.ReadString(); break; } case 26: { if (analysisState_ == null) { AnalysisState = new global::Google.Cloud.Asset.V1.IamPolicyAnalysisState(); } input.ReadMessage(AnalysisState); break; } } } } #endif } /// <summary> /// An identity under analysis. /// </summary> public sealed partial class Identity : pb::IMessage<Identity> #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { private static readonly pb::MessageParser<Identity> _parser = new pb::MessageParser<Identity>(() => new Identity()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<Identity> Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Descriptor.NestedTypes[2]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Identity() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Identity(Identity other) : this() { name_ = other.name_; analysisState_ = other.analysisState_ != null ? other.analysisState_.Clone() : null; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Identity Clone() { return new Identity(this); } /// <summary>Field number for the "name" field.</summary> public const int NameFieldNumber = 1; private string name_ = ""; /// <summary> /// The identity name in any form of members appear in /// [IAM policy /// binding](https://cloud.google.com/iam/reference/rest/v1/Binding), such /// as: /// - user:foo@google.com /// - group:group1@google.com /// - serviceAccount:s1@prj1.iam.gserviceaccount.com /// - projectOwner:some_project_id /// - domain:google.com /// - allUsers /// - etc. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { get { return name_; } set { name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// <summary>Field number for the "analysis_state" field.</summary> public const int AnalysisStateFieldNumber = 2; private global::Google.Cloud.Asset.V1.IamPolicyAnalysisState analysisState_; /// <summary> /// The analysis state of this identity. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Google.Cloud.Asset.V1.IamPolicyAnalysisState AnalysisState { get { return analysisState_; } set { analysisState_ = value; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as Identity); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Identity other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } if (Name != other.Name) return false; if (!object.Equals(AnalysisState, other.AnalysisState)) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (Name.Length != 0) hash ^= Name.GetHashCode(); if (analysisState_ != null) hash ^= AnalysisState.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return hash; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else if (Name.Length != 0) { output.WriteRawTag(10); output.WriteString(Name); } if (analysisState_ != null) { output.WriteRawTag(18); output.WriteMessage(AnalysisState); } if (_unknownFields != null) { _unknownFields.WriteTo(output); } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { if (Name.Length != 0) { output.WriteRawTag(10); output.WriteString(Name); } if (analysisState_ != null) { output.WriteRawTag(18); output.WriteMessage(AnalysisState); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } } #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (Name.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); } if (analysisState_ != null) { size += 1 + pb::CodedOutputStream.ComputeMessageSize(AnalysisState); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } return size; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Identity other) { if (other == null) { return; } if (other.Name.Length != 0) { Name = other.Name; } if (other.analysisState_ != null) { if (analysisState_ == null) { AnalysisState = new global::Google.Cloud.Asset.V1.IamPolicyAnalysisState(); } AnalysisState.MergeFrom(other.AnalysisState); } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE input.ReadRawMessage(this); #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { Name = input.ReadString(); break; } case 18: { if (analysisState_ == null) { AnalysisState = new global::Google.Cloud.Asset.V1.IamPolicyAnalysisState(); } input.ReadMessage(AnalysisState); break; } } } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { Name = input.ReadString(); break; } case 18: { if (analysisState_ == null) { AnalysisState = new global::Google.Cloud.Asset.V1.IamPolicyAnalysisState(); } input.ReadMessage(AnalysisState); break; } } } } #endif } /// <summary> /// A directional edge. /// </summary> public sealed partial class Edge : pb::IMessage<Edge> #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { private static readonly pb::MessageParser<Edge> _parser = new pb::MessageParser<Edge>(() => new Edge()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<Edge> Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Descriptor.NestedTypes[3]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Edge() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Edge(Edge other) : this() { sourceNode_ = other.sourceNode_; targetNode_ = other.targetNode_; _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public Edge Clone() { return new Edge(this); } /// <summary>Field number for the "source_node" field.</summary> public const int SourceNodeFieldNumber = 1; private string sourceNode_ = ""; /// <summary> /// The source node of the edge. For example, it could be a full resource /// name for a resource node or an email of an identity. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string SourceNode { get { return sourceNode_; } set { sourceNode_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } /// <summary>Field number for the "target_node" field.</summary> public const int TargetNodeFieldNumber = 2; private string targetNode_ = ""; /// <summary> /// The target node of the edge. For example, it could be a full resource /// name for a resource node or an email of an identity. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string TargetNode { get { return targetNode_; } set { targetNode_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as Edge); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(Edge other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } if (SourceNode != other.SourceNode) return false; if (TargetNode != other.TargetNode) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; if (SourceNode.Length != 0) hash ^= SourceNode.GetHashCode(); if (TargetNode.Length != 0) hash ^= TargetNode.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return hash; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else if (SourceNode.Length != 0) { output.WriteRawTag(10); output.WriteString(SourceNode); } if (TargetNode.Length != 0) { output.WriteRawTag(18); output.WriteString(TargetNode); } if (_unknownFields != null) { _unknownFields.WriteTo(output); } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { if (SourceNode.Length != 0) { output.WriteRawTag(10); output.WriteString(SourceNode); } if (TargetNode.Length != 0) { output.WriteRawTag(18); output.WriteString(TargetNode); } if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } } #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; if (SourceNode.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(SourceNode); } if (TargetNode.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(TargetNode); } if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } return size; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(Edge other) { if (other == null) { return; } if (other.SourceNode.Length != 0) { SourceNode = other.SourceNode; } if (other.TargetNode.Length != 0) { TargetNode = other.TargetNode; } _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE input.ReadRawMessage(this); #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { SourceNode = input.ReadString(); break; } case 18: { TargetNode = input.ReadString(); break; } } } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { SourceNode = input.ReadString(); break; } case 18: { TargetNode = input.ReadString(); break; } } } } #endif } /// <summary> /// An access control list, derived from the above IAM policy binding, which /// contains a set of resources and accesses. May include one /// item from each set to compose an access control entry. /// /// NOTICE that there could be multiple access control lists for one IAM policy /// binding. The access control lists are created based on resource and access /// combinations. /// /// For example, assume we have the following cases in one IAM policy binding: /// - Permission P1 and P2 apply to resource R1 and R2; /// - Permission P3 applies to resource R2 and R3; /// /// This will result in the following access control lists: /// - AccessControlList 1: [R1, R2], [P1, P2] /// - AccessControlList 2: [R2, R3], [P3] /// </summary> public sealed partial class AccessControlList : pb::IMessage<AccessControlList> #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { private static readonly pb::MessageParser<AccessControlList> _parser = new pb::MessageParser<AccessControlList>(() => new AccessControlList()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<AccessControlList> Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Descriptor.NestedTypes[4]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public AccessControlList() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public AccessControlList(AccessControlList other) : this() { resources_ = other.resources_.Clone(); accesses_ = other.accesses_.Clone(); resourceEdges_ = other.resourceEdges_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public AccessControlList Clone() { return new AccessControlList(this); } /// <summary>Field number for the "resources" field.</summary> public const int ResourcesFieldNumber = 1; private static readonly pb::FieldCodec<global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.Resource> _repeated_resources_codec = pb::FieldCodec.ForMessage(10, global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.Resource.Parser); private readonly pbc::RepeatedField<global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.Resource> resources_ = new pbc::RepeatedField<global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.Resource>(); /// <summary> /// The resources that match one of the following conditions: /// - The resource_selector, if it is specified in request; /// - Otherwise, resources reachable from the policy attached resource. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField<global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.Resource> Resources { get { return resources_; } } /// <summary>Field number for the "accesses" field.</summary> public const int AccessesFieldNumber = 2; private static readonly pb::FieldCodec<global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.Access> _repeated_accesses_codec = pb::FieldCodec.ForMessage(18, global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.Access.Parser); private readonly pbc::RepeatedField<global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.Access> accesses_ = new pbc::RepeatedField<global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.Access>(); /// <summary> /// The accesses that match one of the following conditions: /// - The access_selector, if it is specified in request; /// - Otherwise, access specifiers reachable from the policy binding's role. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField<global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.Access> Accesses { get { return accesses_; } } /// <summary>Field number for the "resource_edges" field.</summary> public const int ResourceEdgesFieldNumber = 3; private static readonly pb::FieldCodec<global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.Edge> _repeated_resourceEdges_codec = pb::FieldCodec.ForMessage(26, global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.Edge.Parser); private readonly pbc::RepeatedField<global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.Edge> resourceEdges_ = new pbc::RepeatedField<global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.Edge>(); /// <summary> /// Resource edges of the graph starting from the policy attached /// resource to any descendant resources. The [Edge.source_node][google.cloud.asset.v1.IamPolicyAnalysisResult.Edge.source_node] contains /// the full resource name of a parent resource and [Edge.target_node][google.cloud.asset.v1.IamPolicyAnalysisResult.Edge.target_node] /// contains the full resource name of a child resource. This field is /// present only if the output_resource_edges option is enabled in request. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField<global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.Edge> ResourceEdges { get { return resourceEdges_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as AccessControlList); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(AccessControlList other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } if(!resources_.Equals(other.resources_)) return false; if(!accesses_.Equals(other.accesses_)) return false; if(!resourceEdges_.Equals(other.resourceEdges_)) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= resources_.GetHashCode(); hash ^= accesses_.GetHashCode(); hash ^= resourceEdges_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return hash; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else resources_.WriteTo(output, _repeated_resources_codec); accesses_.WriteTo(output, _repeated_accesses_codec); resourceEdges_.WriteTo(output, _repeated_resourceEdges_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { resources_.WriteTo(ref output, _repeated_resources_codec); accesses_.WriteTo(ref output, _repeated_accesses_codec); resourceEdges_.WriteTo(ref output, _repeated_resourceEdges_codec); if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } } #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += resources_.CalculateSize(_repeated_resources_codec); size += accesses_.CalculateSize(_repeated_accesses_codec); size += resourceEdges_.CalculateSize(_repeated_resourceEdges_codec); if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } return size; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(AccessControlList other) { if (other == null) { return; } resources_.Add(other.resources_); accesses_.Add(other.accesses_); resourceEdges_.Add(other.resourceEdges_); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE input.ReadRawMessage(this); #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { resources_.AddEntriesFrom(input, _repeated_resources_codec); break; } case 18: { accesses_.AddEntriesFrom(input, _repeated_accesses_codec); break; } case 26: { resourceEdges_.AddEntriesFrom(input, _repeated_resourceEdges_codec); break; } } } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { resources_.AddEntriesFrom(ref input, _repeated_resources_codec); break; } case 18: { accesses_.AddEntriesFrom(ref input, _repeated_accesses_codec); break; } case 26: { resourceEdges_.AddEntriesFrom(ref input, _repeated_resourceEdges_codec); break; } } } } #endif } /// <summary> /// The identities and group edges. /// </summary> public sealed partial class IdentityList : pb::IMessage<IdentityList> #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE , pb::IBufferMessage #endif { private static readonly pb::MessageParser<IdentityList> _parser = new pb::MessageParser<IdentityList>(() => new IdentityList()); private pb::UnknownFieldSet _unknownFields; [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pb::MessageParser<IdentityList> Parser { get { return _parser; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { get { return global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Descriptor.NestedTypes[5]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] pbr::MessageDescriptor pb::IMessage.Descriptor { get { return Descriptor; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public IdentityList() { OnConstruction(); } partial void OnConstruction(); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public IdentityList(IdentityList other) : this() { identities_ = other.identities_.Clone(); groupEdges_ = other.groupEdges_.Clone(); _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public IdentityList Clone() { return new IdentityList(this); } /// <summary>Field number for the "identities" field.</summary> public const int IdentitiesFieldNumber = 1; private static readonly pb::FieldCodec<global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.Identity> _repeated_identities_codec = pb::FieldCodec.ForMessage(10, global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.Identity.Parser); private readonly pbc::RepeatedField<global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.Identity> identities_ = new pbc::RepeatedField<global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.Identity>(); /// <summary> /// Only the identities that match one of the following conditions will be /// presented: /// - The identity_selector, if it is specified in request; /// - Otherwise, identities reachable from the policy binding's members. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField<global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.Identity> Identities { get { return identities_; } } /// <summary>Field number for the "group_edges" field.</summary> public const int GroupEdgesFieldNumber = 2; private static readonly pb::FieldCodec<global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.Edge> _repeated_groupEdges_codec = pb::FieldCodec.ForMessage(18, global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.Edge.Parser); private readonly pbc::RepeatedField<global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.Edge> groupEdges_ = new pbc::RepeatedField<global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.Edge>(); /// <summary> /// Group identity edges of the graph starting from the binding's /// group members to any node of the [identities][google.cloud.asset.v1.IamPolicyAnalysisResult.IdentityList.identities]. The [Edge.source_node][google.cloud.asset.v1.IamPolicyAnalysisResult.Edge.source_node] /// contains a group, such as `group:parent@google.com`. The /// [Edge.target_node][google.cloud.asset.v1.IamPolicyAnalysisResult.Edge.target_node] contains a member of the group, /// such as `group:child@google.com` or `user:foo@google.com`. /// This field is present only if the output_group_edges option is enabled in /// request. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField<global::Google.Cloud.Asset.V1.IamPolicyAnalysisResult.Types.Edge> GroupEdges { get { return groupEdges_; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as IdentityList); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Equals(IdentityList other) { if (ReferenceEquals(other, null)) { return false; } if (ReferenceEquals(other, this)) { return true; } if(!identities_.Equals(other.identities_)) return false; if(!groupEdges_.Equals(other.groupEdges_)) return false; return Equals(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override int GetHashCode() { int hash = 1; hash ^= identities_.GetHashCode(); hash ^= groupEdges_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return hash; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override string ToString() { return pb::JsonFormatter.ToDiagnosticString(this); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void WriteTo(pb::CodedOutputStream output) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE output.WriteRawMessage(this); #else identities_.WriteTo(output, _repeated_identities_codec); groupEdges_.WriteTo(output, _repeated_groupEdges_codec); if (_unknownFields != null) { _unknownFields.WriteTo(output); } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { identities_.WriteTo(ref output, _repeated_identities_codec); groupEdges_.WriteTo(ref output, _repeated_groupEdges_codec); if (_unknownFields != null) { _unknownFields.WriteTo(ref output); } } #endif [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CalculateSize() { int size = 0; size += identities_.CalculateSize(_repeated_identities_codec); size += groupEdges_.CalculateSize(_repeated_groupEdges_codec); if (_unknownFields != null) { size += _unknownFields.CalculateSize(); } return size; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(IdentityList other) { if (other == null) { return; } identities_.Add(other.identities_); groupEdges_.Add(other.groupEdges_); _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public void MergeFrom(pb::CodedInputStream input) { #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE input.ReadRawMessage(this); #else uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); break; case 10: { identities_.AddEntriesFrom(input, _repeated_identities_codec); break; } case 18: { groupEdges_.AddEntriesFrom(input, _repeated_groupEdges_codec); break; } } } #endif } #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE [global::System.Diagnostics.DebuggerNonUserCodeAttribute] void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { uint tag; while ((tag = input.ReadTag()) != 0) { switch(tag) { default: _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); break; case 10: { identities_.AddEntriesFrom(ref input, _repeated_identities_codec); break; } case 18: { groupEdges_.AddEntriesFrom(ref input, _repeated_groupEdges_codec); break; } } } } #endif } } #endregion } #endregion } #endregion Designer generated code
38.806695
833
0.634037
[ "Apache-2.0" ]
Global19/google-cloud-dotnet
apis/Google.Cloud.Asset.V1/Google.Cloud.Asset.V1/Assets.cs
200,553
C#
// Copyright (c) Six Labors and contributors. // Licensed under the GNU Affero General Public License, Version 3. using System; namespace SixLabors.ImageSharp.Metadata.Profiles.Icc { /// <summary> /// This type represents an array of doubles (from 32bit values). /// </summary> internal sealed class IccUFix16ArrayTagDataEntry : IccTagDataEntry, IEquatable<IccUFix16ArrayTagDataEntry> { /// <summary> /// Initializes a new instance of the <see cref="IccUFix16ArrayTagDataEntry"/> class. /// </summary> /// <param name="data">The array data</param> public IccUFix16ArrayTagDataEntry(float[] data) : this(data, IccProfileTag.Unknown) { } /// <summary> /// Initializes a new instance of the <see cref="IccUFix16ArrayTagDataEntry"/> class. /// </summary> /// <param name="data">The array data</param> /// <param name="tagSignature">Tag Signature</param> public IccUFix16ArrayTagDataEntry(float[] data, IccProfileTag tagSignature) : base(IccTypeSignature.U16Fixed16Array, tagSignature) { this.Data = data ?? throw new ArgumentNullException(nameof(data)); } /// <summary> /// Gets the array data. /// </summary> public float[] Data { get; } /// <inheritdoc/> public override bool Equals(IccTagDataEntry other) { return other is IccUFix16ArrayTagDataEntry entry && this.Equals(entry); } /// <inheritdoc/> public bool Equals(IccUFix16ArrayTagDataEntry other) { if (other is null) { return false; } if (ReferenceEquals(this, other)) { return true; } return base.Equals(other) && this.Data.AsSpan().SequenceEqual(other.Data); } /// <inheritdoc/> public override bool Equals(object obj) { return obj is IccUFix16ArrayTagDataEntry other && this.Equals(other); } /// <inheritdoc/> public override int GetHashCode() => HashCode.Combine(this.Signature, this.Data); } }
32.289855
110
0.585278
[ "Apache-2.0" ]
fahadabdulaziz/ImageSharp
src/ImageSharp/Metadata/Profiles/ICC/TagDataEntries/IccUFix16ArrayTagDataEntry.cs
2,230
C#
namespace TeamBuilder.Data.Configs { using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; using Models; public class InvitationConfig : IEntityTypeConfiguration<Invitation> { public void Configure(EntityTypeBuilder<Invitation> builder) { builder.HasKey(i => i.Id); builder.HasOne(i => i.InvitedUser) .WithMany(u => u.Invitations) .HasForeignKey(i => i.InvitedUserId) .OnDelete(DeleteBehavior.Restrict); builder.HasOne(i => i.Team) .WithMany(t => t.Invitations) .HasForeignKey(i => i.TeamId); } } }
29.375
72
0.597163
[ "MIT" ]
pirocorp/Databases-Advanced---Entity-Framework
12. Workshops/Team Builder/TeamBuilder/TeamBuilder.Data/Configs/InvitationConfig.cs
707
C#
using System; using System.Globalization; using System.Linq; using System.Text.RegularExpressions; using System.Web; using System.IO; namespace BlogEngine.Core.Web { /// <summary> /// URL rewrite rules /// </summary> public class UrlRules { #region Constants and Fields /// <summary> /// The Year Regex. /// </summary> private static readonly Regex YearRegex = new Regex( "/([0-9][0-9][0-9][0-9])/", RegexOptions.IgnoreCase | RegexOptions.Compiled); /// <summary> /// The Year Month Regex. /// </summary> private static readonly Regex YearMonthRegex = new Regex( "/([0-9][0-9][0-9][0-9])/([0-1][0-9])/", RegexOptions.IgnoreCase | RegexOptions.Compiled); /// <summary> /// The Year Month Day Regex. /// </summary> private static readonly Regex YearMonthDayRegex = new Regex( "/([0-9][0-9][0-9][0-9])/([0-1][0-9])/([0-3][0-9])/", RegexOptions.IgnoreCase | RegexOptions.Compiled); #endregion #region Rules /// <summary> /// Rewrites the post. /// </summary> /// <param name="context">The context.</param> /// <param name="url">The URL string.</param> public static void RewritePost(HttpContext context, string url) { int year, month, day; var haveDate = ExtractDate(context, out year, out month, out day); var slug = ExtractTitle(context, url); // Allow for Year/Month only dates in URL (in this case, day == 0), as well as Year/Month/Day dates. // first make sure the Year and Month match. // if a day is also available, make sure the Day matches. var post = Post.ApplicablePosts.Find( p => (!haveDate || (p.DateCreated.Year == year && p.DateCreated.Month == month)) && ((!haveDate || (day == 0 || p.DateCreated.Day == day)) && slug.Equals(Utils.RemoveIllegalCharacters(p.Slug), StringComparison.OrdinalIgnoreCase))); if (post == null) { return; } var q = GetQueryString(context); if (q.Contains("id=" + post.Id, StringComparison.OrdinalIgnoreCase)) q = string.Format("{0}post.aspx?{1}", Utils.ApplicationRelativeWebRoot, q); else q = string.Format("{0}post.aspx?id={1}{2}", Utils.ApplicationRelativeWebRoot, post.Id, q); context.RewritePath( url.Contains("/FEED/") ? string.Format("syndication.axd?post={0}{1}", post.Id, GetQueryString(context)) : q, false); } /// <summary> /// Rewrites the page. /// </summary> /// <param name="context">The context.</param> /// <param name="url">The URL string.</param> public static void RewritePage(HttpContext context, string url) { var slug = ExtractTitle(context, url); var page = Page.Pages.Find( p => slug.Equals(Utils.RemoveIllegalCharacters(p.Slug), StringComparison.OrdinalIgnoreCase)); if (page != null) { context.RewritePath(string.Format("{0}page.aspx?id={1}{2}", Utils.ApplicationRelativeWebRoot, page.Id, GetQueryString(context)), false); } } /// <summary> /// Rewrites the contact page. /// </summary> /// <param name="context">The context.</param> /// <param name="url">The URL string.</param> public static void RewriteContact(HttpContext context, string url) { RewritePhysicalPageGeneric(context, url, "contact.aspx"); } /// <summary> /// Rewrites the archive page. /// </summary> /// <param name="context">The context.</param> /// <param name="url">The URL string.</param> public static void RewriteArchive(HttpContext context, string url) { RewritePhysicalPageGeneric(context, url, "archive.aspx"); } /// <summary> /// Rewrites the search page. /// </summary> /// <param name="context">The context.</param> /// <param name="url">The URL string.</param> public static void RewriteSearch(HttpContext context, string url) { RewritePhysicalPageGeneric(context, url, "search.aspx"); } /// <summary> /// Generic routing to rewrite to a physical page, e.g. contact.aspx, archive.aspx, when RemoveExtensionsFromUrls is turned on. /// </summary> /// <param name="context">The context.</param> /// <param name="url">The URL string.</param> /// <param name="relativePath">The relative path to the page including the physical page name, e.g. archive.aspx, folder/somepage.aspx</param> private static void RewritePhysicalPageGeneric(HttpContext context, string url, string relativePath) { string query = GetQueryString(context); if (query.Length > 0 && query.StartsWith("&")) { query = "?" + query.Substring(1); } context.RewritePath(string.Format("{0}{1}{2}", Utils.ApplicationRelativeWebRoot, relativePath, query), false); } /// <summary> /// Rewrites the category. /// </summary> /// <param name="context">The HTTP context.</param> /// <param name="url">The URL string.</param> public static void RewriteCategory(HttpContext context, string url) { var title = ExtractTitle(context, url); foreach (var cat in from cat in Category.ApplicableCategories let legalTitle = Utils.RemoveIllegalCharacters(cat.Title).ToLowerInvariant() where title.Equals(legalTitle, StringComparison.OrdinalIgnoreCase) select cat) { if (url.Contains("/FEED/")) { context.RewritePath(string.Format("syndication.axd?category={0}{1}", cat.Id, GetQueryString(context)), false); } else { context.RewritePath( string.Format("{0}default.aspx?id={1}{2}", Utils.ApplicationRelativeWebRoot, cat.Id, GetQueryString(context)), false); break; } } } /// <summary> /// Rewrites the tag. /// </summary> /// <param name="context">The HTTP context.</param> /// <param name="url">The URL string.</param> public static void RewriteTag(HttpContext context, string url) { var tag = ExtractTitle(context, url); if (url.Contains("/FEED/")) { tag = string.Format("syndication.axd?tag={0}{1}", tag, GetQueryString(context)); } else { tag = string.Format("{0}default.aspx?tag=/{1}{2}", Utils.ApplicationRelativeWebRoot, tag, GetQueryString(context)); } context.RewritePath(tag, false); } /// <summary> /// Page with large calendar /// </summary> /// <param name="context">The HTTP context.</param> /// <param name="url">The URL string.</param> public static void RewriteCalendar(HttpContext context, string url) { // prevent fake URLs // valid: "/calendar/" // valid: "/calendar/default.aspx" // invalid: "/fake-value/calendar/default.aspx" // invalid: "/calendar/fake-value/default.aspx" url = url.ToLower(); var validUrl = Utils.RelativeWebRoot.ToLower() + "calendar"; if (!url.StartsWith(validUrl)) throw new HttpException(404, "File not found"); if(url.Contains("default.aspx") && !url.Contains("calendar/default.aspx")) throw new HttpException(404, "File not found"); context.RewritePath(string.Format("{0}default.aspx?calendar=show", Utils.ApplicationRelativeWebRoot), false); } /// <summary> /// Posts for author /// </summary> /// <param name="context">The HTTP context.</param> /// <param name="url">The URL string.</param> public static void RewriteAuthor(HttpContext context, string url) { var author = UrlRules.ExtractTitle(context, url); var path = string.Format("{0}default.aspx?name={1}{2}", Utils.ApplicationRelativeWebRoot, author, GetQueryString(context)); context.RewritePath(path, false); } /// <summary> /// Rewrites /blog.aspx path /// </summary> /// <param name="context">The HTTP context.</param> /// <param name="url">The URL string.</param> public static void RewriteBlog(HttpContext context, string url) { var path = string.Format("{0}default.aspx?blog=true{1}", Utils.ApplicationRelativeWebRoot, GetQueryString(context)); context.RewritePath(path, false); } /// <summary> /// Rewrites the incoming file request to the actual handler /// </summary> /// <param name="context">the context</param> /// <param name="url">the url string</param> public static void RewriteFilePath(HttpContext context, string url) { var wr = url.Substring(0, url.IndexOf("/FILES/") + 6); url = url.Replace(wr, ""); url = url.Substring(0, url.LastIndexOf(System.IO.Path.GetExtension(url))); var npath = string.Format("{0}file.axd?file={1}", Utils.ApplicationRelativeWebRoot, url); context.RewritePath(npath); } /// <summary> /// Rewrites the incoming image request to the actual handler /// </summary> /// <param name="context">the context</param> /// <param name="url">the url string</param> public static void RewriteImagePath(HttpContext context, string url) { var wr = url.Substring(0, url.IndexOf("/IMAGES/") + 7); url = url.Replace(wr, ""); url = url.Substring(0, url.LastIndexOf(System.IO.Path.GetExtension(url))); var npath = string.Format("{0}image.axd?picture={1}", Utils.ApplicationRelativeWebRoot, url); context.RewritePath(npath); } /// <summary> /// The rewrite default. /// </summary> /// <param name="context"> /// The context. /// </param> public static void RewriteDefault(HttpContext context) { var url = GetUrlWithQueryString(context); var page = string.Format("&page={0}", context.Request.QueryString["page"]); if (string.IsNullOrEmpty(context.Request.QueryString["page"])) { page = null; } if (YearMonthDayRegex.IsMatch(url)) { var match = YearMonthDayRegex.Match(url); var year = match.Groups[1].Value; var month = match.Groups[2].Value; var day = match.Groups[3].Value; var date = string.Format("{0}-{1}-{2}", year, month, day); url = string.Format("{0}default.aspx?date={1}{2}", Utils.ApplicationRelativeWebRoot, date, page); } else if (YearMonthRegex.IsMatch(url)) { var match = YearMonthRegex.Match(url); var year = match.Groups[1].Value; var month = match.Groups[2].Value; var path = string.Format("default.aspx?year={0}&month={1}", year, month); url = Utils.ApplicationRelativeWebRoot + path + page; } else if (YearRegex.IsMatch(url)) { var match = YearRegex.Match(url); var year = match.Groups[1].Value; var path = string.Format("default.aspx?year={0}", year); url = Utils.ApplicationRelativeWebRoot + path + page; } else { string newUrl = url.Replace("Default.aspx", "default.aspx"); // fixes a casing oddity on Mono int defaultStart = url.IndexOf("default.aspx", StringComparison.OrdinalIgnoreCase); url = Utils.ApplicationRelativeWebRoot + url.Substring(defaultStart); } //if (string.IsNullOrEmpty(BlogConfig.FileExtension) && url.Contains("page=")) // url = url.Replace("default.aspx?", ""); context.RewritePath(url, false); } #endregion #region Methods /// <summary> /// Checks if default.aspx was requested /// </summary> /// <param name="context">http context</param> /// <returns>True if default</returns> public static bool DefaultPageRequested(HttpContext context) { var url = context.Request.Url.ToString(); var match = string.Format("{0}DEFAULT{1}", Utils.AbsoluteWebRoot, BlogConfig.FileExtension); var u = GetUrlWithQueryString(context); var m = YearMonthDayRegex.Match(u); // case when month/day clicked in the calendar widget/control // default page will be like site.com/2012/10/15/default.aspx if (!m.Success) { // case when month clicked in the month list // default page will be like site.com/2012/10/default.aspx m = YearMonthRegex.Match(u); } if (m.Success) { var s = string.Format("{0}{1}DEFAULT{2}", Utils.AbsoluteWebRoot, m.ToString().Substring(1), BlogConfig.FileExtension); //Utils.Log("Url: " + url + "; s: " + s); if (url.Contains(s, StringComparison.OrdinalIgnoreCase)) return true; } return url.Contains(match, StringComparison.InvariantCultureIgnoreCase); } /// <summary> /// Extracts the year and month from the requested URL and returns that as a DateTime. /// </summary> /// <param name="context"> /// The context. /// </param> /// <param name="year"> /// The year number. /// </param> /// <param name="month"> /// The month number. /// </param> /// <param name="day"> /// The day number. /// </param> /// <returns> /// Whether date extraction succeeded. /// </returns> private static bool ExtractDate(HttpContext context, out int year, out int month, out int day) { year = 0; month = 0; day = 0; if (!BlogSettings.Instance.TimeStampPostLinks) { return false; } var match = YearMonthDayRegex.Match(GetUrlWithQueryString(context)); if (match.Success) { year = int.Parse(match.Groups[1].Value, CultureInfo.InvariantCulture); month = int.Parse(match.Groups[2].Value, CultureInfo.InvariantCulture); day = int.Parse(match.Groups[3].Value, CultureInfo.InvariantCulture); return true; } match = YearMonthRegex.Match(GetUrlWithQueryString(context)); if (match.Success) { year = int.Parse(match.Groups[1].Value, CultureInfo.InvariantCulture); month = int.Parse(match.Groups[2].Value, CultureInfo.InvariantCulture); return true; } return false; } /// <summary> /// Extracts the title from the requested URL. /// </summary> /// <param name="context"> /// The context. /// </param> /// <param name="url"> /// The url string. /// </param> /// <returns> /// The extract title. /// </returns> public static string ExtractTitle(HttpContext context, string url) { url = url.ToLowerInvariant().Replace("---", "-"); if (string.IsNullOrEmpty(BlogConfig.FileExtension)) { if (url.Contains("?")) url = url.Substring(0, url.LastIndexOf("?")); if (url.EndsWith("/")) url = url.Substring(0, url.Length - 1); if (url.Contains("/")) url = url.Substring(url.LastIndexOf("/") + 1); return context.Server.HtmlEncode(url); } if (url.Contains(BlogConfig.FileExtension) && url.EndsWith("/")) { url = url.Substring(0, url.Length - 1); context.Response.AppendHeader("location", url); context.Response.StatusCode = 301; } if (url.Contains(BlogConfig.FileExtension)) url = url.Substring(0, url.IndexOf(BlogConfig.FileExtension)); var index = url.LastIndexOf("/") + 1; var title = url.Substring(index); return context.Server.HtmlEncode(title); } /// <summary> /// Gets the query string from the requested URL. /// </summary> /// <param name="context"> /// The context. /// </param> /// <returns> /// The query string. /// </returns> public static string GetQueryString(HttpContext context) { var query = context.Request.QueryString.ToString(); return !string.IsNullOrEmpty(query) ? string.Format("&{0}", query) : string.Empty; } /// <summary> /// Gets query string portion of URL /// </summary> /// <param name="context">http context</param> /// <returns>Query string</returns> public static string GetUrlWithQueryString(HttpContext context) { return string.Format( "{0}?{1}", context.Request.Path, context.Request.QueryString.ToString()); } #endregion } }
37.914286
152
0.533157
[ "MIT" ]
mohanraod/mohansglobe
BlogEngine.NET-3.3.5.0/BlogEngine/BlogEngine.Core/Web/UrlRules.cs
18,580
C#
/* =============================================================================== EntitySpaces 2009 by EntitySpaces, LLC Persistence Layer and Business Objects for Microsoft .NET EntitySpaces(TM) is a legal trademark of EntitySpaces, LLC http://www.entityspaces.net =============================================================================== EntitySpaces Version : 2010.0.0.0 EntitySpaces Driver : SQL Date Generated : 3/18/2010 5:03:52 PM =============================================================================== */ using System; using EntitySpaces.Core; using EntitySpaces.Interfaces; using EntitySpaces.DynamicQuery; namespace BusinessObjects { public partial class CustomerCustomerDemo : esCustomerCustomerDemo { public CustomerCustomerDemo() { } } }
28.666667
79
0.493023
[ "Unlicense" ]
EntitySpaces/EntitySpaces-CompleteSource
Tests/CSharp/TestAllDatabases/TestAllDatabases/BusinessObjects/Custom/Northwind/CustomerCustomerDemo.cs
860
C#
using System; using System.Collections.Generic; using System.Linq; using System.Web; using Wbs.Everdigm.BLL; using Wbs.Everdigm.Database; using Wbs.Everdigm.Common; namespace Wbs.Everdigm.Web.ajax { public partial class print { private SatelliteBLL SatelliteInstance { get { return new SatelliteBLL(); } } /// <summary> /// 查找当前正等待打印的铱星标签 /// </summary> private void HandleIridiumLabelPrintQuery() { var label = SatelliteInstance.Find(f => f.LabelPrintSchedule >= DateTime.Now.AddMinutes(-5) && f.LabelPrintStatus == (byte)Common.PrintStatus.Waiting); if (null != label) { ResponseJson(JsonConverter.ToJson(label)); } else { ResponseJson("{}"); } } /// <summary> /// 获取铱星的Object /// </summary> /// <returns></returns> private TB_Satellite parseSatelliteObject() { if (!string.IsNullOrEmpty(data)) { try { var obj = JsonConverter.ToObject<TB_Satellite>(data); if (null != obj) { if (!string.IsNullOrEmpty(obj.CardNo)) { var exists = SatelliteInstance.Find(f => f.CardNo.Equals(obj.CardNo)); if (null != exists) return exists; else ResponseError(string.Format("Can not find object with paramenter \"{0}\".", obj.CardNo)); } else ResponseError("Can not find object with null paramenter."); } else ResponseError("Can not parse object."); } catch (Exception e) { ResponseError("Parse object error: " + e.Message); } } else ResponseError("Can not perform this operation with null paramenter."); return null; } /// <summary> /// 保存铱星的标签信息 /// </summary> private void HandleIridiumLabelPrintSave() { var obj = parseSatelliteObject(); if (null != obj) { obj = JsonConverter.ToObject<TB_Satellite>(data); var tmp = SatelliteInstance.Find(f => f.PcbNumber.Equals(obj.PcbNumber) && f.id != obj.id); if (null != tmp) { ResponseData(-1, "Same PCB Number &quot;" + obj.PcbNumber + "&quot; exists."); } else { SatelliteInstance.Update(f => f.CardNo.Equals(obj.CardNo), act => { act.PcbNumber = obj.PcbNumber; act.FWVersion = obj.FWVersion; act.ManufactureDate = obj.ManufactureDate; act.Manufacturer = obj.Manufacturer; act.RatedVoltage = obj.RatedVoltage; // 设置成未打印状态 act.LabelPrintStatus = (byte)Common.PrintStatus.Nothing; }); ResponseData(0, ""); } } } /// <summary> /// 请求打印一个铱星标签 /// </summary> private void HandleIridiumLabelPrintRequest() { // 请求打印一个新的标签 var obj = parseSatelliteObject(); if (null != obj) { SatelliteInstance.Update(f => f.CardNo.Equals(obj.CardNo), act => { act.LabelPrintSchedule = DateTime.Now; act.LabelPrintStatus = (byte)Common.PrintStatus.Waiting; act.LabelPrinted += 1; }); ResponseData(0, ""); } } /// <summary> /// 查询铱星标签打印过程状态 /// </summary> private void HandleIridiumLabelPrintStatus() { // 查询打印进度 var obj = parseSatelliteObject(); if (null != obj) { ResponseData(obj.LabelPrintStatus.Value, ""); } } /// <summary> /// 更新铱星标签打印进程 /// </summary> private void HandleIridiumLablePrintProgress() { var obj = parseSatelliteObject(); if (null != obj) { obj = JsonConverter.ToObject<TB_Satellite>(data); SatelliteInstance.Update(f => f.CardNo.Equals(obj.CardNo), act => { act.LabelPrintStatus = obj.LabelPrintStatus; }); ResponseData(0, ""); } } } }
33.398649
163
0.446895
[ "Apache-2.0" ]
wanbangsoftware/Everdigm
Wbs.Everdigm.Web/Wbs.Everdigm.Web/ajax/PartialPrintIridium.cs
5,113
C#
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using NUnit.Framework; namespace Azure.AI.TextAnalytics.Tests { public class RecognizeEntitiesTests : TextAnalyticsClientLiveTestBase { public RecognizeEntitiesTests(bool isAsync) : base(isAsync) { } private const string EnglishDocument1 = "Microsoft was founded by Bill Gates and Paul Allen."; private const string EnglishDocument2 = "My cat and my dog might need to see a veterinarian."; private const string SpanishDocument1 = "Microsoft fue fundado por Bill Gates y Paul Allen."; private static readonly List<string> s_batchConvenienceDocuments = new List<string> { EnglishDocument1, EnglishDocument2 }; private static readonly List<TextDocumentInput> s_batchDocuments = new List<TextDocumentInput> { new TextDocumentInput("1", EnglishDocument1) { Language = "en", }, new TextDocumentInput("2", SpanishDocument1) { Language = "es", } }; private static readonly List<string> s_document1ExpectedOutput = new List<string> { "Microsoft", "Bill Gates", "Paul Allen" }; private static readonly List<string> s_document2ExpectedOutput = new List<string> { "veterinarian" }; [Test] public async Task RecognizeEntitiesWithAADTest() { TextAnalyticsClient client = GetClient(useTokenCredential: true); CategorizedEntityCollection entities = await client.RecognizeEntitiesAsync(EnglishDocument1); ValidateInDocumenResult(entities, s_document1ExpectedOutput); } [Test] public async Task RecognizeEntitiesTest() { TextAnalyticsClient client = GetClient(); CategorizedEntityCollection entities = await client.RecognizeEntitiesAsync(EnglishDocument1); ValidateInDocumenResult(entities, s_document1ExpectedOutput); } [Test] public async Task RecognizeEntitiesWithLanguageTest() { TextAnalyticsClient client = GetClient(); CategorizedEntityCollection entities = await client.RecognizeEntitiesAsync(SpanishDocument1, "es"); ValidateInDocumenResult(entities, s_document1ExpectedOutput); } [Test] public async Task RecognizeEntitiesWithSubCategoryTest() { TextAnalyticsClient client = GetClient(); string document = "I had a wonderful trip to Seattle last week."; CategorizedEntityCollection entities = await client.RecognizeEntitiesAsync(document); Assert.GreaterOrEqual(entities.Count, 3); foreach (CategorizedEntity entity in entities) { if (entity.Text == "last week") Assert.AreEqual("DateRange", entity.SubCategory); } } [Test] public async Task RecognizeEntitiesBatchWithErrorTest() { TextAnalyticsClient client = GetClient(); var documents = new List<string> { "Microsoft was founded by Bill Gates and Paul Allen.", "", "My cat might need to see a veterinarian." }; RecognizeEntitiesResultCollection results = await client.RecognizeEntitiesBatchAsync(documents); Assert.IsTrue(!results[0].HasError); Assert.IsTrue(!results[2].HasError); var exceptionMessage = "Cannot access result for document 1, due to error InvalidDocument: Document text is empty."; Assert.IsTrue(results[1].HasError); InvalidOperationException ex = Assert.Throws<InvalidOperationException>(() => results[1].Entities.GetType()); Assert.AreEqual(exceptionMessage, ex.Message); } [Test] public void RecognizeEntitiesBatchWithInvalidDocumentBatch() { TextAnalyticsClient client = GetClient(); var documents = new List<string> { "document 1", "document 2", "document 3", "document 4", "document 5", "document 6" }; RequestFailedException ex = Assert.ThrowsAsync<RequestFailedException>( async () => await client.RecognizeEntitiesBatchAsync(documents)); Assert.AreEqual(400, ex.Status); Assert.AreEqual(TextAnalyticsErrorCode.InvalidDocumentBatch, ex.ErrorCode); } [Test] public async Task RecognizeEntitiesBatchConvenienceTest() { TextAnalyticsClient client = GetClient(); RecognizeEntitiesResultCollection results = await client.RecognizeEntitiesBatchAsync(s_batchConvenienceDocuments); var expectedOutput = new Dictionary<string, List<string>>() { { "0", s_document1ExpectedOutput }, { "1", s_document2ExpectedOutput }, }; ValidateBatchDocumentsResult(results, expectedOutput); } [Test] public async Task RecognizeEntitiesBatchConvenienceWithStatisticsTest() { TextAnalyticsClient client = GetClient(); RecognizeEntitiesResultCollection results = await client.RecognizeEntitiesBatchAsync(s_batchConvenienceDocuments, "en", new TextAnalyticsRequestOptions { IncludeStatistics = true }); var expectedOutput = new Dictionary<string, List<string>>() { { "0", s_document1ExpectedOutput }, { "1", s_document2ExpectedOutput }, }; ValidateBatchDocumentsResult(results, expectedOutput, includeStatistics: true); } [Test] public async Task RecognizeEntitiesBatchTest() { TextAnalyticsClient client = GetClient(); RecognizeEntitiesResultCollection results = await client.RecognizeEntitiesBatchAsync(s_batchDocuments); var expectedOutput = new Dictionary<string, List<string>>() { { "1", s_document1ExpectedOutput }, { "2", s_document1ExpectedOutput }, }; ValidateBatchDocumentsResult(results, expectedOutput); } [Test] public async Task RecognizeEntitiesBatchWithStatisticsTest() { TextAnalyticsClient client = GetClient(); RecognizeEntitiesResultCollection results = await client.RecognizeEntitiesBatchAsync(s_batchDocuments, new TextAnalyticsRequestOptions { IncludeStatistics = true }); var expectedOutput = new Dictionary<string, List<string>>() { { "1", s_document1ExpectedOutput }, { "2", s_document1ExpectedOutput }, }; ValidateBatchDocumentsResult(results, expectedOutput, includeStatistics: true); } [Test] public void RecognizeEntitiesBatchWithNullIdTest() { TextAnalyticsClient client = GetClient(); var documents = new List<TextDocumentInput> { new TextDocumentInput(null, "Hello world") }; RequestFailedException ex = Assert.ThrowsAsync<RequestFailedException>(async () => await client.RecognizeEntitiesBatchAsync(documents)); Assert.AreEqual(TextAnalyticsErrorCode.InvalidDocument, ex.ErrorCode); } [Test] public async Task RecognizeEntitiesBatchWithNullTextTest() { TextAnalyticsClient client = GetClient(); var documents = new List<TextDocumentInput> { new TextDocumentInput("1", null) }; RecognizeEntitiesResultCollection results = await client.RecognizeEntitiesBatchAsync(documents); var exceptionMessage = "Cannot access result for document 1, due to error InvalidDocument: Document text is empty."; Assert.IsTrue(results[0].HasError); InvalidOperationException ex = Assert.Throws<InvalidOperationException>(() => results[0].Entities.Count()); Assert.AreEqual(exceptionMessage, ex.Message); } private void ValidateInDocumenResult(CategorizedEntityCollection entities, List<string> minimumExpectedOutput) { Assert.IsNotNull(entities.Warnings); Assert.GreaterOrEqual(entities.Count, minimumExpectedOutput.Count); foreach (CategorizedEntity entity in entities) { Assert.That(entity.Text, Is.Not.Null.And.Not.Empty); Assert.IsTrue(minimumExpectedOutput.Contains(entity.Text, StringComparer.OrdinalIgnoreCase)); Assert.IsNotNull(entity.Category); Assert.GreaterOrEqual(entity.ConfidenceScore, 0.0); Assert.GreaterOrEqual(entity.Offset, 0); if (entity.SubCategory != null) { Assert.IsNotEmpty(entity.SubCategory); } } } private void ValidateBatchDocumentsResult(RecognizeEntitiesResultCollection results, Dictionary<string, List<string>> minimumExpectedOutput, bool includeStatistics = default) { Assert.That(results.ModelVersion, Is.Not.Null.And.Not.Empty); if (includeStatistics) { Assert.IsNotNull(results.Statistics); Assert.Greater(results.Statistics.DocumentCount, 0); Assert.Greater(results.Statistics.TransactionCount, 0); Assert.GreaterOrEqual(results.Statistics.InvalidDocumentCount, 0); Assert.GreaterOrEqual(results.Statistics.ValidDocumentCount, 0); } else Assert.IsNull(results.Statistics); foreach (RecognizeEntitiesResult entitiesInDocument in results) { Assert.That(entitiesInDocument.Id, Is.Not.Null.And.Not.Empty); Assert.False(entitiesInDocument.HasError); //Even though statistics are not asked for, TA 5.0.0 shipped with Statistics default always present. Assert.IsNotNull(entitiesInDocument.Statistics); if (includeStatistics) { Assert.GreaterOrEqual(entitiesInDocument.Statistics.CharacterCount, 0); Assert.Greater(entitiesInDocument.Statistics.TransactionCount, 0); } else { Assert.AreEqual(0, entitiesInDocument.Statistics.CharacterCount); Assert.AreEqual(0, entitiesInDocument.Statistics.TransactionCount); } ValidateInDocumenResult(entitiesInDocument.Entities, minimumExpectedOutput[entitiesInDocument.Id]); } } } }
39.820789
194
0.623402
[ "MIT" ]
0rland0Wats0n/azure-sdk-for-net
sdk/textanalytics/Azure.AI.TextAnalytics/tests/RecognizeEntitiesTests.cs
11,112
C#
 //Write a program that, for a given two integer numbers N and X, calculates the sum S = 1 + 1!/X + 2!/X2 + … + N!/XN using System; using System.Numerics; class NandXequation { static decimal Factorial(decimal num) // Method for calculation of the factorial. The type is not BigInteger, because then it calculates with integers only and the final result is not correct. { decimal numFact = 1; for (int i = 1; i <= num; i++) { numFact *= i; } return numFact; } static decimal powerX(decimal x, decimal power) // Method for the calculation of x^n { decimal result = 1; for (int i = 0; i < power; i++) { result *= x; } return result; } static void Main() { Console.Title = "Calculate a strange sum"; Console.Write("Enter N = "); string nString = Console.ReadLine(); uint n; while (!(uint.TryParse(nString, out n)) || n == 0) { Console.Write("Enter N(N >= 1) = "); nString = Console.ReadLine(); } Console.Write("Enter X = "); string xString = Console.ReadLine(); decimal x; while (!(decimal.TryParse(xString, out x))) { Console.Write("Enter X(a number) = "); xString = Console.ReadLine(); } decimal sum = 1; for (int i = 1; i <= n; i++) { sum += Factorial(i) / powerX(x, i); } Console.WriteLine("The result of the equation is {0}", sum); } }
25.349206
210
0.519098
[ "MIT" ]
PetarMetodiev/Telerik-Homeworks
C# Part 1/06 Loops/Loops/06 NandXequation/NandXequation.cs
1,601
C#
using System.Collections.Generic; using System.Threading.Tasks; using NetDaemon.Common.Reactive; /// <summary> /// Greets (or insults) people when coming home :) /// </summary> public class CircularApp : NetDaemonRxApp { public override Task InitializeAsync() { // Do nothing return Task.CompletedTask; } }
21.25
54
0.682353
[ "MIT" ]
FrankBakkerNl/netdaemon
tests/NetDaemon.Daemon.Tests/DaemonRunner/FaultyApp/CircularDependencies/CircularApp.cs
340
C#
///----------------------------------------------------------------- /// Author: Fouad Messaia /// AuthorUrl: http://messaia.com /// Date: 01.01.2016 /// Copyright (©) 2016, MESSAIA.NET, all Rights Reserved. /// Licensed under the Apache License, Version 2.0. /// See License.txt in the project root for license information. ///----------------------------------------------------------------- namespace Messaia.Net.Api { using AutoMapper; using Microsoft.AspNetCore.JsonPatch; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using System; using System.Threading.Tasks; using Messaia.Net.Model; using Messaia.Net.Observable; using Messaia.Net.Service; using System.Linq; using System.Collections.Generic; /// <summary> /// The CRUDController class /// </summary> [Route("api/[controller]")] [ValidateModelState] public abstract class CRUDControllerBase<TService, TEntity, TEntityViewModel> : ControllerBase where TService : IEntityService<TEntity> where TEntity : class, IEntity<int>, new() where TEntityViewModel : class { #region Fields /// <summary> /// An instance of ILogger /// </summary> protected readonly ILogger logger; /// <summary> /// Track single loaded entity /// </summary> protected bool trackableSingle = false; #endregion #region Properties /// <summary> /// Gets or sets the Service /// </summary> public TService Service { get; private set; } /// <summary> /// Gets or sets the PatchForbiddenPaths /// </summary> protected List<string> PatchForbiddenPaths { get; set; } = new List<string>(); /// <summary> /// Gets or sets the PatchAllowedPaths /// </summary> protected List<string> PatchAllowedPaths { get; set; } = new List<string>(); #endregion #region Constructors /// <summary> /// Initializes an instance of the <see cref="CRUDController"/> class. /// </summary> /// <param name="service">The entity service</param> /// <param name="securityService">The security service</param> /// <param name="logger">Logger instance</param> public CRUDControllerBase(TService service, ILogger logger) { this.Service = service; this.logger = logger; } /// <summary> /// Initializes an instance of the <see cref="BaseController"/> class. /// </summary> /// <param name="service">The entity service</param> public CRUDControllerBase(TService service) : this(service, null) { } #endregion #region Methods /// <summary> /// Gets a single entity by ID /// GET: /<controller>/{id} /// </summary> /// <param name="id">The entoty ID</param> /// <returns>Type: IActionResult</returns> [HttpGet("{id:int}")] public virtual async Task<IActionResult> GetAsync(int id) { /* Trigger BeforeRead event */ this.OnBeforeRead(id); /* Load the entity and check if it exists */ var entity = await this.Service.GetAsync(x => x.Id == id, true, this.trackableSingle); if (entity == null) { this.logger.LogWarning(LoggingEvents.GetItemNotFound, "GetAsync({ID}) NOT FOUND", id); return NotFound(id); } /* Trigger AfterRead event */ this.OnAfterRead(entity); return MappedResult<TEntityViewModel>(entity); } /// <summary> /// Saves an entity. /// </summary> /// <param name="viewModel">The view model</param> /// <returns>Type: IActionResult</returns> [HttpPost] public virtual async Task<IActionResult> Post([FromBody]TEntityViewModel viewModel, bool updateOnConflict = false) { /* Map the view model */ var entity = this.Map<TEntity>(viewModel); /* Validates the entity */ if (!await this.IsValidAsync(entity)) { return BadRequest(this.ModelState); } /* Trigger BeforeCreate event */ this.OnBeforeCreate(entity, viewModel); /* Revalidate the model */ if (!this.ModelState.IsValid) { return BadRequest(this.ModelState); } /* Save the entity */ var result = await this.Service.CreateAsync(entity, true, updateOnConflict); if (!result.Succeeded) { /* Write some logs */ this.logger.LogWarning(LoggingEvents.InsertItem, "Item {TYPE} could no be created", entity.GetType().Name); /* Add errors to model state and return a bad request */ this.AddErrors(result); return BadRequest(this.ModelState); } /* Trigger AfterCreate event */ this.OnAfterCreate(entity, viewModel); /* Write some logs */ this.logger.LogInformation(LoggingEvents.InsertItem, "Item {ID} Created", entity.Id); return CreatedAtRoute(new { id = entity.Id }, viewModel); } /// <summary> /// Updates an entity. /// </summary> /// <param name="viewModel">The view model</param> /// <returns>Type: IActionResult</returns> [HttpPut("{id:int}")] public virtual async Task<IActionResult> Put(int id, [FromBody]TEntityViewModel viewModel) { /* Load the entity and check if it exists */ var entity = await this.Service.GetAsync(x => x.Id == id); if (entity == null) { this.logger.LogWarning(LoggingEvents.GetItemNotFound, "Update({ID}) NOT FOUND", id); return NotFound(id); } /* Use automapper to map the ViewModel ontop of the database object */ this.Map(viewModel, entity); /* Validates the entity */ if (!await this.IsValidAsync(entity)) { return BadRequest(this.ModelState); } /* Trigger BeforeUpdate event */ this.OnBeforeUpdate(entity, viewModel); /* Revalidate the model */ if (!this.ModelState.IsValid) { return BadRequest(this.ModelState); } /* Update the entity */ var result = await this.Service.UpdateAsync(entity); if (!result.Succeeded) { /* Write some logs */ this.logger.LogWarning(LoggingEvents.InsertItem, "Item {TYPE} could no be updated", entity.GetType().Name); /* Add errors to model state and return a bad request */ this.AddErrors(result); return BadRequest(this.ModelState); } /* Trigger AfterUpdate event */ this.OnAfterUpdate(entity, viewModel); /* Write some logs */ this.logger.LogInformation(LoggingEvents.UpdateItem, "Item {ID} Updated", entity.Id); return new NoContentResult(); } /// <summary> /// Updates an entity. /// </summary> /// <param name="patchedViewModel">The view model</param> /// <returns>Type: IActionResult</returns> [HttpPatch("{id:int}")] public virtual async Task<IActionResult> Patch(int id, [FromBody]JsonPatchDocument<TEntityViewModel> patchedViewModel) { /* Check if the user is allowed to perform this action */ if (patchedViewModel.Operations.Any(x => this.PatchForbiddenPaths?.Any(y => y.ToLower().Equals(x.path.ToLower())) == true)) { return BadRequest(new { Message = "You are not authorized to perform this action!" }); } /* Check if the user is allowed to perform this action */ if (this.PatchAllowedPaths?.Count > 0 && !patchedViewModel.Operations.All(x => this.PatchAllowedPaths.Any(y => y.ToLower().Equals(x.path.ToLower())))) { return BadRequest(new { Message = "You are not authorized to perform this action!" }); } /* Load the entity and check if it exists */ var entity = await this.Service.GetAsync(x => x.Id == id); if (entity == null) { this.logger.LogWarning(LoggingEvents.GetItemNotFound, "Update({ID}) NOT FOUND", id); return NotFound(id); } /* Use Automapper to map the database object to the ViewModel object */ var viewModel = Mapper.Map<TEntityViewModel>(entity); /* Apply the patch to that ViewModel */ patchedViewModel.ApplyTo(viewModel); /* Use automapper to map the ViewModel ontop of the database object */ this.Map(viewModel, entity); /* Validates the entity */ if (!await this.IsValidAsync(entity)) { return BadRequest(this.ModelState); } /* Trigger BeforeUpdate event */ this.OnBeforeUpdate(entity, viewModel); /* Revalidate the model */ if (!this.ModelState.IsValid) { return BadRequest(this.ModelState); } /* Update the entity */ var result = await this.Service.UpdateAsync(entity); if (!result.Succeeded) { /* Write some logs */ this.logger.LogWarning(LoggingEvents.InsertItem, "Item {TYPE} could no be updated", entity.GetType().Name); /* Add errors to model state and return a bad request */ this.AddErrors(result); return BadRequest(this.ModelState); } /* Trigger AfterUpdate event */ this.OnAfterUpdate(entity, viewModel); /* Write some logs */ this.logger.LogInformation(LoggingEvents.UpdateItem, "Item {ID} Updated", entity.Id); return new NoContentResult(); } /// <summary> /// Deletes an entity. /// </summary> /// <param name="id"></param> /// <returns></returns> [HttpDelete("{id:int}")] public virtual async Task<IActionResult> Delete(int id) { /* Trigger BeforeDelete event */ this.OnBeforeDelete(id); /* Delete the entity */ var result = await this.Service.DeleteAsync(x => x.Id == id); if (!result.Succeeded) { /* Write some logs */ this.logger.LogWarning(LoggingEvents.InsertItem, "Item {ID} could no be deleted", id); /* Add errors to model state and return a bad request */ this.AddErrors(result); return BadRequest(this.ModelState); } /* Trigger AfterDelete event */ this.OnAfterDelete(id); /* Write some logs */ this.logger.LogInformation(LoggingEvents.DeleteItem, "Item {ID} Deleted", id); return new NoContentResult(); } /// <summary> /// Deletes an entity. /// </summary> /// <param name="id"></param> /// <returns></returns> [HttpDelete] public virtual async Task<IActionResult> Delete(int[] ids) { foreach (var id in ids) { /* Trigger BeforeDelete event */ this.OnBeforeDelete(id); var result = await this.Service.DeleteAsync(x => x.Id == id); if (!result.Succeeded) { /* Write some logs */ this.logger.LogWarning(LoggingEvents.InsertItem, "Item {ID} could no be deleted", id); /* Add errors to model state and return a bad request */ this.AddErrors(result); return BadRequest(this.ModelState); } /* Trigger AfterDelete event */ this.OnAfterDelete(id); } /* Write some logs */ this.logger.LogInformation(LoggingEvents.DeleteItem, "Items {ID} Deleted", string.Join(",", ids)); return new NoContentResult(); } #region Events /// <summary> /// Occurs before the entity is read /// Override this method if you are interested in BeforeRead events. /// </summary> /// <param name="id"></param> protected virtual void OnBeforeRead(int id) { } /// <summary> /// Occurs after the entity is read /// Override this method if you are interested in AfterRead events. /// </summary> /// <param name="entity"></param> protected virtual void OnAfterRead(TEntity entity) { } /// <summary> /// Occurs before the entity is created /// Override this method if you are interested in BeforeCreate events. /// </summary> /// <param name="entity"></param> /// <param name="viewModel"></param> protected virtual void OnBeforeCreate(TEntity entity, TEntityViewModel viewModel) { } /// <summary> /// Occurs after the entity is created /// Override this method if you are interested in AfterCreate events. /// </summary> /// <param name="entity"></param> /// <param name="viewModel"></param> protected virtual void OnAfterCreate(TEntity entity, TEntityViewModel viewModel) { } /// <summary> /// Occurs before the entity is updated /// Override this method if you are interested in BeforeUpdate events. /// </summary> /// <param name="entity"></param> /// <param name="viewModel"></param> protected virtual void OnBeforeUpdate(TEntity entity, TEntityViewModel viewModel) { } /// <summary> /// Occurs after the entity is updated /// Override this method if you are interested in AfterUpdate events. /// </summary> /// <param name="entity"></param> /// <param name="viewModel"></param> protected virtual void OnAfterUpdate(TEntity entity, TEntityViewModel viewModel) { } /// <summary> /// Occurs before the entity is deleted /// Override this method if you are interested in BeforeDelete events. /// </summary> /// <param name="id"></param> protected virtual void OnBeforeDelete(int id) { } /// <summary> /// Occurs after the entity is deleted /// Override this method if you are interested in AfterDelete events. /// </summary> /// <param name="id"></param> protected virtual void OnAfterDelete(int id) { } #endregion #region Helpers /// <summary> /// Returns a mm /// Mappes the values and creates an OkObjectResult object that produces an OK (200) response. /// </summary> /// <typeparam name="TDestination"></typeparam> /// <param name="source"></param> /// <returns></returns> public virtual IActionResult MappedResult<TDestination>(object source) { /* No mapping nedded, if source is type of TDestination */ if (source is TDestination) { return Ok((TDestination)source); } return Ok(this.Map<TDestination>(source)); } /// <summary> /// Validates the specified entity. /// </summary> /// <param name="entity">Type: TEntity</param> /// <returns>Type: boolean</returns> protected virtual async Task<bool> IsValidAsync(TEntity entity) { return await Task.FromResult(true); } /// <summary> /// Maps the specified model to the specified view model. /// </summary> /// <typeparam name="TDestination"></typeparam> /// <param name="source"></param> /// <returns></returns> protected virtual TDestination Map<TDestination>(object source) { /* No mapping nedded, if source is type of TDestination */ if (source is TDestination) { return (TDestination)source; } return Mapper.Map<TDestination>(source); } /// <summary> /// Maps the specified model to the specified view model. /// </summary> /// <typeparam name="TSource"></typeparam> /// <typeparam name="TDestination"></typeparam> /// <param name="source"></param> /// <param name="destination"></param> /// <returns></returns> protected virtual TDestination Map<TDestination, TSource>(TSource source, TDestination destination) { return Mapper.Map(source, destination); } /// <summary> /// Adds an observer to ther entity service /// </summary> /// <param name="observer">The observer instance</param> /// <returns>Type: boolean</returns> protected virtual void Subscribe(IObserver<ICommand> observer) { this.Service?.Subscribe(observer); } /// <summary> /// Adds errors to model state /// </summary> /// <param name="result"></param> protected virtual void AddErrors(ServiceResult result) { foreach (var error in result.Errors) { ModelState.AddModelError(string.Empty, error.Description); } } #endregion #endregion } }
35.583826
162
0.54548
[ "Apache-2.0" ]
fouadmess/NetCore
Messaia.Net.Api/Controllers/CRUDControllerBase.cs
18,044
C#
using Content.Server.GameObjects.EntitySystems.Click; using Content.Shared.Construction; using Content.Shared.GameObjects.EntitySystems; using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; using Robust.Shared.IoC; using Robust.Shared.Localization; using Robust.Shared.Serialization; using Robust.Shared.Utility; using Robust.Shared.ViewVariables; namespace Content.Server.GameObjects.Components.Construction { /// <summary> /// Holds data about an entity that is in the process of being constructed or destructed. /// </summary> [RegisterComponent] public class ConstructionComponent : Component, IExamine { #pragma warning disable 649 [Dependency] private readonly ILocalizationManager _loc; #pragma warning restore 649 /// <inheritdoc /> public override string Name => "Construction"; /// <summary> /// The current construction recipe being used to build this entity. /// </summary> [ViewVariables] public ConstructionPrototype Prototype { get; set; } /// <summary> /// The current stage of construction. /// </summary> [ViewVariables] public int Stage { get; set; } /// <inheritdoc /> public override void ExposeData(ObjectSerializer serializer) { base.ExposeData(serializer); serializer.DataReadWriteFunction("prototype", null, value => Prototype = value, () => Prototype); serializer.DataReadWriteFunction("stage", 0, value => Stage = value, () => Stage); } void IExamine.Examine(FormattedMessage message, bool inDetailsRange) { EntitySystem.Get<SharedConstructionSystem>().DoExamine(message, Prototype, Stage, inDetailsRange); } } }
32.803571
110
0.664126
[ "MIT" ]
Hughgent/space-station-14
Content.Server/GameObjects/Components/Construction/ConstructionComponent.cs
1,839
C#
using App.UI.Mvc5.Infrastructure; using System.Net; namespace App.UI.Mvc5.Models { public class ErrorViewModel : BaseViewModel { /// <summary> /// Constructor method. /// </summary> public ErrorViewModel(HttpStatusCode statusCode, string errorMessage = null) { Code = (int)statusCode; Message = errorMessage; if (!string.IsNullOrWhiteSpace(Message)) { return; } switch (statusCode) { case HttpStatusCode.BadRequest: Message = GlobalizationManager.GetLocalizedString("Errors_BadRequestMessage"); break; case HttpStatusCode.Forbidden: Message = GlobalizationManager.GetLocalizedString("Errors_ForbiddenMessage"); break; case HttpStatusCode.NotFound: Message = GlobalizationManager.GetLocalizedString("Errors_NotFoundMessage"); break; case HttpStatusCode.Unauthorized: Message = GlobalizationManager.GetLocalizedString("Errors_UnauthorizedMessage"); break; default: Message = GlobalizationManager.GetLocalizedString("Errors_GeneralErrorMessage"); break; } } public int Code { get; private set; } public string Message { get; private set; } } }
22.921569
85
0.717707
[ "MIT" ]
weedkiller/aspnet-mvc5-starter-template
sources/platform-solutions/App.UI.Mvc5/Models/Errors/ErrorViewModel.cs
1,171
C#
using System; using System.Collections.Generic; namespace Models.DB { public partial class TmaintenanceInterval { public TmaintenanceInterval() { EmaintenanceIntervals = new HashSet<EmaintenanceIntervals>(); } public short TmaintenanceIntervalId { get; set; } public string MaximumIntervalDays { get; set; } public decimal MaximumIntervalDistanceValue { get; set; } public bool MaximumIntervalDistanceValueSpecified { get; set; } public virtual ICollection<EmaintenanceIntervals> EmaintenanceIntervals { get; set; } } }
29.142857
93
0.687908
[ "Apache-2.0" ]
LightosLimited/RailML
v2.4/Models/DB/TmaintenanceInterval.cs
614
C#
// Copyright 2021 Google LLC // // 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 // // https://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. // Generated code. DO NOT EDIT! using gagvr = Google.Ads.GoogleAds.V8.Resources; using gax = Google.Api.Gax; using gaxgrpc = Google.Api.Gax.Grpc; using gaxgrpccore = Google.Api.Gax.Grpc.GrpcCore; using proto = Google.Protobuf; using grpccore = Grpc.Core; using grpcinter = Grpc.Core.Interceptors; using sys = System; using scg = System.Collections.Generic; using sco = System.Collections.ObjectModel; using st = System.Threading; using stt = System.Threading.Tasks; namespace Google.Ads.GoogleAds.V8.Services { /// <summary>Settings for <see cref="CampaignFeedServiceClient"/> instances.</summary> public sealed partial class CampaignFeedServiceSettings : gaxgrpc::ServiceSettingsBase { /// <summary>Get a new instance of the default <see cref="CampaignFeedServiceSettings"/>.</summary> /// <returns>A new instance of the default <see cref="CampaignFeedServiceSettings"/>.</returns> public static CampaignFeedServiceSettings GetDefault() => new CampaignFeedServiceSettings(); /// <summary>Constructs a new <see cref="CampaignFeedServiceSettings"/> object with default settings.</summary> public CampaignFeedServiceSettings() { } private CampaignFeedServiceSettings(CampaignFeedServiceSettings existing) : base(existing) { gax::GaxPreconditions.CheckNotNull(existing, nameof(existing)); GetCampaignFeedSettings = existing.GetCampaignFeedSettings; MutateCampaignFeedsSettings = existing.MutateCampaignFeedsSettings; OnCopy(existing); } partial void OnCopy(CampaignFeedServiceSettings existing); /// <summary> /// <see cref="gaxgrpc::CallSettings"/> for synchronous and asynchronous calls to /// <c>CampaignFeedServiceClient.GetCampaignFeed</c> and <c>CampaignFeedServiceClient.GetCampaignFeedAsync</c>. /// </summary> /// <remarks> /// <list type="bullet"> /// <item><description>Initial retry delay: 5000 milliseconds.</description></item> /// <item><description>Retry delay multiplier: 1.3</description></item> /// <item><description>Retry maximum delay: 60000 milliseconds.</description></item> /// <item><description>Maximum attempts: Unlimited</description></item> /// <item><description>Timeout: 3600 seconds.</description></item> /// </list> /// </remarks> public gaxgrpc::CallSettings GetCampaignFeedSettings { get; set; } = gaxgrpc::CallSettingsExtensions.WithRetry(gaxgrpc::CallSettings.FromExpiration(gax::Expiration.FromTimeout(sys::TimeSpan.FromMilliseconds(3600000))), gaxgrpc::RetrySettings.FromExponentialBackoff(maxAttempts: 2147483647, initialBackoff: sys::TimeSpan.FromMilliseconds(5000), maxBackoff: sys::TimeSpan.FromMilliseconds(60000), backoffMultiplier: 1.3, retryFilter: gaxgrpc::RetrySettings.FilterForStatusCodes(grpccore::StatusCode.Unavailable, grpccore::StatusCode.DeadlineExceeded))); /// <summary> /// <see cref="gaxgrpc::CallSettings"/> for synchronous and asynchronous calls to /// <c>CampaignFeedServiceClient.MutateCampaignFeeds</c> and /// <c>CampaignFeedServiceClient.MutateCampaignFeedsAsync</c>. /// </summary> /// <remarks> /// <list type="bullet"> /// <item><description>Initial retry delay: 5000 milliseconds.</description></item> /// <item><description>Retry delay multiplier: 1.3</description></item> /// <item><description>Retry maximum delay: 60000 milliseconds.</description></item> /// <item><description>Maximum attempts: Unlimited</description></item> /// <item><description>Timeout: 3600 seconds.</description></item> /// </list> /// </remarks> public gaxgrpc::CallSettings MutateCampaignFeedsSettings { get; set; } = gaxgrpc::CallSettingsExtensions.WithRetry(gaxgrpc::CallSettings.FromExpiration(gax::Expiration.FromTimeout(sys::TimeSpan.FromMilliseconds(3600000))), gaxgrpc::RetrySettings.FromExponentialBackoff(maxAttempts: 2147483647, initialBackoff: sys::TimeSpan.FromMilliseconds(5000), maxBackoff: sys::TimeSpan.FromMilliseconds(60000), backoffMultiplier: 1.3, retryFilter: gaxgrpc::RetrySettings.FilterForStatusCodes(grpccore::StatusCode.Unavailable, grpccore::StatusCode.DeadlineExceeded))); /// <summary>Creates a deep clone of this object, with all the same property values.</summary> /// <returns>A deep clone of this <see cref="CampaignFeedServiceSettings"/> object.</returns> public CampaignFeedServiceSettings Clone() => new CampaignFeedServiceSettings(this); } /// <summary> /// Builder class for <see cref="CampaignFeedServiceClient"/> to provide simple configuration of credentials, /// endpoint etc. /// </summary> internal sealed partial class CampaignFeedServiceClientBuilder : gaxgrpc::ClientBuilderBase<CampaignFeedServiceClient> { /// <summary>The settings to use for RPCs, or <c>null</c> for the default settings.</summary> public CampaignFeedServiceSettings Settings { get; set; } partial void InterceptBuild(ref CampaignFeedServiceClient client); partial void InterceptBuildAsync(st::CancellationToken cancellationToken, ref stt::Task<CampaignFeedServiceClient> task); /// <summary>Builds the resulting client.</summary> public override CampaignFeedServiceClient Build() { CampaignFeedServiceClient client = null; InterceptBuild(ref client); return client ?? BuildImpl(); } /// <summary>Builds the resulting client asynchronously.</summary> public override stt::Task<CampaignFeedServiceClient> BuildAsync(st::CancellationToken cancellationToken = default) { stt::Task<CampaignFeedServiceClient> task = null; InterceptBuildAsync(cancellationToken, ref task); return task ?? BuildAsyncImpl(cancellationToken); } private CampaignFeedServiceClient BuildImpl() { Validate(); grpccore::CallInvoker callInvoker = CreateCallInvoker(); return CampaignFeedServiceClient.Create(callInvoker, Settings); } private async stt::Task<CampaignFeedServiceClient> BuildAsyncImpl(st::CancellationToken cancellationToken) { Validate(); grpccore::CallInvoker callInvoker = await CreateCallInvokerAsync(cancellationToken).ConfigureAwait(false); return CampaignFeedServiceClient.Create(callInvoker, Settings); } /// <summary>Returns the endpoint for this builder type, used if no endpoint is otherwise specified.</summary> protected override string GetDefaultEndpoint() => CampaignFeedServiceClient.DefaultEndpoint; /// <summary> /// Returns the default scopes for this builder type, used if no scopes are otherwise specified. /// </summary> protected override scg::IReadOnlyList<string> GetDefaultScopes() => CampaignFeedServiceClient.DefaultScopes; /// <summary>Returns the channel pool to use when no other options are specified.</summary> protected override gaxgrpc::ChannelPool GetChannelPool() => CampaignFeedServiceClient.ChannelPool; /// <summary>Returns the default <see cref="gaxgrpc::GrpcAdapter"/>to use if not otherwise specified.</summary> protected override gaxgrpc::GrpcAdapter DefaultGrpcAdapter => gaxgrpccore::GrpcCoreAdapter.Instance; } /// <summary>CampaignFeedService client wrapper, for convenient use.</summary> /// <remarks> /// Service to manage campaign feeds. /// </remarks> public abstract partial class CampaignFeedServiceClient { /// <summary> /// The default endpoint for the CampaignFeedService service, which is a host of "googleads.googleapis.com" and /// a port of 443. /// </summary> public static string DefaultEndpoint { get; } = "googleads.googleapis.com:443"; /// <summary>The default CampaignFeedService scopes.</summary> /// <remarks> /// The default CampaignFeedService scopes are: /// <list type="bullet"><item><description>https://www.googleapis.com/auth/adwords</description></item></list> /// </remarks> public static scg::IReadOnlyList<string> DefaultScopes { get; } = new sco::ReadOnlyCollection<string>(new string[] { "https://www.googleapis.com/auth/adwords", }); internal static gaxgrpc::ChannelPool ChannelPool { get; } = new gaxgrpc::ChannelPool(DefaultScopes); /// <summary> /// Asynchronously creates a <see cref="CampaignFeedServiceClient"/> using the default credentials, endpoint and /// settings. To specify custom credentials or other settings, use /// <see cref="CampaignFeedServiceClientBuilder"/>. /// </summary> /// <param name="cancellationToken"> /// The <see cref="st::CancellationToken"/> to use while creating the client. /// </param> /// <returns>The task representing the created <see cref="CampaignFeedServiceClient"/>.</returns> public static stt::Task<CampaignFeedServiceClient> CreateAsync(st::CancellationToken cancellationToken = default) => new CampaignFeedServiceClientBuilder().BuildAsync(cancellationToken); /// <summary> /// Synchronously creates a <see cref="CampaignFeedServiceClient"/> using the default credentials, endpoint and /// settings. To specify custom credentials or other settings, use /// <see cref="CampaignFeedServiceClientBuilder"/>. /// </summary> /// <returns>The created <see cref="CampaignFeedServiceClient"/>.</returns> public static CampaignFeedServiceClient Create() => new CampaignFeedServiceClientBuilder().Build(); /// <summary> /// Creates a <see cref="CampaignFeedServiceClient"/> which uses the specified call invoker for remote /// operations. /// </summary> /// <param name="callInvoker"> /// The <see cref="grpccore::CallInvoker"/> for remote operations. Must not be null. /// </param> /// <param name="settings">Optional <see cref="CampaignFeedServiceSettings"/>.</param> /// <returns>The created <see cref="CampaignFeedServiceClient"/>.</returns> internal static CampaignFeedServiceClient Create(grpccore::CallInvoker callInvoker, CampaignFeedServiceSettings settings = null) { gax::GaxPreconditions.CheckNotNull(callInvoker, nameof(callInvoker)); grpcinter::Interceptor interceptor = settings?.Interceptor; if (interceptor != null) { callInvoker = grpcinter::CallInvokerExtensions.Intercept(callInvoker, interceptor); } CampaignFeedService.CampaignFeedServiceClient grpcClient = new CampaignFeedService.CampaignFeedServiceClient(callInvoker); return new CampaignFeedServiceClientImpl(grpcClient, settings); } /// <summary> /// Shuts down any channels automatically created by <see cref="Create()"/> and /// <see cref="CreateAsync(st::CancellationToken)"/>. Channels which weren't automatically created are not /// affected. /// </summary> /// <remarks> /// After calling this method, further calls to <see cref="Create()"/> and /// <see cref="CreateAsync(st::CancellationToken)"/> will create new channels, which could in turn be shut down /// by another call to this method. /// </remarks> /// <returns>A task representing the asynchronous shutdown operation.</returns> public static stt::Task ShutdownDefaultChannelsAsync() => ChannelPool.ShutdownChannelsAsync(); /// <summary>The underlying gRPC CampaignFeedService client</summary> public virtual CampaignFeedService.CampaignFeedServiceClient GrpcClient => throw new sys::NotImplementedException(); /// <summary> /// Returns the requested campaign feed in full detail. /// /// List of thrown errors: /// [AuthenticationError]() /// [AuthorizationError]() /// [HeaderError]() /// [InternalError]() /// [QuotaError]() /// [RequestError]() /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>The RPC response.</returns> public virtual gagvr::CampaignFeed GetCampaignFeed(GetCampaignFeedRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException(); /// <summary> /// Returns the requested campaign feed in full detail. /// /// List of thrown errors: /// [AuthenticationError]() /// [AuthorizationError]() /// [HeaderError]() /// [InternalError]() /// [QuotaError]() /// [RequestError]() /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task<gagvr::CampaignFeed> GetCampaignFeedAsync(GetCampaignFeedRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException(); /// <summary> /// Returns the requested campaign feed in full detail. /// /// List of thrown errors: /// [AuthenticationError]() /// [AuthorizationError]() /// [HeaderError]() /// [InternalError]() /// [QuotaError]() /// [RequestError]() /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="cancellationToken">A <see cref="st::CancellationToken"/> to use for this RPC.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task<gagvr::CampaignFeed> GetCampaignFeedAsync(GetCampaignFeedRequest request, st::CancellationToken cancellationToken) => GetCampaignFeedAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken)); /// <summary> /// Returns the requested campaign feed in full detail. /// /// List of thrown errors: /// [AuthenticationError]() /// [AuthorizationError]() /// [HeaderError]() /// [InternalError]() /// [QuotaError]() /// [RequestError]() /// </summary> /// <param name="resourceName"> /// Required. The resource name of the campaign feed to fetch. /// </param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>The RPC response.</returns> public virtual gagvr::CampaignFeed GetCampaignFeed(string resourceName, gaxgrpc::CallSettings callSettings = null) => GetCampaignFeed(new GetCampaignFeedRequest { ResourceName = gax::GaxPreconditions.CheckNotNullOrEmpty(resourceName, nameof(resourceName)), }, callSettings); /// <summary> /// Returns the requested campaign feed in full detail. /// /// List of thrown errors: /// [AuthenticationError]() /// [AuthorizationError]() /// [HeaderError]() /// [InternalError]() /// [QuotaError]() /// [RequestError]() /// </summary> /// <param name="resourceName"> /// Required. The resource name of the campaign feed to fetch. /// </param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task<gagvr::CampaignFeed> GetCampaignFeedAsync(string resourceName, gaxgrpc::CallSettings callSettings = null) => GetCampaignFeedAsync(new GetCampaignFeedRequest { ResourceName = gax::GaxPreconditions.CheckNotNullOrEmpty(resourceName, nameof(resourceName)), }, callSettings); /// <summary> /// Returns the requested campaign feed in full detail. /// /// List of thrown errors: /// [AuthenticationError]() /// [AuthorizationError]() /// [HeaderError]() /// [InternalError]() /// [QuotaError]() /// [RequestError]() /// </summary> /// <param name="resourceName"> /// Required. The resource name of the campaign feed to fetch. /// </param> /// <param name="cancellationToken">A <see cref="st::CancellationToken"/> to use for this RPC.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task<gagvr::CampaignFeed> GetCampaignFeedAsync(string resourceName, st::CancellationToken cancellationToken) => GetCampaignFeedAsync(resourceName, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken)); /// <summary> /// Returns the requested campaign feed in full detail. /// /// List of thrown errors: /// [AuthenticationError]() /// [AuthorizationError]() /// [HeaderError]() /// [InternalError]() /// [QuotaError]() /// [RequestError]() /// </summary> /// <param name="resourceName"> /// Required. The resource name of the campaign feed to fetch. /// </param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>The RPC response.</returns> public virtual gagvr::CampaignFeed GetCampaignFeed(gagvr::CampaignFeedName resourceName, gaxgrpc::CallSettings callSettings = null) => GetCampaignFeed(new GetCampaignFeedRequest { ResourceNameAsCampaignFeedName = gax::GaxPreconditions.CheckNotNull(resourceName, nameof(resourceName)), }, callSettings); /// <summary> /// Returns the requested campaign feed in full detail. /// /// List of thrown errors: /// [AuthenticationError]() /// [AuthorizationError]() /// [HeaderError]() /// [InternalError]() /// [QuotaError]() /// [RequestError]() /// </summary> /// <param name="resourceName"> /// Required. The resource name of the campaign feed to fetch. /// </param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task<gagvr::CampaignFeed> GetCampaignFeedAsync(gagvr::CampaignFeedName resourceName, gaxgrpc::CallSettings callSettings = null) => GetCampaignFeedAsync(new GetCampaignFeedRequest { ResourceNameAsCampaignFeedName = gax::GaxPreconditions.CheckNotNull(resourceName, nameof(resourceName)), }, callSettings); /// <summary> /// Returns the requested campaign feed in full detail. /// /// List of thrown errors: /// [AuthenticationError]() /// [AuthorizationError]() /// [HeaderError]() /// [InternalError]() /// [QuotaError]() /// [RequestError]() /// </summary> /// <param name="resourceName"> /// Required. The resource name of the campaign feed to fetch. /// </param> /// <param name="cancellationToken">A <see cref="st::CancellationToken"/> to use for this RPC.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task<gagvr::CampaignFeed> GetCampaignFeedAsync(gagvr::CampaignFeedName resourceName, st::CancellationToken cancellationToken) => GetCampaignFeedAsync(resourceName, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken)); /// <summary> /// Creates, updates, or removes campaign feeds. Operation statuses are /// returned. /// /// List of thrown errors: /// [AuthenticationError]() /// [AuthorizationError]() /// [CampaignFeedError]() /// [CollectionSizeError]() /// [DatabaseError]() /// [DistinctError]() /// [FieldError]() /// [FunctionError]() /// [FunctionParsingError]() /// [HeaderError]() /// [IdError]() /// [InternalError]() /// [MutateError]() /// [NotEmptyError]() /// [NullError]() /// [OperationAccessDeniedError]() /// [OperatorError]() /// [QuotaError]() /// [RangeError]() /// [RequestError]() /// [SizeLimitError]() /// [StringFormatError]() /// [StringLengthError]() /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>The RPC response.</returns> public virtual MutateCampaignFeedsResponse MutateCampaignFeeds(MutateCampaignFeedsRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException(); /// <summary> /// Creates, updates, or removes campaign feeds. Operation statuses are /// returned. /// /// List of thrown errors: /// [AuthenticationError]() /// [AuthorizationError]() /// [CampaignFeedError]() /// [CollectionSizeError]() /// [DatabaseError]() /// [DistinctError]() /// [FieldError]() /// [FunctionError]() /// [FunctionParsingError]() /// [HeaderError]() /// [IdError]() /// [InternalError]() /// [MutateError]() /// [NotEmptyError]() /// [NullError]() /// [OperationAccessDeniedError]() /// [OperatorError]() /// [QuotaError]() /// [RangeError]() /// [RequestError]() /// [SizeLimitError]() /// [StringFormatError]() /// [StringLengthError]() /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task<MutateCampaignFeedsResponse> MutateCampaignFeedsAsync(MutateCampaignFeedsRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException(); /// <summary> /// Creates, updates, or removes campaign feeds. Operation statuses are /// returned. /// /// List of thrown errors: /// [AuthenticationError]() /// [AuthorizationError]() /// [CampaignFeedError]() /// [CollectionSizeError]() /// [DatabaseError]() /// [DistinctError]() /// [FieldError]() /// [FunctionError]() /// [FunctionParsingError]() /// [HeaderError]() /// [IdError]() /// [InternalError]() /// [MutateError]() /// [NotEmptyError]() /// [NullError]() /// [OperationAccessDeniedError]() /// [OperatorError]() /// [QuotaError]() /// [RangeError]() /// [RequestError]() /// [SizeLimitError]() /// [StringFormatError]() /// [StringLengthError]() /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="cancellationToken">A <see cref="st::CancellationToken"/> to use for this RPC.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task<MutateCampaignFeedsResponse> MutateCampaignFeedsAsync(MutateCampaignFeedsRequest request, st::CancellationToken cancellationToken) => MutateCampaignFeedsAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken)); /// <summary> /// Creates, updates, or removes campaign feeds. Operation statuses are /// returned. /// /// List of thrown errors: /// [AuthenticationError]() /// [AuthorizationError]() /// [CampaignFeedError]() /// [CollectionSizeError]() /// [DatabaseError]() /// [DistinctError]() /// [FieldError]() /// [FunctionError]() /// [FunctionParsingError]() /// [HeaderError]() /// [IdError]() /// [InternalError]() /// [MutateError]() /// [NotEmptyError]() /// [NullError]() /// [OperationAccessDeniedError]() /// [OperatorError]() /// [QuotaError]() /// [RangeError]() /// [RequestError]() /// [SizeLimitError]() /// [StringFormatError]() /// [StringLengthError]() /// </summary> /// <param name="customerId"> /// Required. The ID of the customer whose campaign feeds are being modified. /// </param> /// <param name="operations"> /// Required. The list of operations to perform on individual campaign feeds. /// </param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>The RPC response.</returns> public virtual MutateCampaignFeedsResponse MutateCampaignFeeds(string customerId, scg::IEnumerable<CampaignFeedOperation> operations, gaxgrpc::CallSettings callSettings = null) => MutateCampaignFeeds(new MutateCampaignFeedsRequest { CustomerId = gax::GaxPreconditions.CheckNotNullOrEmpty(customerId, nameof(customerId)), Operations = { gax::GaxPreconditions.CheckNotNull(operations, nameof(operations)), }, }, callSettings); /// <summary> /// Creates, updates, or removes campaign feeds. Operation statuses are /// returned. /// /// List of thrown errors: /// [AuthenticationError]() /// [AuthorizationError]() /// [CampaignFeedError]() /// [CollectionSizeError]() /// [DatabaseError]() /// [DistinctError]() /// [FieldError]() /// [FunctionError]() /// [FunctionParsingError]() /// [HeaderError]() /// [IdError]() /// [InternalError]() /// [MutateError]() /// [NotEmptyError]() /// [NullError]() /// [OperationAccessDeniedError]() /// [OperatorError]() /// [QuotaError]() /// [RangeError]() /// [RequestError]() /// [SizeLimitError]() /// [StringFormatError]() /// [StringLengthError]() /// </summary> /// <param name="customerId"> /// Required. The ID of the customer whose campaign feeds are being modified. /// </param> /// <param name="operations"> /// Required. The list of operations to perform on individual campaign feeds. /// </param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task<MutateCampaignFeedsResponse> MutateCampaignFeedsAsync(string customerId, scg::IEnumerable<CampaignFeedOperation> operations, gaxgrpc::CallSettings callSettings = null) => MutateCampaignFeedsAsync(new MutateCampaignFeedsRequest { CustomerId = gax::GaxPreconditions.CheckNotNullOrEmpty(customerId, nameof(customerId)), Operations = { gax::GaxPreconditions.CheckNotNull(operations, nameof(operations)), }, }, callSettings); /// <summary> /// Creates, updates, or removes campaign feeds. Operation statuses are /// returned. /// /// List of thrown errors: /// [AuthenticationError]() /// [AuthorizationError]() /// [CampaignFeedError]() /// [CollectionSizeError]() /// [DatabaseError]() /// [DistinctError]() /// [FieldError]() /// [FunctionError]() /// [FunctionParsingError]() /// [HeaderError]() /// [IdError]() /// [InternalError]() /// [MutateError]() /// [NotEmptyError]() /// [NullError]() /// [OperationAccessDeniedError]() /// [OperatorError]() /// [QuotaError]() /// [RangeError]() /// [RequestError]() /// [SizeLimitError]() /// [StringFormatError]() /// [StringLengthError]() /// </summary> /// <param name="customerId"> /// Required. The ID of the customer whose campaign feeds are being modified. /// </param> /// <param name="operations"> /// Required. The list of operations to perform on individual campaign feeds. /// </param> /// <param name="cancellationToken">A <see cref="st::CancellationToken"/> to use for this RPC.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task<MutateCampaignFeedsResponse> MutateCampaignFeedsAsync(string customerId, scg::IEnumerable<CampaignFeedOperation> operations, st::CancellationToken cancellationToken) => MutateCampaignFeedsAsync(customerId, operations, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken)); } /// <summary>CampaignFeedService client wrapper implementation, for convenient use.</summary> /// <remarks> /// Service to manage campaign feeds. /// </remarks> public sealed partial class CampaignFeedServiceClientImpl : CampaignFeedServiceClient { private readonly gaxgrpc::ApiCall<GetCampaignFeedRequest, gagvr::CampaignFeed> _callGetCampaignFeed; private readonly gaxgrpc::ApiCall<MutateCampaignFeedsRequest, MutateCampaignFeedsResponse> _callMutateCampaignFeeds; /// <summary> /// Constructs a client wrapper for the CampaignFeedService service, with the specified gRPC client and /// settings. /// </summary> /// <param name="grpcClient">The underlying gRPC client.</param> /// <param name="settings">The base <see cref="CampaignFeedServiceSettings"/> used within this client.</param> public CampaignFeedServiceClientImpl(CampaignFeedService.CampaignFeedServiceClient grpcClient, CampaignFeedServiceSettings settings) { GrpcClient = grpcClient; CampaignFeedServiceSettings effectiveSettings = settings ?? CampaignFeedServiceSettings.GetDefault(); gaxgrpc::ClientHelper clientHelper = new gaxgrpc::ClientHelper(effectiveSettings); _callGetCampaignFeed = clientHelper.BuildApiCall<GetCampaignFeedRequest, gagvr::CampaignFeed>(grpcClient.GetCampaignFeedAsync, grpcClient.GetCampaignFeed, effectiveSettings.GetCampaignFeedSettings).WithGoogleRequestParam("resource_name", request => request.ResourceName); Modify_ApiCall(ref _callGetCampaignFeed); Modify_GetCampaignFeedApiCall(ref _callGetCampaignFeed); _callMutateCampaignFeeds = clientHelper.BuildApiCall<MutateCampaignFeedsRequest, MutateCampaignFeedsResponse>(grpcClient.MutateCampaignFeedsAsync, grpcClient.MutateCampaignFeeds, effectiveSettings.MutateCampaignFeedsSettings).WithGoogleRequestParam("customer_id", request => request.CustomerId); Modify_ApiCall(ref _callMutateCampaignFeeds); Modify_MutateCampaignFeedsApiCall(ref _callMutateCampaignFeeds); OnConstruction(grpcClient, effectiveSettings, clientHelper); } partial void Modify_ApiCall<TRequest, TResponse>(ref gaxgrpc::ApiCall<TRequest, TResponse> call) where TRequest : class, proto::IMessage<TRequest> where TResponse : class, proto::IMessage<TResponse>; partial void Modify_GetCampaignFeedApiCall(ref gaxgrpc::ApiCall<GetCampaignFeedRequest, gagvr::CampaignFeed> call); partial void Modify_MutateCampaignFeedsApiCall(ref gaxgrpc::ApiCall<MutateCampaignFeedsRequest, MutateCampaignFeedsResponse> call); partial void OnConstruction(CampaignFeedService.CampaignFeedServiceClient grpcClient, CampaignFeedServiceSettings effectiveSettings, gaxgrpc::ClientHelper clientHelper); /// <summary>The underlying gRPC CampaignFeedService client</summary> public override CampaignFeedService.CampaignFeedServiceClient GrpcClient { get; } partial void Modify_GetCampaignFeedRequest(ref GetCampaignFeedRequest request, ref gaxgrpc::CallSettings settings); partial void Modify_MutateCampaignFeedsRequest(ref MutateCampaignFeedsRequest request, ref gaxgrpc::CallSettings settings); /// <summary> /// Returns the requested campaign feed in full detail. /// /// List of thrown errors: /// [AuthenticationError]() /// [AuthorizationError]() /// [HeaderError]() /// [InternalError]() /// [QuotaError]() /// [RequestError]() /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>The RPC response.</returns> public override gagvr::CampaignFeed GetCampaignFeed(GetCampaignFeedRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_GetCampaignFeedRequest(ref request, ref callSettings); return _callGetCampaignFeed.Sync(request, callSettings); } /// <summary> /// Returns the requested campaign feed in full detail. /// /// List of thrown errors: /// [AuthenticationError]() /// [AuthorizationError]() /// [HeaderError]() /// [InternalError]() /// [QuotaError]() /// [RequestError]() /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public override stt::Task<gagvr::CampaignFeed> GetCampaignFeedAsync(GetCampaignFeedRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_GetCampaignFeedRequest(ref request, ref callSettings); return _callGetCampaignFeed.Async(request, callSettings); } /// <summary> /// Creates, updates, or removes campaign feeds. Operation statuses are /// returned. /// /// List of thrown errors: /// [AuthenticationError]() /// [AuthorizationError]() /// [CampaignFeedError]() /// [CollectionSizeError]() /// [DatabaseError]() /// [DistinctError]() /// [FieldError]() /// [FunctionError]() /// [FunctionParsingError]() /// [HeaderError]() /// [IdError]() /// [InternalError]() /// [MutateError]() /// [NotEmptyError]() /// [NullError]() /// [OperationAccessDeniedError]() /// [OperatorError]() /// [QuotaError]() /// [RangeError]() /// [RequestError]() /// [SizeLimitError]() /// [StringFormatError]() /// [StringLengthError]() /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>The RPC response.</returns> public override MutateCampaignFeedsResponse MutateCampaignFeeds(MutateCampaignFeedsRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_MutateCampaignFeedsRequest(ref request, ref callSettings); return _callMutateCampaignFeeds.Sync(request, callSettings); } /// <summary> /// Creates, updates, or removes campaign feeds. Operation statuses are /// returned. /// /// List of thrown errors: /// [AuthenticationError]() /// [AuthorizationError]() /// [CampaignFeedError]() /// [CollectionSizeError]() /// [DatabaseError]() /// [DistinctError]() /// [FieldError]() /// [FunctionError]() /// [FunctionParsingError]() /// [HeaderError]() /// [IdError]() /// [InternalError]() /// [MutateError]() /// [NotEmptyError]() /// [NullError]() /// [OperationAccessDeniedError]() /// [OperatorError]() /// [QuotaError]() /// [RangeError]() /// [RequestError]() /// [SizeLimitError]() /// [StringFormatError]() /// [StringLengthError]() /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public override stt::Task<MutateCampaignFeedsResponse> MutateCampaignFeedsAsync(MutateCampaignFeedsRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_MutateCampaignFeedsRequest(ref request, ref callSettings); return _callMutateCampaignFeeds.Async(request, callSettings); } } }
48.149752
563
0.630485
[ "Apache-2.0" ]
deni-skaraudio/google-ads-dotnet
src/V8/Services/CampaignFeedServiceClient.g.cs
38,905
C#
using System.Collections; using System.Collections.Generic; using UnityEngine; public class TeamTesting : MonoBehaviour { public enum TestingTeams { police, civillian, spy}; public List<MovementTest> policePlayers = new List<MovementTest>(); public List<MovementTest> civillianPlayers = new List<MovementTest>(); public List<MovementTest> spyPlayers = new List<MovementTest>(); public Mesh[] teamMeshes; public void AddToList(PlayerTeamTest playerToAdd) { switch (playerToAdd.myTeam) { case TestingTeams.police: policePlayers.Add(playerToAdd.GetComponentInParent<MovementTest>()); break; case TestingTeams.civillian: civillianPlayers.Add(playerToAdd.GetComponentInParent<MovementTest>()); break; case TestingTeams.spy: spyPlayers.Add(playerToAdd.GetComponentInParent<MovementTest>()); break; } } }
32.935484
88
0.635651
[ "MIT" ]
PaandaB/Ant_Undercover
Assets/Scripts/Testing/TeamTesting.cs
1,023
C#
// MIT License // // Copyright (c) 2020 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. using FirstFloor.ModernUI.Windows.Controls; using JSSoft.Fonts.ApplicationHost.Input; using JSSoft.ModernUI.Framework; using System.ComponentModel.Composition; using System.Windows.Input; namespace JSSoft.Fonts.ApplicationHost { /// <summary> /// ShellView.xaml에 대한 상호 작용 논리 /// </summary> [Export] public partial class ShellView : ModernWindow { public ShellView() { InitializeComponent(); } [ImportingConstructor] public ShellView(IShell shell, IAppConfiguration configs, ICharacterNavigator navigator, IUndoService undoService) { InitializeComponent(); this.CommandBindings.Add(new CommandBinding(FontCommands.NavigateBackward, NavigateBackward_Execute, NavigateBackward_CanExecute)); this.CommandBindings.Add(new CommandBinding(FontCommands.NavigateForward, NavigateForward_Execute, NavigateForward_CanExecute)); this.CommandBindings.Add(new CommandBinding(FontCommands.Undo, Undo_Execute, Undo_CanExecute)); this.CommandBindings.Add(new CommandBinding(FontCommands.Redo, Redo_Execute, Redo_CanExecute)); ApplicationService.SetShell(this, shell); ApplicationService.SetConfigs(this, configs); ApplicationService.SetCharacterNavigator(this, navigator); ApplicationService.SetUndoService(this, undoService); } public ICharacterNavigator Navigator => ApplicationService.GetCharacterNavigator(this); public IUndoService UndoService => ApplicationService.GetUndoService(this); protected override void OnPreviewKeyDown(KeyEventArgs e) { base.OnPreviewKeyDown(e); } private void NavigateBackward_Execute(object sender, ExecutedRoutedEventArgs e) { this.Navigator.Backward(); } private void NavigateBackward_CanExecute(object sender, CanExecuteRoutedEventArgs e) { e.CanExecute = this.Navigator.CanBackward; e.Handled = true; } private void NavigateForward_Execute(object sender, ExecutedRoutedEventArgs e) { this.Navigator.Forward(); } private void NavigateForward_CanExecute(object sender, CanExecuteRoutedEventArgs e) { e.CanExecute = this.Navigator.CanForward; e.Handled = true; } private void Undo_Execute(object sender, ExecutedRoutedEventArgs e) { this.UndoService.Undo(); e.Handled = true; } private void Undo_CanExecute(object sender, CanExecuteRoutedEventArgs e) { e.CanExecute = this.UndoService.CanUndo; e.Handled = true; } private void Redo_Execute(object sender, ExecutedRoutedEventArgs e) { this.UndoService.Redo(); e.Handled = true; } private void Redo_CanExecute(object sender, CanExecuteRoutedEventArgs e) { e.CanExecute = this.UndoService.CanRedo; e.Handled = true; } } }
37.928571
143
0.686676
[ "MIT" ]
s2quake/JSSoft.Font
JSSoft.Fonts.ApplicationHost/ShellView.xaml.cs
4,268
C#
using Bb.Brokers; using Bb.Workflows; using Bb.Workflows.Models; using System; namespace Bb.Workflows.Services { public class EngineFactory { /// <summary> /// Ctor /// </summary> /// <param name="path"></param> public EngineFactory(EngineGeneratorConfiguration configuration) { this._engineCreator = new EngineGenerator<RunContext>(configuration); } /// <summary> /// Ctor /// </summary> /// <param name="path"></param> public EngineFactory SetRootPath(string path) { this._path = path; this._engineCreator.SetPath(this._path); return this; } /// <summary> /// Return current <see cref="WorkflowEngine"/> /// </summary> /// <returns></returns> public WorkflowEngine Get() { if (this._engine == null) Refresh(); return this._engine; } public bool Initialized { get => this._engine != null; } /// <summary> /// Refresh current <see cref="WorkflowEngine"/> /// </summary> /// <returns></returns> public WorkflowEngine Refresh() { WorkflowEngine result = null; lock (_lock1) { result = this._engine; this._engine = Create(); } return result; } /// <summary> /// Remove current <see cref="WorkflowEngine"/> /// </summary> /// <returns></returns> public WorkflowEngine Clean() { WorkflowEngine result = null; lock (_lock1) { result = this._engine; this._engine = null; } return result; } private WorkflowEngine Create() { return this._engineCreator.CreateEngine(); } private volatile object _lock1 = new object(); private string _path; private readonly EngineGenerator<RunContext> _engineCreator; private WorkflowEngine _engine; } }
21.93
81
0.502508
[ "BSD-3-Clause" ]
Moleculars/Sample
src/Black.Beard.Web.Workflow/Services/EngineFactory.cs
2,195
C#
using System; using System.Collections.Generic; using System.Text; #pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释 namespace NeteaseCloudMusicAPI.JsonBase { public sealed class MVResult { public string LoadingPic { get; set; } public string BufferPic { get; set; } public string LoadingPicFs { get; set; } public string BufferPicFs { get; set; } public bool Subed { get; set; } public Data Data { get; set; } public long Code { get; set; } } public sealed class Data { public long Id { get; set; } public string Name { get; set; } public long ArtistId { get; set; } public string ArtistName { get; set; } public string BriefDesc { get; set; } public string Desc { get; set; } public string Cover { get; set; } public long CoverId { get; set; } public long PlayCount { get; set; } public long SubCount { get; set; } public long ShareCount { get; set; } public long LikeCount { get; set; } public long CommentCount { get; set; } public long Duration { get; set; } public long NType { get; set; } public DateTime PublishTime { get; set; } public Brs Brs { get; set; } public Artist[] Artists { get; set; } public bool IsReward { get; set; } public string CommentThreadId { get; set; } } public sealed class Brs { public string The480 { get; set; } public string The240 { get; set; } public string The720 { get; set; } } }
31.509804
54
0.584941
[ "Apache-2.0" ]
textGamex/CloudMusicAPI
NeteaseCloudMusicAPI/JsonBase/MvBase.cs
1,639
C#
using System; using PoESkillTree.Engine.Computation.Common.Builders.Conditions; using PoESkillTree.Engine.Computation.Common.Builders.Resolving; namespace PoESkillTree.Engine.Computation.Common.Builders.Values { public class ValueBuilderStub : IValueBuilder { public double Value { get; } public ValueBuilderStub(double value) { Value = value; } public static double Convert(IValueBuilder value) { if (value is ValueBuilder b) { // Easiest way to get the underlying value back. value = b.Resolve(null!); } return ((ValueBuilderStub) value).Value; } public IValueBuilder Resolve(ResolveContext context) => this; public IValueBuilder MaximumOnly => throw new NotSupportedException(); public IValueBuilder Average => throw new NotSupportedException(); public IConditionBuilder Eq(IValueBuilder other) => new ConditionBuilderStub(Value == Convert(other)); public IConditionBuilder GreaterThan(IValueBuilder other) => new ConditionBuilderStub(Value > Convert(other)); public IValueBuilder Add(IValueBuilder other) => new ValueBuilderStub(Value + Convert(other)); public IValueBuilder Multiply(IValueBuilder other) => new ValueBuilderStub(Value * Convert(other)); public IValueBuilder DivideBy(IValueBuilder divisor) => new ValueBuilderStub(Value / Convert(divisor)); public IValueBuilder If(IValue condition) => throw new NotSupportedException(); public IValueBuilder Select(Func<NodeValue, NodeValue> selector, Func<IValue, string> identity) => new ValueBuilderStub(selector(new NodeValue(Value)).Single); public IValueBuilder Create(double value) => new ValueBuilderStub(value); public IValue Build(BuildParameters parameters) => new Constant(Value); } }
36.272727
107
0.667669
[ "MIT" ]
BlazesRus/PoESkillTreeBlazesRusBranch.Engine
PoESkillTree.Engine.Computation.Common.Tests/Builders/Values/ValueBuilderStub.cs
1,997
C#
using System.Collections.Generic; using System.Security.Cryptography; using System.Threading; using System.Threading.Tasks; using Fido2NetLib.Objects; namespace Fido2NetLib { /// <summary> /// Public API for parsing and veriyfing FIDO2 attestation & assertion responses. /// </summary> public partial class Fido2 : IFido2 { private readonly Fido2Configuration _config; private readonly IMetadataService? _metadataService; public Fido2( Fido2Configuration config, IMetadataService? metadataService = null) { _config = config; _metadataService = metadataService; } /// <summary> /// Returns CredentialCreateOptions including a challenge to be sent to the browser/authr to create new credentials /// </summary> /// <returns></returns> /// <param name="excludeCredentials">Recommended. This member is intended for use by Relying Parties that wish to limit the creation of multiple credentials for the same account on a single authenticator.The client is requested to return an error if the new credential would be created on an authenticator that also contains one of the credentials enumerated in this parameter.</param> public CredentialCreateOptions RequestNewCredential( Fido2User user, List<PublicKeyCredentialDescriptor> excludeCredentials, AuthenticationExtensionsClientInputs? extensions = null) { return RequestNewCredential(user, excludeCredentials, AuthenticatorSelection.Default, AttestationConveyancePreference.None, extensions); } /// <summary> /// Returns CredentialCreateOptions including a challenge to be sent to the browser/authr to create new credentials /// </summary> /// <returns></returns> /// <param name="attestationPreference">This member is intended for use by Relying Parties that wish to express their preference for attestation conveyance. The default is none.</param> /// <param name="excludeCredentials">Recommended. This member is intended for use by Relying Parties that wish to limit the creation of multiple credentials for the same account on a single authenticator.The client is requested to return an error if the new credential would be created on an authenticator that also contains one of the credentials enumerated in this parameter.</param> public CredentialCreateOptions RequestNewCredential( Fido2User user, List<PublicKeyCredentialDescriptor> excludeCredentials, AuthenticatorSelection authenticatorSelection, AttestationConveyancePreference attestationPreference, AuthenticationExtensionsClientInputs? extensions = null) { var challenge = new byte[_config.ChallengeSize]; RandomNumberGenerator.Fill(challenge); var options = CredentialCreateOptions.Create(_config, challenge, user, authenticatorSelection, attestationPreference, excludeCredentials, extensions); return options; } /// <summary> /// Verifies the response from the browser/authr after creating new credentials /// </summary> /// <param name="attestationResponse"></param> /// <param name="origChallenge"></param> /// <param name="isCredentialIdUniqueToUser"></param> /// <param name="requestTokenBindingId"></param> /// <param name="cancellationToken"></param> /// <returns></returns> public async Task<CredentialMakeResult> MakeNewCredentialAsync( AuthenticatorAttestationRawResponse attestationResponse, CredentialCreateOptions origChallenge, IsCredentialIdUniqueToUserAsyncDelegate isCredentialIdUniqueToUser, byte[]? requestTokenBindingId = null, CancellationToken cancellationToken = default) { var parsedResponse = AuthenticatorAttestationResponse.Parse(attestationResponse); var success = await parsedResponse.VerifyAsync(origChallenge, _config, isCredentialIdUniqueToUser, _metadataService, requestTokenBindingId, cancellationToken); // todo: Set Errormessage etc. return new CredentialMakeResult( status : "ok", errorMessage : string.Empty, result : success ); } /// <summary> /// Returns AssertionOptions including a challenge to the browser/authr to assert existing credentials and authenticate a user. /// </summary> /// <returns></returns> public AssertionOptions GetAssertionOptions( IEnumerable<PublicKeyCredentialDescriptor> allowedCredentials, UserVerificationRequirement? userVerification, AuthenticationExtensionsClientInputs? extensions = null) { var challenge = new byte[_config.ChallengeSize]; RandomNumberGenerator.Fill(challenge); var options = AssertionOptions.Create(_config, challenge, allowedCredentials, userVerification, extensions); return options; } /// <summary> /// Verifies the assertion response from the browser/authr to assert existing credentials and authenticate a user. /// </summary> /// <returns></returns> public async Task<AssertionVerificationResult> MakeAssertionAsync( AuthenticatorAssertionRawResponse assertionResponse, AssertionOptions originalOptions, byte[] storedPublicKey, uint storedSignatureCounter, IsUserHandleOwnerOfCredentialIdAsync isUserHandleOwnerOfCredentialIdCallback, byte[]? requestTokenBindingId = null, CancellationToken cancellationToken = default) { var parsedResponse = AuthenticatorAssertionResponse.Parse(assertionResponse); var result = await parsedResponse.VerifyAsync(originalOptions, _config.FullyQualifiedOrigins, storedPublicKey, storedSignatureCounter, isUserHandleOwnerOfCredentialIdCallback, requestTokenBindingId, cancellationToken); return result; } /// <summary> /// Result of parsing and verifying attestation. Used to transport Public Key back to RP /// </summary> public sealed class CredentialMakeResult : Fido2ResponseBase { public CredentialMakeResult(string status, string errorMessage, AttestationVerificationSuccess? result) { Status = status; ErrorMessage = errorMessage; Result = result; } public AttestationVerificationSuccess? Result { get; } // todo: add debuginfo? } } /// <summary> /// Callback function used to validate that the CredentialID is unique to this User /// </summary> /// <param name="credentialIdUserParams"></param> /// <returns></returns> public delegate Task<bool> IsCredentialIdUniqueToUserAsyncDelegate(IsCredentialIdUniqueToUserParams credentialIdUserParams, CancellationToken cancellationToken); /// <summary> /// Callback function used to validate that the Userhandle is indeed owned of the CrendetialId /// </summary> /// <param name="credentialIdUserHandleParams"></param> /// <returns></returns> public delegate Task<bool> IsUserHandleOwnerOfCredentialIdAsync(IsUserHandleOwnerOfCredentialIdParams credentialIdUserHandleParams, CancellationToken cancellationToken); }
50.443038
393
0.65872
[ "MIT" ]
adricasti/fido2-net-lib
Src/Fido2/Fido2NetLib.cs
7,972
C#
using System; using System.Runtime.InteropServices; namespace Checs { internal static unsafe class ArchetypeUtility { public static void ConstructComponentData(Archetype* archetype, Span<int> componentTypes, Span<int> componentSizes, int hashCode) { archetype->entityCount = 0; archetype->componentCount = componentSizes.Length; // Temporary fix... see CreateArchetype() archetype->componentHashCode = hashCode; if(componentSizes.Length == 0) return; var size = componentSizes.Length * sizeof(int); archetype->componentTypes = (int*)MemoryUtility.Malloc(size); archetype->componentSizes = (int*)MemoryUtility.Malloc(size); fixed(int* srcTypes = componentTypes, srcSizes = componentSizes) { Buffer.MemoryCopy(srcTypes, archetype->componentTypes, size, size); Buffer.MemoryCopy(srcSizes, archetype->componentSizes, size, size); } } public static void CalculateComponentOffsets(Archetype* archetype, int chunkCapacity) { var count = archetype->componentCount; var componentSizes = archetype->componentSizes; int* offsets = MemoryUtility.Malloc<int>(count); // This can be done in ConstructComponentData. offsets[0] = sizeof(Entity) * chunkCapacity; for(int i = 1; i < count; ++i) offsets[i] = offsets[i - 1] + (chunkCapacity * componentSizes[i - 1]); archetype->componentOffsets = offsets; } public static int GetTypeIndex(Archetype* archetype, int typeIndex) { // TODO: Optimize with Vector. var types = archetype->componentTypes; var count = archetype->componentCount; for(int i = 0; i < count; ++i) { if(types[i] == typeIndex) return i; } return -1; } } }
27.274194
98
0.706091
[ "MIT" ]
dn9090/Checs
src/Checs/ArchetypeUtility.cs
1,691
C#
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; 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: AssemblyVersion("2.7.0.0")] [assembly: AssemblyInformationalVersion("2.9.14")] [assembly: AssemblyTrademark("Microsoft and Windows are registered trademarks of Microsoft Corporation.")] [assembly: AssemblyDelaySign(false)] // These May change from assembly to assembly, but not likely [assembly: ComVisible(false)] [assembly: CLSCompliant(true)] // These attributes should be changed for each assembly. [assembly: AssemblyTitle("Its.Log")] [assembly: InternalsVisibleTo("Its.Log.UnitTests")]
34.571429
106
0.786157
[ "MIT" ]
jonsequitur/Its.Log
Its.Log/Properties/AssemblyInfo.cs
970
C#
namespace HarmornyHelper.forms { partial class ScalesControl { /// <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 Component 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() { this._inputPanel = new System.Windows.Forms.Panel(); this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this._comboScaleTypes = new System.Windows.Forms.ComboBox(); this._comboKeys = new System.Windows.Forms.ComboBox(); this._outputPanel = new System.Windows.Forms.Panel(); this._textBox = new System.Windows.Forms.TextBox(); this._inputPanel.SuspendLayout(); this._outputPanel.SuspendLayout(); this.SuspendLayout(); // // _inputPanel // this._inputPanel.Controls.Add(this.label2); this._inputPanel.Controls.Add(this.label1); this._inputPanel.Controls.Add(this._comboScaleTypes); this._inputPanel.Controls.Add(this._comboKeys); this._inputPanel.Dock = System.Windows.Forms.DockStyle.Top; this._inputPanel.Location = new System.Drawing.Point(0, 0); this._inputPanel.Name = "_inputPanel"; this._inputPanel.Size = new System.Drawing.Size(800, 100); this._inputPanel.TabIndex = 1; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(150, 46); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(64, 13); this.label2.TabIndex = 1; this.label2.Text = "Scale Type:"; // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(13, 46); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(28, 13); this.label1.TabIndex = 1; this.label1.Text = "Key:"; // // _comboScaleTypes // this._comboScaleTypes.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this._comboScaleTypes.FormattingEnabled = true; this._comboScaleTypes.Location = new System.Drawing.Point(220, 43); this._comboScaleTypes.Name = "_comboScaleTypes"; this._comboScaleTypes.Size = new System.Drawing.Size(176, 21); this._comboScaleTypes.TabIndex = 0; this._comboScaleTypes.SelectionChangeCommitted += new System.EventHandler(this._comboScaleTypes_SelectionChangeCommitted); // // _comboKeys // this._comboKeys.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this._comboKeys.FormattingEnabled = true; this._comboKeys.Location = new System.Drawing.Point(47, 43); this._comboKeys.Name = "_comboKeys"; this._comboKeys.Size = new System.Drawing.Size(64, 21); this._comboKeys.TabIndex = 0; this._comboKeys.SelectionChangeCommitted += new System.EventHandler(this._comboKeys_SelectionChangeCommitted); // // _outputPanel // this._outputPanel.Controls.Add(this._textBox); this._outputPanel.Dock = System.Windows.Forms.DockStyle.Fill; this._outputPanel.Location = new System.Drawing.Point(0, 100); this._outputPanel.Name = "_outputPanel"; this._outputPanel.Size = new System.Drawing.Size(800, 500); this._outputPanel.TabIndex = 2; // // _textBox // this._textBox.Dock = System.Windows.Forms.DockStyle.Right; this._textBox.Location = new System.Drawing.Point(480, 0); this._textBox.Multiline = true; this._textBox.Name = "_textBox"; this._textBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; this._textBox.Size = new System.Drawing.Size(320, 500); this._textBox.TabIndex = 0; // // ScalesControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this._outputPanel); this.Controls.Add(this._inputPanel); this.Name = "ScalesControl"; this.Size = new System.Drawing.Size(800, 600); this._inputPanel.ResumeLayout(false); this._inputPanel.PerformLayout(); this._outputPanel.ResumeLayout(false); this._outputPanel.PerformLayout(); this.ResumeLayout(false); } #endregion private System.Windows.Forms.Panel _inputPanel; private System.Windows.Forms.Panel _outputPanel; private System.Windows.Forms.TextBox _textBox; private System.Windows.Forms.Label label1; private System.Windows.Forms.ComboBox _comboKeys; private System.Windows.Forms.Label label2; private System.Windows.Forms.ComboBox _comboScaleTypes; } }
36.021898
125
0.718946
[ "MIT" ]
emorrison1962/HarmonyHelper
HarmonyHelper/HarmornyHelper.forms/Views/ScalesControl.Designer.cs
4,937
C#
using System.Collections.Generic; using System.Management; namespace WindowsMonitor.Windows.Jobs { /// <summary> /// </summary> public sealed class NamedJobObjectStatistics { public string Collection { get; private set; } public string Stats { get; private set; } public static IEnumerable<NamedJobObjectStatistics> Retrieve(string remote, string username, string password) { var options = new ConnectionOptions { Impersonation = ImpersonationLevel.Impersonate, Username = username, Password = password }; var managementScope = new ManagementScope(new ManagementPath($"\\\\{remote}\\root\\cimv2"), options); managementScope.Connect(); return Retrieve(managementScope); } public static IEnumerable<NamedJobObjectStatistics> Retrieve() { var managementScope = new ManagementScope(new ManagementPath("root\\cimv2")); return Retrieve(managementScope); } public static IEnumerable<NamedJobObjectStatistics> Retrieve(ManagementScope managementScope) { var objectQuery = new ObjectQuery("SELECT * FROM Win32_NamedJobObjectStatistics"); var objectSearcher = new ManagementObjectSearcher(managementScope, objectQuery); var objectCollection = objectSearcher.Get(); foreach (ManagementObject managementObject in objectCollection) yield return new NamedJobObjectStatistics { Collection = (managementObject.Properties["Collection"]?.Value?.ToString()), Stats = (managementObject.Properties["Stats"]?.Value?.ToString()) }; } } }
37.145833
117
0.637689
[ "MIT" ]
Biztactix/WindowsMonitor
WindowsMonitor.Standard/Windows/Jobs/NamedJobObjectStatistics.cs
1,783
C#
// Licensed under the Apache 2.0 License. See LICENSE.txt in the project root for more information. using ElasticLinq.Logging; using ElasticLinq.Mapping; using System; using System.Diagnostics.CodeAnalysis; using System.Linq.Expressions; using Xunit; namespace ElasticLinq.Test { public class ElasticQueryTests { private static readonly ElasticConnection connection = new ElasticConnection(new Uri("http://localhost")); private static readonly ElasticQueryProvider provider = new ElasticQueryProvider(connection, new TrivialElasticMapping(), NullLog.Instance, NullRetryPolicy.Instance, "prefix"); private static readonly Expression validExpression = Expression.Constant(new ElasticQuery<Sample>(provider)); private class Sample { }; [Fact] [ExcludeFromCodeCoverage] // Expression isn't "executed" public void ConstructorsThrowsArgumentNullExceptionWhenProviderIsNull() { Assert.Throws<ArgumentNullException>(() => new ElasticQuery<Sample>(null)); Assert.Throws<ArgumentNullException>(() => new ElasticQuery<Sample>(null, validExpression)); } [Fact] [ExcludeFromCodeCoverage] // Expression isn't "executed" public void ConstructorsThrowsArgumentOutOfRangeExceptionWhenExpressionIsNotAssignableFromIQueryableT() { var unassignableExpression = Expression.Constant(1); Assert.Throws<ArgumentOutOfRangeException>(() => new ElasticQuery<Sample>(provider, unassignableExpression)); } [Fact] public void ConstructorsSetProviderProperty() { var firstConstructor = new ElasticQuery<Sample>(provider); var secondConstructor = new ElasticQuery<Sample>(provider); Assert.Same(provider, firstConstructor.Provider); Assert.Same(provider, secondConstructor.Provider); } [Fact] public void ConstructorSetsExpressionProperty() { var query = new ElasticQuery<Sample>(provider, validExpression); Assert.Equal(validExpression, query.Expression); } [Fact] public void ConstructorWithNoExpressionDefaultsExpressionPropertyToConstantOfQuery() { var query = new ElasticQuery<Sample>(provider); var constantExpression = Assert.IsType<ConstantExpression>(query.Expression); Assert.Same(query, constantExpression.Value); } [Fact] public void ElementTypePropertyReturnsGenericArgument() { var query = new ElasticQuery<Sample>(provider); var elementType = query.ElementType; Assert.Equal(typeof(Sample), elementType); } } }
37.69863
184
0.683866
[ "Apache-2.0" ]
ethaler/ElasticLINQ
Source/ElasticLINQ.Test/ElasticQueryTests.cs
2,754
C#
using NationalInstruments.InstrumentFramework.Plugins; using System; using System.ComponentModel; using System.Windows; using System.Windows.Controls; using SwitchExecutive.Plugin.Internal.DriverOperations; using SwitchExecutive.Plugin.Internal.Common; namespace SwitchExecutive.Plugin.Internal { public partial class SwitchExecutiveControl : UserControl, IPanelPlugin { public SwitchExecutiveControl( string editTimeConfiguration, string runTimeConfiguration, UpdateConfigurationDelegate updateConfigurationDelegate, PanelPresentation requestedPresentation) { InitializeComponent(); /* used to save/load our view models and models. for save we serialize and return the string to InstrumentStudio via the UpdateConfiguraitonDelegate. This class also handles not saving during load. */ var saveDelegator = new SaveDelegator(updateConfigurationDelegate); /* crete the main view model which creates all the child view models and models. by doing this creation here we imply that the view is created first. Also we: 1. check the registry to see if SwitchExecutive is installed. 2. create a DriverOperations class that is basically our model and conneciton to the driver. 3. create a status option that is shared to all view models. this allows any code to report errors. */ var mainViewModel = new SwitchExecutiveControlViewModel( requestedPresentation, NISwitchExecutiveDriverOperations.IsDriverInstalled(), (ISwitchExecutiveDriverOperations)new NISwitchExecutiveDriverOperations(), (ISave)saveDelegator, (IStatus)new Status()); /* attach the serialize and deserialize commands after. This allows us to create any objects we need prior to creating the ViewModels ... just for a cleaner construction. */ saveDelegator.Attach( serialize: new Func<string>(() => mainViewModel.Serialize()), deserialize: o => mainViewModel.Deserialize(o)); this.DataContext = mainViewModel; // update our state based on the state saved in the .sfp file saveDelegator.Deserialize(editTimeConfiguration); // restore connections from the saved file mainViewModel.ApplyLoadFromFile(); } public FrameworkElement PanelContent => this; public void Shutdown() { } } }
41.354839
115
0.686427
[ "MIT" ]
dixonjoel/niinstrumentstudio-switchexecutive-hosted-application
Source/SwitchExecutive.Plugin/source/Internal/SwitchExecutiveControl.xaml.cs
2,566
C#
namespace EntertainmentSystem.Common.ExtensionMethods { public static class StringExtensions { public static string GetFileName(this string fileFullname) { if (string.IsNullOrWhiteSpace(fileFullname)) { return string.Empty; } var extensionIndex = fileFullname.LastIndexOf("."); if (extensionIndex == 0) { return string.Empty; } if (extensionIndex > 0) { return fileFullname.Remove(extensionIndex); } return fileFullname; } public static string GetFileExtension(this string fileFullname) { if (string.IsNullOrWhiteSpace(fileFullname)) { return string.Empty; } var extensionIndex = fileFullname.LastIndexOf("."); if (extensionIndex < 0 || extensionIndex == fileFullname.Length - 1) { return string.Empty; } var extension = fileFullname.Substring(extensionIndex); return extension; } public static string GetFileContentType(this string filename) { if (string.IsNullOrWhiteSpace(filename)) { return string.Empty; } var extensionIndex = filename.LastIndexOf("."); if (extensionIndex < 0 || extensionIndex == filename.Length - 1) { return string.Empty; } var extension = filename.Substring(extensionIndex + 1); switch (extension) { case "jpg": return "image/jpeg"; case "jpeg": return "image/jpeg"; case "png": return "image/png"; case "gif": return "image/gif"; case "webm": return "video/webm"; case "mp4": return "video/mp4"; case "wav": return "audio/wav"; case "mp3": return "audio/mp3"; case "mpeg": return "audio/mpeg"; default: return string.Empty; } } public static string GetFileExtensionFromContentType(this string contentType) { if (string.IsNullOrEmpty(contentType)) { return string.Empty; } switch (contentType) { case "image/jpeg": return ".jpg"; case "image/png": return ".png"; case "image/gif": return ".gif"; case "video/webm": return ".webm"; case "video/mp4": return ".mp4"; case "audio/wav": return ".wav"; case "audio/mp3": return ".mp3"; case "audio/mpeg": return ".mpeg"; default: return string.Empty; } } } }
29.59596
85
0.488737
[ "MIT" ]
Borayvor/ASP.NET-MVC-CourseProject-2017
PhotoArtSystem/Common/PhotoArtSystem.Common/ExtensionMethods/StringExtensions.cs
2,932
C#
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; using System.Collections.Generic; using Microsoft.AspNetCore.Http; using Microsoft.Azure.WebJobs.Extensions.SignalRService; using Microsoft.Extensions.Primitives; using Microsoft.IdentityModel.Tokens; using Xunit; namespace SignalRServiceExtension.Tests { public class DefaultSecurityTokenValidatorTests { public static IEnumerable<object[]> TestData = new List<object[]> { new object [] { "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiYWFhIiwiZXhwIjoxNjk5ODE5MDI1fQ.joh9CXSfRpgZhoraozdQ0Z1DxmUhlXF4ENt_1Ttz7x8", SecurityTokenStatus.Valid }, new object[] { "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiYWFhIiwiZXhwIjoyNTMwODk4OTIyMjV9.1dbS2bgRrTvxHhph9lh0TLw34a46ts5jwaJH0OeS8-s", SecurityTokenStatus.Error }, new object[] { "", SecurityTokenStatus.Empty } }; [Theory] [MemberData(nameof(TestData))] public void ValidateSecurityTokenFacts(string tokenString, SecurityTokenStatus expectedStatus) { var ctx = new DefaultHttpContext(); var req = ctx.Request; req.Headers.Add("Authorization", new StringValues(tokenString)); var issuerToken = "bXlmdW5jdGlvbmF1dGh0ZXN0"; // base64 encoded for "myfunctionauthtest"; Action<TokenValidationParameters> configureTokenValidationParameters = parameters => { parameters.IssuerSigningKey = new SymmetricSecurityKey(Convert.FromBase64String(issuerToken)); parameters.RequireSignedTokens = true; parameters.ValidateAudience = false; parameters.ValidateIssuer = false; parameters.ValidateIssuerSigningKey = true; parameters.ValidateLifetime = true; }; var securityTokenValidator = new DefaultSecurityTokenValidator(configureTokenValidationParameters); var securityTokenResult = securityTokenValidator.ValidateToken(req); Assert.Equal(expectedStatus, securityTokenResult.Status); } } }
42.566667
223
0.683242
[ "MIT" ]
Azure/azure-functions-signalrservice-extension
test/SignalRServiceExtension.Tests/DefaultSecurityTokenValidatorTests.cs
2,556
C#
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Linq; using Xunit; namespace System.Runtime.Intrinsics.Tests.Vectors { public sealed class Vector64Tests { [Theory] [InlineData(0, 0)] [InlineData(1, 1)] [InlineData(0, 1, 2, 3, 4, 5, 6, 7, 8)] [InlineData(50, 430, int.MaxValue, int.MinValue)] public void Vector64Int32IndexerTest(params int[] values) { var vector = Vector64.Create(values); Assert.Equal(vector[0], values[0]); Assert.Equal(vector[1], values[1]); } [Theory] [InlineData(0L)] [InlineData(1L)] [InlineData(0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L)] [InlineData(50L, 430L, long.MaxValue, long.MinValue)] public void Vector64Int64IndexerTest(params long[] values) { var vector = Vector64.Create(values); Assert.Equal(vector[0], values[0]); } } }
28.621622
71
0.586402
[ "MIT" ]
AntonLapounov/runtime
src/libraries/System.Runtime.Intrinsics/tests/Vectors/Vector64Tests.cs
1,061
C#
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; namespace Microsoft.Coyote.Actors.SharedObjects { /// <summary> /// A thread-safe register that can be shared in-memory by actors. /// </summary> /// <remarks> /// See also <see href="/coyote/concepts/actors/sharing-objects">Sharing Objects</see>. /// </remarks> public static class SharedRegister { /// <summary> /// Creates a new shared register. /// </summary> /// <typeparam name="T">The type of the value.</typeparam> /// <param name="runtime">The actor runtime.</param> /// <param name="value">The initial value.</param> public static SharedRegister<T> Create<T>(IActorRuntime runtime, T value = default) where T : struct { if (runtime is ActorExecutionContext.Mock executionContext) { return new Mock<T>(executionContext, value); } return new SharedRegister<T>(value); } /// <summary> /// Mock implementation of <see cref="SharedRegister{T}"/> that can be controlled during systematic testing. /// </summary> private sealed class Mock<T> : SharedRegister<T> where T : struct { // TODO: port to the new resource API or controlled locks once we integrate actors with tasks. /// <summary> /// Actor modeling the shared register. /// </summary> private readonly ActorId RegisterActor; /// <summary> /// The execution context associated with this shared register. /// </summary> private readonly ActorExecutionContext.Mock Context; /// <summary> /// Initializes a new instance of the <see cref="Mock{T}"/> class. /// </summary> internal Mock(ActorExecutionContext.Mock context, T value) : base(value) { this.Context = context; this.RegisterActor = context.CreateActor(typeof(SharedRegisterActor<T>)); context.SendEvent(this.RegisterActor, SharedRegisterEvent.SetEvent(value)); } /// <summary> /// Reads and updates the register. /// </summary> public override T Update(Func<T, T> func) { var op = this.Context.Runtime.GetExecutingOperation<ActorOperation>(); this.Context.SendEvent(this.RegisterActor, SharedRegisterEvent.UpdateEvent(func, op.Actor.Id)); var e = op.Actor.ReceiveEventAsync(typeof(SharedRegisterResponseEvent<T>)).Result as SharedRegisterResponseEvent<T>; return e.Value; } /// <summary> /// Gets current value of the register. /// </summary> public override T GetValue() { var op = this.Context.Runtime.GetExecutingOperation<ActorOperation>(); this.Context.SendEvent(this.RegisterActor, SharedRegisterEvent.GetEvent(op.Actor.Id)); var e = op.Actor.ReceiveEventAsync(typeof(SharedRegisterResponseEvent<T>)).Result as SharedRegisterResponseEvent<T>; return e.Value; } /// <summary> /// Sets current value of the register. /// </summary> public override void SetValue(T value) { this.Context.SendEvent(this.RegisterActor, SharedRegisterEvent.SetEvent(value)); } } } /// <summary> /// A thread-safe register that can be shared in-memory by actors. /// </summary> /// <typeparam name="T">The type of the value.</typeparam> public class SharedRegister<T> where T : struct { /// <summary> /// Current value of the register. /// </summary> private protected T Value; /// <summary> /// Object used for synchronizing accesses to the register. /// </summary> private readonly object SynchronizationObject; /// <summary> /// Initializes a new instance of the <see cref="SharedRegister{T}"/> class. /// </summary> internal SharedRegister(T value) { this.Value = value; this.SynchronizationObject = new object(); } /// <summary> /// Reads and updates the register. /// </summary> public virtual T Update(Func<T, T> func) { T oldValue, newValue; bool done = false; do { oldValue = this.Value; newValue = func(oldValue); lock (this.SynchronizationObject) { if (oldValue.Equals(this.Value)) { this.Value = newValue; done = true; } } } while (!done); return newValue; } /// <summary> /// Gets current value of the register. /// </summary> public virtual T GetValue() { T currentValue; lock (this.SynchronizationObject) { currentValue = this.Value; } return currentValue; } /// <summary> /// Sets current value of the register. /// </summary> public virtual void SetValue(T value) { lock (this.SynchronizationObject) { this.Value = value; } } } }
33.069364
132
0.529278
[ "MIT" ]
Magicianred/coyote
Source/Core/Actors/SharedObjects/SharedRegister.cs
5,723
C#
/* * LUSID API * * # Introduction This page documents the [LUSID APIs](https://www.lusid.com/api/swagger), which allows authorised clients to query and update their data within the LUSID platform. SDKs to interact with the LUSID APIs are available in the following languages and frameworks: * [C#](https://github.com/finbourne/lusid-sdk-csharp) * [Java](https://github.com/finbourne/lusid-sdk-java) * [JavaScript](https://github.com/finbourne/lusid-sdk-js) * [Python](https://github.com/finbourne/lusid-sdk-python) * [Angular](https://github.com/finbourne/lusid-sdk-angular) The LUSID platform is made up of a number of sub-applications. You can find the API / swagger documentation by following the links in the table below. | Application | Description | API / Swagger Documentation | | - -- -- | - -- -- | - -- - | | LUSID | Open, API-first, developer-friendly investment data platform. | [Swagger](https://www.lusid.com/api/swagger/index.html) | | Web app | User-facing front end for LUSID. | [Swagger](https://www.lusid.com/app/swagger/index.html) | | Scheduler | Automated job scheduler. | [Swagger](https://www.lusid.com/scheduler2/swagger/index.html) | | Insights |Monitoring and troubleshooting service. | [Swagger](https://www.lusid.com/insights/swagger/index.html) | | Identity | Identity management for LUSID (in conjuction with Access) | [Swagger](https://www.lusid.com/identity/swagger/index.html) | | Access | Access control for LUSID (in conjunction with Identity) | [Swagger](https://www.lusid.com/access/swagger/index.html) | | Drive | Secure file repository and manager for collaboration. | [Swagger](https://www.lusid.com/drive/swagger/index.html) | | Luminesce | Data virtualisation service (query data from multiple providers, including LUSID) | [Swagger](https://www.lusid.com/honeycomb/swagger/index.html) | | Notification | Notification service. | [Swagger](https://www.lusid.com/notifications/swagger/index.html) | | Configuration | File store for secrets and other sensitive information. | [Swagger](https://www.lusid.com/configuration/swagger/index.html) | # Error Codes | Code|Name|Description | | - --|- --|- -- | | <a name=\"-10\">-10</a>|Server Configuration Error| | | <a name=\"-1\">-1</a>|Unknown error|An unexpected error was encountered on our side. | | <a name=\"102\">102</a>|Version Not Found| | | <a name=\"103\">103</a>|Api Rate Limit Violation| | | <a name=\"104\">104</a>|Instrument Not Found| | | <a name=\"105\">105</a>|Property Not Found| | | <a name=\"106\">106</a>|Portfolio Recursion Depth| | | <a name=\"108\">108</a>|Group Not Found| | | <a name=\"109\">109</a>|Portfolio Not Found| | | <a name=\"110\">110</a>|Property Schema Not Found| | | <a name=\"111\">111</a>|Portfolio Ancestry Not Found| | | <a name=\"112\">112</a>|Portfolio With Id Already Exists| | | <a name=\"113\">113</a>|Orphaned Portfolio| | | <a name=\"119\">119</a>|Missing Base Claims| | | <a name=\"121\">121</a>|Property Not Defined| | | <a name=\"122\">122</a>|Cannot Delete System Property| | | <a name=\"123\">123</a>|Cannot Modify Immutable Property Field| | | <a name=\"124\">124</a>|Property Already Exists| | | <a name=\"125\">125</a>|Invalid Property Life Time| | | <a name=\"126\">126</a>|Property Constraint Style Excludes Properties| | | <a name=\"127\">127</a>|Cannot Modify Default Data Type| | | <a name=\"128\">128</a>|Group Already Exists| | | <a name=\"129\">129</a>|No Such Data Type| | | <a name=\"130\">130</a>|Undefined Value For Data Type| | | <a name=\"131\">131</a>|Unsupported Value Type Defined On Data Type| | | <a name=\"132\">132</a>|Validation Error| | | <a name=\"133\">133</a>|Loop Detected In Group Hierarchy| | | <a name=\"134\">134</a>|Undefined Acceptable Values| | | <a name=\"135\">135</a>|Sub Group Already Exists| | | <a name=\"138\">138</a>|Price Source Not Found| | | <a name=\"139\">139</a>|Analytic Store Not Found| | | <a name=\"141\">141</a>|Analytic Store Already Exists| | | <a name=\"143\">143</a>|Client Instrument Already Exists| | | <a name=\"144\">144</a>|Duplicate In Parameter Set| | | <a name=\"147\">147</a>|Results Not Found| | | <a name=\"148\">148</a>|Order Field Not In Result Set| | | <a name=\"149\">149</a>|Operation Failed| | | <a name=\"150\">150</a>|Elastic Search Error| | | <a name=\"151\">151</a>|Invalid Parameter Value| | | <a name=\"153\">153</a>|Command Processing Failure| | | <a name=\"154\">154</a>|Entity State Construction Failure| | | <a name=\"155\">155</a>|Entity Timeline Does Not Exist| | | <a name=\"156\">156</a>|Concurrency Conflict Failure| | | <a name=\"157\">157</a>|Invalid Request| | | <a name=\"158\">158</a>|Event Publish Unknown| | | <a name=\"159\">159</a>|Event Query Failure| | | <a name=\"160\">160</a>|Blob Did Not Exist| | | <a name=\"162\">162</a>|Sub System Request Failure| | | <a name=\"163\">163</a>|Sub System Configuration Failure| | | <a name=\"165\">165</a>|Failed To Delete| | | <a name=\"166\">166</a>|Upsert Client Instrument Failure| | | <a name=\"167\">167</a>|Illegal As At Interval| | | <a name=\"168\">168</a>|Illegal Bitemporal Query| | | <a name=\"169\">169</a>|Invalid Alternate Id| | | <a name=\"170\">170</a>|Cannot Add Source Portfolio Property Explicitly| | | <a name=\"171\">171</a>|Entity Already Exists In Group| | | <a name=\"173\">173</a>|Entity With Id Already Exists| | | <a name=\"174\">174</a>|Derived Portfolio Details Do Not Exist| | | <a name=\"176\">176</a>|Portfolio With Name Already Exists| | | <a name=\"177\">177</a>|Invalid Transactions| | | <a name=\"178\">178</a>|Reference Portfolio Not Found| | | <a name=\"179\">179</a>|Duplicate Id| | | <a name=\"180\">180</a>|Command Retrieval Failure| | | <a name=\"181\">181</a>|Data Filter Application Failure| | | <a name=\"182\">182</a>|Search Failed| | | <a name=\"183\">183</a>|Movements Engine Configuration Key Failure| | | <a name=\"184\">184</a>|Fx Rate Source Not Found| | | <a name=\"185\">185</a>|Accrual Source Not Found| | | <a name=\"186\">186</a>|Access Denied| | | <a name=\"187\">187</a>|Invalid Identity Token| | | <a name=\"188\">188</a>|Invalid Request Headers| | | <a name=\"189\">189</a>|Price Not Found| | | <a name=\"190\">190</a>|Invalid Sub Holding Keys Provided| | | <a name=\"191\">191</a>|Duplicate Sub Holding Keys Provided| | | <a name=\"192\">192</a>|Cut Definition Not Found| | | <a name=\"193\">193</a>|Cut Definition Invalid| | | <a name=\"194\">194</a>|Time Variant Property Deletion Date Unspecified| | | <a name=\"195\">195</a>|Perpetual Property Deletion Date Specified| | | <a name=\"196\">196</a>|Time Variant Property Upsert Date Unspecified| | | <a name=\"197\">197</a>|Perpetual Property Upsert Date Specified| | | <a name=\"200\">200</a>|Invalid Unit For Data Type| | | <a name=\"201\">201</a>|Invalid Type For Data Type| | | <a name=\"202\">202</a>|Invalid Value For Data Type| | | <a name=\"203\">203</a>|Unit Not Defined For Data Type| | | <a name=\"204\">204</a>|Units Not Supported On Data Type| | | <a name=\"205\">205</a>|Cannot Specify Units On Data Type| | | <a name=\"206\">206</a>|Unit Schema Inconsistent With Data Type| | | <a name=\"207\">207</a>|Unit Definition Not Specified| | | <a name=\"208\">208</a>|Duplicate Unit Definitions Specified| | | <a name=\"209\">209</a>|Invalid Units Definition| | | <a name=\"210\">210</a>|Invalid Instrument Identifier Unit| | | <a name=\"211\">211</a>|Holdings Adjustment Does Not Exist| | | <a name=\"212\">212</a>|Could Not Build Excel Url| | | <a name=\"213\">213</a>|Could Not Get Excel Version| | | <a name=\"214\">214</a>|Instrument By Code Not Found| | | <a name=\"215\">215</a>|Entity Schema Does Not Exist| | | <a name=\"216\">216</a>|Feature Not Supported On Portfolio Type| | | <a name=\"217\">217</a>|Quote Not Found| | | <a name=\"218\">218</a>|Invalid Quote Identifier| | | <a name=\"219\">219</a>|Invalid Metric For Data Type| | | <a name=\"220\">220</a>|Invalid Instrument Definition| | | <a name=\"221\">221</a>|Instrument Upsert Failure| | | <a name=\"222\">222</a>|Reference Portfolio Request Not Supported| | | <a name=\"223\">223</a>|Transaction Portfolio Request Not Supported| | | <a name=\"224\">224</a>|Invalid Property Value Assignment| | | <a name=\"230\">230</a>|Transaction Type Not Found| | | <a name=\"231\">231</a>|Transaction Type Duplication| | | <a name=\"232\">232</a>|Portfolio Does Not Exist At Given Date| | | <a name=\"233\">233</a>|Query Parser Failure| | | <a name=\"234\">234</a>|Duplicate Constituent| | | <a name=\"235\">235</a>|Unresolved Instrument Constituent| | | <a name=\"236\">236</a>|Unresolved Instrument In Transition| | | <a name=\"237\">237</a>|Missing Side Definitions| | | <a name=\"299\">299</a>|Invalid Recipe| | | <a name=\"300\">300</a>|Missing Recipe| | | <a name=\"301\">301</a>|Dependencies| | | <a name=\"304\">304</a>|Portfolio Preprocess Failure| | | <a name=\"310\">310</a>|Valuation Engine Failure| | | <a name=\"311\">311</a>|Task Factory Failure| | | <a name=\"312\">312</a>|Task Evaluation Failure| | | <a name=\"313\">313</a>|Task Generation Failure| | | <a name=\"314\">314</a>|Engine Configuration Failure| | | <a name=\"315\">315</a>|Model Specification Failure| | | <a name=\"320\">320</a>|Market Data Key Failure| | | <a name=\"321\">321</a>|Market Resolver Failure| | | <a name=\"322\">322</a>|Market Data Failure| | | <a name=\"330\">330</a>|Curve Failure| | | <a name=\"331\">331</a>|Volatility Surface Failure| | | <a name=\"332\">332</a>|Volatility Cube Failure| | | <a name=\"350\">350</a>|Instrument Failure| | | <a name=\"351\">351</a>|Cash Flows Failure| | | <a name=\"352\">352</a>|Reference Data Failure| | | <a name=\"360\">360</a>|Aggregation Failure| | | <a name=\"361\">361</a>|Aggregation Measure Failure| | | <a name=\"370\">370</a>|Result Retrieval Failure| | | <a name=\"371\">371</a>|Result Processing Failure| | | <a name=\"372\">372</a>|Vendor Result Processing Failure| | | <a name=\"373\">373</a>|Vendor Result Mapping Failure| | | <a name=\"374\">374</a>|Vendor Library Unauthorised| | | <a name=\"375\">375</a>|Vendor Connectivity Error| | | <a name=\"376\">376</a>|Vendor Interface Error| | | <a name=\"377\">377</a>|Vendor Pricing Failure| | | <a name=\"378\">378</a>|Vendor Translation Failure| | | <a name=\"379\">379</a>|Vendor Key Mapping Failure| | | <a name=\"380\">380</a>|Vendor Reflection Failure| | | <a name=\"381\">381</a>|Vendor Process Failure| | | <a name=\"382\">382</a>|Vendor System Failure| | | <a name=\"390\">390</a>|Attempt To Upsert Duplicate Quotes| | | <a name=\"391\">391</a>|Corporate Action Source Does Not Exist| | | <a name=\"392\">392</a>|Corporate Action Source Already Exists| | | <a name=\"393\">393</a>|Instrument Identifier Already In Use| | | <a name=\"394\">394</a>|Properties Not Found| | | <a name=\"395\">395</a>|Batch Operation Aborted| | | <a name=\"400\">400</a>|Invalid Iso4217 Currency Code| | | <a name=\"401\">401</a>|Cannot Assign Instrument Identifier To Currency| | | <a name=\"402\">402</a>|Cannot Assign Currency Identifier To Non Currency| | | <a name=\"403\">403</a>|Currency Instrument Cannot Be Deleted| | | <a name=\"404\">404</a>|Currency Instrument Cannot Have Economic Definition| | | <a name=\"405\">405</a>|Currency Instrument Cannot Have Lookthrough Portfolio| | | <a name=\"406\">406</a>|Cannot Create Currency Instrument With Multiple Identifiers| | | <a name=\"407\">407</a>|Specified Currency Is Undefined| | | <a name=\"410\">410</a>|Index Does Not Exist| | | <a name=\"411\">411</a>|Sort Field Does Not Exist| | | <a name=\"413\">413</a>|Negative Pagination Parameters| | | <a name=\"414\">414</a>|Invalid Search Syntax| | | <a name=\"415\">415</a>|Filter Execution Timeout| | | <a name=\"420\">420</a>|Side Definition Inconsistent| | | <a name=\"450\">450</a>|Invalid Quote Access Metadata Rule| | | <a name=\"451\">451</a>|Access Metadata Not Found| | | <a name=\"452\">452</a>|Invalid Access Metadata Identifier| | | <a name=\"460\">460</a>|Standard Resource Not Found| | | <a name=\"461\">461</a>|Standard Resource Conflict| | | <a name=\"462\">462</a>|Calendar Not Found| | | <a name=\"463\">463</a>|Date In A Calendar Not Found| | | <a name=\"464\">464</a>|Invalid Date Source Data| | | <a name=\"465\">465</a>|Invalid Timezone| | | <a name=\"601\">601</a>|Person Identifier Already In Use| | | <a name=\"602\">602</a>|Person Not Found| | | <a name=\"603\">603</a>|Cannot Set Identifier| | | <a name=\"617\">617</a>|Invalid Recipe Specification In Request| | | <a name=\"618\">618</a>|Inline Recipe Deserialisation Failure| | | <a name=\"619\">619</a>|Identifier Types Not Set For Entity| | | <a name=\"620\">620</a>|Cannot Delete All Client Defined Identifiers| | | <a name=\"650\">650</a>|The Order requested was not found.| | | <a name=\"654\">654</a>|The Allocation requested was not found.| | | <a name=\"655\">655</a>|Cannot build the fx forward target with the given holdings.| | | <a name=\"656\">656</a>|Group does not contain expected entities.| | | <a name=\"665\">665</a>|Destination directory not found| | | <a name=\"667\">667</a>|Relation definition already exists| | | <a name=\"672\">672</a>|Could not retrieve file contents| | | <a name=\"673\">673</a>|Missing entitlements for entities in Group| | | <a name=\"674\">674</a>|Next Best Action not found| | | <a name=\"676\">676</a>|Relation definition not defined| | | <a name=\"677\">677</a>|Invalid entity identifier for relation| | | <a name=\"681\">681</a>|Sorting by specified field not supported|One or more of the provided fields to order by were either invalid or not supported. | | <a name=\"682\">682</a>|Too many fields to sort by|The number of fields to sort the data by exceeds the number allowed by the endpoint | | <a name=\"684\">684</a>|Sequence Not Found| | | <a name=\"685\">685</a>|Sequence Already Exists| | | <a name=\"686\">686</a>|Non-cycling sequence has been exhausted| | | <a name=\"687\">687</a>|Legal Entity Identifier Already In Use| | | <a name=\"688\">688</a>|Legal Entity Not Found| | | <a name=\"689\">689</a>|The supplied pagination token is invalid| | | <a name=\"690\">690</a>|Property Type Is Not Supported| | | <a name=\"691\">691</a>|Multiple Tax-lots For Currency Type Is Not Supported| | | <a name=\"692\">692</a>|This endpoint does not support impersonation| | | <a name=\"693\">693</a>|Entity type is not supported for Relationship| | | <a name=\"694\">694</a>|Relationship Validation Failure| | | <a name=\"695\">695</a>|Relationship Not Found| | | <a name=\"697\">697</a>|Derived Property Formula No Longer Valid| | | <a name=\"698\">698</a>|Story is not available| | | <a name=\"703\">703</a>|Corporate Action Does Not Exist| | | <a name=\"720\">720</a>|The provided sort and filter combination is not valid| | | <a name=\"721\">721</a>|A2B generation failed| | | <a name=\"722\">722</a>|Aggregated Return Calculation Failure| | | <a name=\"723\">723</a>|Custom Entity Definition Identifier Already In Use| | | <a name=\"724\">724</a>|Custom Entity Definition Not Found| | | <a name=\"725\">725</a>|The Placement requested was not found.| | | <a name=\"726\">726</a>|The Execution requested was not found.| | | <a name=\"727\">727</a>|The Block requested was not found.| | | <a name=\"728\">728</a>|The Participation requested was not found.| | | <a name=\"729\">729</a>|The Package requested was not found.| | | <a name=\"730\">730</a>|The OrderInstruction requested was not found.| | | <a name=\"732\">732</a>|Custom Entity not found.| | | <a name=\"733\">733</a>|Custom Entity Identifier already in use.| | | <a name=\"735\">735</a>|Calculation Failed.| | | <a name=\"736\">736</a>|An expected key on HttpResponse is missing.| | | <a name=\"737\">737</a>|A required fee detail is missing.| | | <a name=\"738\">738</a>|Zero rows were returned from Luminesce| | | <a name=\"739\">739</a>|Provided Weekend Mask was invalid| | | <a name=\"742\">742</a>|Custom Entity fields do not match the definition| | | <a name=\"746\">746</a>|The provided sequence is not valid.| | | <a name=\"751\">751</a>|The type of the Custom Entity is different than the type provided in the definition.| | | <a name=\"752\">752</a>|Luminesce process returned an error.| | | <a name=\"753\">753</a>|File name or content incompatible with operation.| | | <a name=\"755\">755</a>|Schema of response from Drive is not as expected.| | | <a name=\"757\">757</a>|Schema of response from Luminesce is not as expected.| | | <a name=\"758\">758</a>|Luminesce timed out.| | | <a name=\"763\">763</a>|Invalid Lusid Entity Identifier Unit| | | <a name=\"768\">768</a>|Fee rule not found.| | | <a name=\"769\">769</a>|Cannot update the base currency of a portfolio with transactions loaded| | * * The version of the OpenAPI document: 0.11.3984 * Contact: info@finbourne.com * Generated by: https://github.com/openapitools/openapi-generator.git */ using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.IO; using System.Runtime.Serialization; using System.Text; using System.Text.RegularExpressions; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using Newtonsoft.Json.Linq; using System.ComponentModel.DataAnnotations; using OpenAPIDateConverter = Lusid.Sdk.Client.OpenAPIDateConverter; namespace Lusid.Sdk.Model { /// <summary> /// ComplianceRuleResult /// </summary> [DataContract(Name = "ComplianceRuleResult")] public partial class ComplianceRuleResult : IEquatable<ComplianceRuleResult> { /// <summary> /// Initializes a new instance of the <see cref="ComplianceRuleResult" /> class. /// </summary> [JsonConstructorAttribute] protected ComplianceRuleResult() { } /// <summary> /// Initializes a new instance of the <see cref="ComplianceRuleResult" /> class. /// </summary> /// <param name="ruleId">The unique identifierof a compliance rule (required).</param> /// <param name="ruleName">The User-given name of the rule (required).</param> /// <param name="ruleDescription">The User-given description of the rule (required).</param> /// <param name="portfolio">portfolio (required).</param> /// <param name="passed">The result of an individual compliance run, true if passed (required).</param> /// <param name="resultValue">The calculation result that was used to confirm a pass/fail (required).</param> /// <param name="ruleInformationMatch">The value matched by the rule (required).</param> /// <param name="ruleInformationKey">The property key matched by the rule (required).</param> /// <param name="ruleLowerLimit">The lower limit of the rule (required).</param> /// <param name="ruleUpperLimit">The upper limit of the rule (required).</param> public ComplianceRuleResult(string ruleId = default(string), string ruleName = default(string), string ruleDescription = default(string), ResourceId portfolio = default(ResourceId), bool passed = default(bool), decimal resultValue = default(decimal), string ruleInformationMatch = default(string), string ruleInformationKey = default(string), int ruleLowerLimit = default(int), int ruleUpperLimit = default(int)) { // to ensure "ruleId" is required (not null) this.RuleId = ruleId ?? throw new ArgumentNullException("ruleId is a required property for ComplianceRuleResult and cannot be null"); // to ensure "ruleName" is required (not null) this.RuleName = ruleName ?? throw new ArgumentNullException("ruleName is a required property for ComplianceRuleResult and cannot be null"); // to ensure "ruleDescription" is required (not null) this.RuleDescription = ruleDescription ?? throw new ArgumentNullException("ruleDescription is a required property for ComplianceRuleResult and cannot be null"); // to ensure "portfolio" is required (not null) this.Portfolio = portfolio ?? throw new ArgumentNullException("portfolio is a required property for ComplianceRuleResult and cannot be null"); this.Passed = passed; this.ResultValue = resultValue; // to ensure "ruleInformationMatch" is required (not null) this.RuleInformationMatch = ruleInformationMatch ?? throw new ArgumentNullException("ruleInformationMatch is a required property for ComplianceRuleResult and cannot be null"); // to ensure "ruleInformationKey" is required (not null) this.RuleInformationKey = ruleInformationKey ?? throw new ArgumentNullException("ruleInformationKey is a required property for ComplianceRuleResult and cannot be null"); this.RuleLowerLimit = ruleLowerLimit; this.RuleUpperLimit = ruleUpperLimit; } /// <summary> /// The unique identifierof a compliance rule /// </summary> /// <value>The unique identifierof a compliance rule</value> [DataMember(Name = "ruleId", IsRequired = true, EmitDefaultValue = false)] public string RuleId { get; set; } /// <summary> /// The User-given name of the rule /// </summary> /// <value>The User-given name of the rule</value> [DataMember(Name = "ruleName", IsRequired = true, EmitDefaultValue = false)] public string RuleName { get; set; } /// <summary> /// The User-given description of the rule /// </summary> /// <value>The User-given description of the rule</value> [DataMember(Name = "ruleDescription", IsRequired = true, EmitDefaultValue = false)] public string RuleDescription { get; set; } /// <summary> /// Gets or Sets Portfolio /// </summary> [DataMember(Name = "portfolio", IsRequired = true, EmitDefaultValue = false)] public ResourceId Portfolio { get; set; } /// <summary> /// The result of an individual compliance run, true if passed /// </summary> /// <value>The result of an individual compliance run, true if passed</value> [DataMember(Name = "passed", IsRequired = true, EmitDefaultValue = true)] public bool Passed { get; set; } /// <summary> /// The calculation result that was used to confirm a pass/fail /// </summary> /// <value>The calculation result that was used to confirm a pass/fail</value> [DataMember(Name = "resultValue", IsRequired = true, EmitDefaultValue = true)] public decimal ResultValue { get; set; } /// <summary> /// The value matched by the rule /// </summary> /// <value>The value matched by the rule</value> [DataMember(Name = "ruleInformationMatch", IsRequired = true, EmitDefaultValue = false)] public string RuleInformationMatch { get; set; } /// <summary> /// The property key matched by the rule /// </summary> /// <value>The property key matched by the rule</value> [DataMember(Name = "ruleInformationKey", IsRequired = true, EmitDefaultValue = false)] public string RuleInformationKey { get; set; } /// <summary> /// The lower limit of the rule /// </summary> /// <value>The lower limit of the rule</value> [DataMember(Name = "ruleLowerLimit", IsRequired = true, EmitDefaultValue = true)] public int RuleLowerLimit { get; set; } /// <summary> /// The upper limit of the rule /// </summary> /// <value>The upper limit of the rule</value> [DataMember(Name = "ruleUpperLimit", IsRequired = true, EmitDefaultValue = true)] public int RuleUpperLimit { get; set; } /// <summary> /// Returns the string presentation of the object /// </summary> /// <returns>String presentation of the object</returns> public override string ToString() { var sb = new StringBuilder(); sb.Append("class ComplianceRuleResult {\n"); sb.Append(" RuleId: ").Append(RuleId).Append("\n"); sb.Append(" RuleName: ").Append(RuleName).Append("\n"); sb.Append(" RuleDescription: ").Append(RuleDescription).Append("\n"); sb.Append(" Portfolio: ").Append(Portfolio).Append("\n"); sb.Append(" Passed: ").Append(Passed).Append("\n"); sb.Append(" ResultValue: ").Append(ResultValue).Append("\n"); sb.Append(" RuleInformationMatch: ").Append(RuleInformationMatch).Append("\n"); sb.Append(" RuleInformationKey: ").Append(RuleInformationKey).Append("\n"); sb.Append(" RuleLowerLimit: ").Append(RuleLowerLimit).Append("\n"); sb.Append(" RuleUpperLimit: ").Append(RuleUpperLimit).Append("\n"); sb.Append("}\n"); return sb.ToString(); } /// <summary> /// Returns the JSON string presentation of the object /// </summary> /// <returns>JSON string presentation of the object</returns> public virtual string ToJson() { return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); } /// <summary> /// Returns true if objects are equal /// </summary> /// <param name="input">Object to be compared</param> /// <returns>Boolean</returns> public override bool Equals(object input) { return this.Equals(input as ComplianceRuleResult); } /// <summary> /// Returns true if ComplianceRuleResult instances are equal /// </summary> /// <param name="input">Instance of ComplianceRuleResult to be compared</param> /// <returns>Boolean</returns> public bool Equals(ComplianceRuleResult input) { if (input == null) return false; return ( this.RuleId == input.RuleId || (this.RuleId != null && this.RuleId.Equals(input.RuleId)) ) && ( this.RuleName == input.RuleName || (this.RuleName != null && this.RuleName.Equals(input.RuleName)) ) && ( this.RuleDescription == input.RuleDescription || (this.RuleDescription != null && this.RuleDescription.Equals(input.RuleDescription)) ) && ( this.Portfolio == input.Portfolio || (this.Portfolio != null && this.Portfolio.Equals(input.Portfolio)) ) && ( this.Passed == input.Passed || this.Passed.Equals(input.Passed) ) && ( this.ResultValue == input.ResultValue || this.ResultValue.Equals(input.ResultValue) ) && ( this.RuleInformationMatch == input.RuleInformationMatch || (this.RuleInformationMatch != null && this.RuleInformationMatch.Equals(input.RuleInformationMatch)) ) && ( this.RuleInformationKey == input.RuleInformationKey || (this.RuleInformationKey != null && this.RuleInformationKey.Equals(input.RuleInformationKey)) ) && ( this.RuleLowerLimit == input.RuleLowerLimit || this.RuleLowerLimit.Equals(input.RuleLowerLimit) ) && ( this.RuleUpperLimit == input.RuleUpperLimit || this.RuleUpperLimit.Equals(input.RuleUpperLimit) ); } /// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hashCode = 41; if (this.RuleId != null) hashCode = hashCode * 59 + this.RuleId.GetHashCode(); if (this.RuleName != null) hashCode = hashCode * 59 + this.RuleName.GetHashCode(); if (this.RuleDescription != null) hashCode = hashCode * 59 + this.RuleDescription.GetHashCode(); if (this.Portfolio != null) hashCode = hashCode * 59 + this.Portfolio.GetHashCode(); hashCode = hashCode * 59 + this.Passed.GetHashCode(); hashCode = hashCode * 59 + this.ResultValue.GetHashCode(); if (this.RuleInformationMatch != null) hashCode = hashCode * 59 + this.RuleInformationMatch.GetHashCode(); if (this.RuleInformationKey != null) hashCode = hashCode * 59 + this.RuleInformationKey.GetHashCode(); hashCode = hashCode * 59 + this.RuleLowerLimit.GetHashCode(); hashCode = hashCode * 59 + this.RuleUpperLimit.GetHashCode(); return hashCode; } } } }
108.465201
16,891
0.621391
[ "MIT" ]
EiriniMavroudi/lusid-sdk-csharp-preview
sdk/Lusid.Sdk/Model/ComplianceRuleResult.cs
29,611
C#
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Text; using System.Threading; using System.Threading.Tasks; using HedgeModManager.Misc; namespace HedgeModManager.Updates { public class GmiUpdateCommandList : IList<IUpdateCommand> { protected static char[] LineEndings = {'\r', '\n'}; protected List<IUpdateCommand> Commands { get; set; } = new List<IUpdateCommand>(); public const string TempDirName = ".hmmtemp"; public int Count => Commands.Count; public bool IsReadOnly => false; public void Parse(string commands) { Clear(); foreach (string line in commands.Split(LineEndings, StringSplitOptions.RemoveEmptyEntries)) { if (string.IsNullOrEmpty(line) || line.StartsWith(";") || line.StartsWith("#")) continue; int firstSpace = line.IndexOf(' '); if (firstSpace == -1) continue; string cmdName = line.Substring(0, firstSpace).ToLowerInvariant(); string cmdArg = line.Substring(firstSpace + 1); switch (cmdName) { case CommandAddFile.Name: Add(new CommandAddFile(cmdArg)); break; case CommandRemoveFile.Name: Add(new CommandRemoveFile(cmdArg)); break; case CommandPrint.Name: Add(new CommandPrint(cmdArg)); break; case CommandPause.Name: if (int.TryParse(cmdArg, out int timeout)) Add(new CommandPause(timeout)); break; } } } public async Task ExecuteAsync(ModInfo mod, ExecuteConfig config = default, CancellationToken cancellationToken = default) { foreach (var command in this) await command.PrepareExecute(mod, config?.Logger).ConfigureAwait(false); for (int i = 0; i < Count; i++) { CheckCancel(); var command = this[i]; await command.Execute(mod, config, cancellationToken).ConfigureAwait(false); CheckCancel(); config?.OverallCallback?.Report((((double)i / (double)Count) * 100)); } CheckCancel(); for (int i = 0; i < Count; i++) { var command = this[i]; await command.FinalizeExecute(mod, config?.Logger).ConfigureAwait(false); } DeleteTemp(); config?.OverallCallback?.Report(100); void CheckCancel() { if (!cancellationToken.IsCancellationRequested) return; DeleteTemp(); cancellationToken.ThrowIfCancellationRequested(); } void DeleteTemp() { try { Directory.Delete(Path.Combine(mod.RootDirectory, TempDirName), true); } catch { // ignore } } } public IEnumerator<IUpdateCommand> GetEnumerator() { return Commands.GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } public void Add(IUpdateCommand item) { Commands.Add(item); } public void Clear() { Commands.Clear(); } public bool Contains(IUpdateCommand item) { return Commands.Contains(item); } public void CopyTo(IUpdateCommand[] array, int arrayIndex) { Commands.CopyTo(array, arrayIndex); } public bool Remove(IUpdateCommand item) { return Commands.Remove(item); } public int IndexOf(IUpdateCommand item) { return Commands.IndexOf(item); } public void Insert(int index, IUpdateCommand item) { Commands.Insert(index, item); } public void RemoveAt(int index) { Commands.RemoveAt(index); } public IUpdateCommand this[int index] { get => Commands[index]; set => Commands[index] = value; } } public class ExecuteConfig { public IProgress<double> OverallCallback { get; set; } public IProgress<double?> CurrentCallback { get; set; } public ILogger Logger { get; set; } = DummyLogger.Instance; } public interface IUpdateCommand { Task PrepareExecute(ModInfo mod, ILogger logger); Task Execute(ModInfo mod, ExecuteConfig config = default, CancellationToken cancellationToken = default); Task FinalizeExecute(ModInfo mod, ILogger logger); } public class CommandAddFile : IUpdateCommand { public const string Name = "add"; public string FileName { get; set; } public CommandAddFile(string fileName) { FileName = fileName; } public Task PrepareExecute(ModInfo mod, ILogger logger) { string fullPath = Path.Combine(mod.RootDirectory, GmiUpdateCommandList.TempDirName, FileName); string dirName = Path.GetDirectoryName(fullPath); if (!fullPath.IsSubPathOf(mod.RootDirectory)) return Task.CompletedTask; if (!string.IsNullOrEmpty(dirName)) Directory.CreateDirectory(dirName); return Task.CompletedTask; } public Task FinalizeExecute(ModInfo mod, ILogger logger) { string tempFullPath = Path.Combine(mod.RootDirectory, GmiUpdateCommandList.TempDirName, FileName); string fullPath = Path.Combine(mod.RootDirectory, FileName); if (!fullPath.IsSubPathOf(mod.RootDirectory)) return Task.CompletedTask; if (!File.Exists(tempFullPath)) return Task.CompletedTask; if (File.Exists(fullPath)) File.Delete(fullPath); Directory.CreateDirectory(Path.GetDirectoryName(fullPath)); File.Move(tempFullPath, fullPath); return Task.CompletedTask; } public async Task Execute(ModInfo mod, ExecuteConfig config, CancellationToken cancellationToken) { config?.CurrentCallback?.Report(0); if (string.IsNullOrEmpty(FileName)) return; string serverPath = Path.Combine(mod.UpdateServer, Uri.EscapeUriString(FileName)); string fullPath = Path.Combine(mod.RootDirectory, GmiUpdateCommandList.TempDirName, FileName); if (!fullPath.IsSubPathOf(mod.RootDirectory)) { config.Logger?.WriteLine($"Ignoring {FileName}"); return; } try { config.Logger.WriteLine($"Downloading {FileName}"); await Singleton.GetInstance<HttpClient>().DownloadFileAsync(serverPath, fullPath, config.CurrentCallback, cancellationToken); } catch(HttpRequestException e) { config.Logger.WriteLine($"Failed to download {FileName} : {e.Message}"); } } public override string ToString() { return $"{Name} {FileName}"; } } public class CommandRemoveFile : IUpdateCommand { public const string Name = "delete"; public string FileName { get; set; } public CommandRemoveFile(string fileName) { FileName = fileName; } public Task PrepareExecute(ModInfo mod, ILogger logger) => Task.CompletedTask; public Task Execute(ModInfo mod, ExecuteConfig config, CancellationToken cancellationToken) => Task.CompletedTask; public Task FinalizeExecute(ModInfo mod, ILogger logger) { string fullPath = Path.Combine(mod.RootDirectory, FileName); try { if (!fullPath.IsSubPathOf(mod.RootDirectory)) { logger?.WriteLine($"Ignoring {FileName}"); return Task.CompletedTask; } bool isDir = FileName.EndsWith("/") || FileName.EndsWith("\\"); if (!isDir) { logger?.WriteLine($"Deleting File {FileName}"); if (File.Exists(fullPath)) File.Delete(fullPath); } else { logger?.WriteLine($"Deleting Directory {FileName}"); if (Directory.Exists(fullPath)) Directory.Delete(fullPath, true); } } catch { logger?.WriteLine($"Failed to delete {FileName}"); } return Task.CompletedTask; } public override string ToString() { return $"{Name} {FileName}"; } } public class CommandPrint : IUpdateCommand { public const string Name = "print"; public string Text { get; set; } public CommandPrint(string text) { Text = text; } public Task PrepareExecute(ModInfo mod, ILogger logger) => Task.CompletedTask; public Task Execute(ModInfo mod, ExecuteConfig config = default, CancellationToken cancellationToken = default) { config?.CurrentCallback?.Report(null); config?.Logger?.WriteLine(Text); return Task.CompletedTask; } public Task FinalizeExecute(ModInfo mod, ILogger logger) => Task.CompletedTask; public override string ToString() { return $"{Name} {Text}"; } } public class CommandPause : IUpdateCommand { public const string Name = "pause"; public int Timeout { get; set; } public CommandPause(int timeout) { Timeout = timeout; } public Task PrepareExecute(ModInfo mod, ILogger logger) => Task.CompletedTask; public async Task Execute(ModInfo mod, ExecuteConfig config = default, CancellationToken cancellationToken = default) { if (Timeout <= 0) return; config?.CurrentCallback?.Report(null); await Task.Delay(Timeout, cancellationToken); } public Task FinalizeExecute(ModInfo mod, ILogger logger) => Task.CompletedTask; public override string ToString() { return $"{Name} {Timeout}ms"; } } }
30.143243
130
0.542276
[ "MIT" ]
Leroysonic/HedgeModManager
HedgeModManager/Updates/GmiUpdateCommandList.cs
11,155
C#
// ***************************************************************************** // // © Component Factory Pty Ltd, 2006 - 2016. All rights reserved. // The software and associated documentation supplied hereunder are the // proprietary information of Component Factory Pty Ltd, PO Box 1504, // Glen Waverley, Vic 3150, Australia and are supplied subject to licence terms. // // Version 5.500.5000.0 www.ComponentFactory.com // ***************************************************************************** using System; using System.Text; using System.Drawing; using System.Windows.Forms; using System.ComponentModel; using System.Collections.Generic; using System.Diagnostics; using ComponentFactory.Krypton.Toolkit; using ComponentFactory.Krypton.Navigator; namespace ExpandingPages { public partial class Form1 : KryptonForm { public Form1() { InitializeComponent(); } private void buttonTopArrow_Click(object sender, EventArgs e) { // For the top navigator instance we will toggle the showing of // the client area below the check button area. We also toggle // the direction of the button spec arrow. if (navigatorTop.NavigatorMode == NavigatorMode.HeaderBarCheckButtonGroup) { navigatorTop.NavigatorMode = NavigatorMode.HeaderBarCheckButtonOnly; buttonTopArrow.TypeRestricted = PaletteNavButtonSpecStyle.ArrowDown; } else { navigatorTop.NavigatorMode = NavigatorMode.HeaderBarCheckButtonGroup; buttonTopArrow.TypeRestricted = PaletteNavButtonSpecStyle.ArrowUp; } } private void buttonLeft_Click(object sender, EventArgs e) { // For the left navigator instance we will toggle the showing of // the client area to the right of the check button area. We also // toggle the direction of the button spec arrow. if (navigatorLeft.NavigatorMode == NavigatorMode.HeaderBarCheckButtonGroup) { navigatorLeft.NavigatorMode = NavigatorMode.HeaderBarCheckButtonOnly; buttonLeft.TypeRestricted = PaletteNavButtonSpecStyle.ArrowRight; } else { navigatorLeft.NavigatorMode = NavigatorMode.HeaderBarCheckButtonGroup; buttonLeft.TypeRestricted = PaletteNavButtonSpecStyle.ArrowLeft; } } private void kryptonPaletteButtons_Click(object sender, EventArgs e) { // When the user presses one of the palette buttons we need to ensure // that if the containing page is showing as a popup that the popup // is then removed from display. So call DismissPopupPage to remove // the page from view. If the page is not showing as a popup then // the call does nothing. navigatorLeft.DismissPopups(); } private void kryptonPalettes_CheckedButtonChanged(object sender, EventArgs e) { // Change the palette depending on the selected button switch (kryptonPalettes.CheckedIndex) { case 0: kryptonManager1.GlobalPaletteMode = PaletteModeManager.Office2007Blue; break; case 1: kryptonManager1.GlobalPaletteMode = PaletteModeManager.Office2007Silver; break; case 2: kryptonManager1.GlobalPaletteMode = PaletteModeManager.Office2007Black; break; case 3: kryptonManager1.GlobalPaletteMode = PaletteModeManager.ProfessionalSystem; break; case 4: kryptonManager1.GlobalPaletteMode = PaletteModeManager.ProfessionalOffice2003; break; case 5: kryptonManager1.GlobalPaletteMode = PaletteModeManager.SparkleBlue; break; case 6: kryptonManager1.GlobalPaletteMode = PaletteModeManager.Office2010Black; break; case 7: kryptonManager1.GlobalPaletteMode = PaletteModeManager.Office2010Silver; break; case 8: kryptonManager1.GlobalPaletteMode = PaletteModeManager.Office2010Blue; break; } } } }
40.566372
98
0.589878
[ "BSD-3-Clause" ]
Krypton-Suite-Legacy-Archive/Krypton-Toolkit-Suite-NET-Core
Source/Demos/Non NuGet/Krypton Navigator Examples/Expanding Pages/Form1.cs
4,587
C#
namespace AspectCore.Extensions.Configuration { public enum ConfigurationBindType { Value, Class } }
16
45
0.648438
[ "MIT" ]
Frunck8206/AspectCore-Framework
src/AspectCore.Extensions.Configuration/ConfigurationBindType.cs
128
C#
using MyJetWallet.Fireblocks.Domain.Models.VaultAssets; using System.Collections.Generic; using System.Runtime.Serialization; namespace MyJetWallet.Fireblocks.Domain.Models.VaultAccounts { [DataContract] public class VaultAccount { [DataMember(Order = 1)] public string Id { get; set; } [DataMember(Order = 2)] public string Name { get; set; } [DataMember(Order = 3)] public bool HiddenOnUI { get; set; } [DataMember(Order = 4)] public string CustomerRefId { get; set; } [DataMember(Order = 5)] public bool AutoFuel { get; set; } [DataMember(Order = 6)] public IReadOnlyCollection<VaultAsset> VaultAssets { get; set; } } }
26.464286
72
0.634278
[ "MIT" ]
MyJetWallet/MyJetWallet.Fireblocks
src/MyJetWallet.Fireblocks/Domain/Models/VaultAccounts/VaultAccount.cs
743
C#
using Android.App; using Android.Content.PM; using Android.OS; using Prism.Ioc; using Prism.Events; using PrismSample.Models; using Android.Widget; namespace PrismSample.Droid { [Activity(Theme = "@style/MainTheme", ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity { protected override void OnCreate(Bundle savedInstanceState) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); var application = new App(); var ea = application.Container.Resolve<IEventAggregator>().GetEvent<NativeEvent>().Subscribe(OnNameChangedEvent); LoadApplication(application); } private void OnNameChangedEvent(NativeEventArgs args) { Toast.MakeText(this, $"Hi {args.Message}, from Android", ToastLength.Long).Show(); } } }
34.181818
125
0.681738
[ "MIT" ]
Adam--/Prism-Samples-Forms
05-EventAggregator/src/PrismSample.Android/MainActivity.cs
1,130
C#
using System; using System.IO; using System.Linq; using System.Xml.Linq; using System.Reflection.Metadata; using System.Reflection.PortableExecutable; using FluentAssertions; using Microsoft.Extensions.DependencyModel; using Microsoft.NET.TestFramework; using Microsoft.NET.TestFramework.Assertions; using Microsoft.NET.TestFramework.Commands; using Microsoft.NET.TestFramework.ProjectConstruction; using Xunit; using Xunit.Abstractions; namespace Microsoft.NET.Publish.Tests { public class GivenThatWeWantToRunILLink : SdkTest { public GivenThatWeWantToRunILLink(ITestOutputHelper log) : base(log) { } [Theory] [InlineData("netcoreapp3.0")] public void ILLink_only_runs_when_switch_is_enabled(string targetFramework) { var projectName = "HelloWorld"; var referenceProjectName = "ClassLibForILLink"; var rid = EnvironmentInfo.GetCompatibleRid(targetFramework); var testProject = CreateTestProjectForILLinkTesting(targetFramework, projectName, referenceProjectName); string[] restoreArgs = { $"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true" }; var testAsset = _testAssetsManager.CreateTestProject(testProject) .Restore(Log, testProject.Name, restoreArgs); var publishCommand = new PublishCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); publishCommand.Execute($"/p:RuntimeIdentifier={rid}", $"/p:SelfContained=true").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; var intermediateDirectory = publishCommand.GetIntermediateDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; var linkedDirectory = Path.Combine(intermediateDirectory, "linked"); Directory.Exists(linkedDirectory).Should().BeFalse(); var publishedDll = Path.Combine(publishDirectory, $"{projectName}.dll"); var unusedDll = Path.Combine(publishDirectory, $"{referenceProjectName}.dll"); var unusedFrameworkDll = Path.Combine(publishDirectory, $"{unusedFrameworkAssembly}.dll"); // Linker inputs are kept, including unused assemblies File.Exists(publishedDll).Should().BeTrue(); File.Exists(unusedDll).Should().BeTrue(); File.Exists(unusedFrameworkDll).Should().BeTrue(); var depsFile = Path.Combine(publishDirectory, $"{projectName}.deps.json"); DoesDepsFileHaveAssembly(depsFile, referenceProjectName).Should().BeTrue(); DoesDepsFileHaveAssembly(depsFile, unusedFrameworkAssembly).Should().BeTrue(); } [Theory] [InlineData("netcoreapp3.0")] public void ILLink_runs_and_creates_linked_app(string targetFramework) { var projectName = "HelloWorld"; var referenceProjectName = "ClassLibForILLink"; var rid = EnvironmentInfo.GetCompatibleRid(targetFramework); var testProject = CreateTestProjectForILLinkTesting(targetFramework, projectName, referenceProjectName); string[] restoreArgs = { $"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true" }; var testAsset = _testAssetsManager.CreateTestProject(testProject) .WithProjectChanges(project => EnableNonFrameworkTrimming(project)) .Restore(Log, testProject.Name, restoreArgs); var publishCommand = new PublishCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); publishCommand.Execute($"/p:RuntimeIdentifier={rid}", $"/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; var intermediateDirectory = publishCommand.GetIntermediateDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; var linkedDirectory = Path.Combine(intermediateDirectory, "linked"); Directory.Exists(linkedDirectory).Should().BeTrue(); var linkedDll = Path.Combine(linkedDirectory, $"{projectName}.dll"); var publishedDll = Path.Combine(publishDirectory, $"{projectName}.dll"); var unusedDll = Path.Combine(publishDirectory, $"{referenceProjectName}.dll"); var unusedFrameworkDll = Path.Combine(publishDirectory, $"{unusedFrameworkAssembly}.dll"); // Intermediate assembly is kept by linker and published, but not unused assemblies File.Exists(linkedDll).Should().BeTrue(); File.Exists(publishedDll).Should().BeTrue(); File.Exists(unusedDll).Should().BeFalse(); File.Exists(unusedFrameworkDll).Should().BeFalse(); var depsFile = Path.Combine(publishDirectory, $"{projectName}.deps.json"); DoesDepsFileHaveAssembly(depsFile, projectName).Should().BeTrue(); DoesDepsFileHaveAssembly(depsFile, referenceProjectName).Should().BeFalse(); DoesDepsFileHaveAssembly(depsFile, unusedFrameworkAssembly).Should().BeFalse(); } [Theory] [InlineData("netcoreapp3.0")] public void ILLink_accepts_root_descriptor(string targetFramework) { var projectName = "HelloWorld"; var referenceProjectName = "ClassLibForILLink"; var rid = EnvironmentInfo.GetCompatibleRid(targetFramework); var testProject = CreateTestProjectForILLinkTesting(targetFramework, projectName, referenceProjectName); string[] restoreArgs = { $"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true" }; var testAsset = _testAssetsManager.CreateTestProject(testProject) .WithProjectChanges(project => EnableNonFrameworkTrimming(project)) .WithProjectChanges(project => AddRootDescriptor(project, $"{referenceProjectName}.xml")) .Restore(Log, testProject.Name, restoreArgs); var publishCommand = new PublishCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); // Inject extra arguments to prevent the linker from // keeping the entire referenceProject assembly. The // linker by default runs in a conservative mode that // keeps all used assemblies, but in this case we want to // check whether the root descriptor actually roots only // the specified method. var extraArgs = $"-p link {referenceProjectName}"; publishCommand.Execute($"/p:RuntimeIdentifier={rid}", $"/p:SelfContained=true", "/p:PublishTrimmed=true", $"/p:_ExtraTrimmerArgs={extraArgs}", "/v:n").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; var publishedDll = Path.Combine(publishDirectory, $"{projectName}.dll"); var unusedDll = Path.Combine(publishDirectory, $"{referenceProjectName}.dll"); // With root descriptor, linker keeps specified roots but removes unused methods File.Exists(publishedDll).Should().BeTrue(); File.Exists(unusedDll).Should().BeTrue(); DoesImageHaveMethod(unusedDll, "UnusedMethod").Should().BeFalse(); DoesImageHaveMethod(unusedDll, "UnusedMethodToRoot").Should().BeTrue(); } [Theory] [InlineData("netcoreapp3.0")] public void ILLink_runs_incrementally(string targetFramework) { var projectName = "HelloWorld"; var referenceProjectName = "ClassLibForILLink"; var rid = EnvironmentInfo.GetCompatibleRid(targetFramework); var testProject = CreateTestProjectForILLinkTesting(targetFramework, projectName, referenceProjectName); string[] restoreArgs = { $"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true" }; var testAsset = _testAssetsManager.CreateTestProject(testProject) .Restore(Log, testProject.Name, restoreArgs); var publishCommand = new PublishCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; var intermediateDirectory = publishCommand.GetIntermediateDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; var linkedDirectory = Path.Combine(intermediateDirectory, "linked"); var linkSemaphore = Path.Combine(intermediateDirectory, "Link.semaphore"); publishCommand.Execute($"/p:RuntimeIdentifier={rid}", $"/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); DateTime semaphoreFirstModifiedTime = File.GetLastWriteTimeUtc(linkSemaphore); WaitForUtcNowToAdvance(); publishCommand.Execute($"/p:RuntimeIdentifier={rid}", $"/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); DateTime semaphoreSecondModifiedTime = File.GetLastWriteTimeUtc(linkSemaphore); semaphoreFirstModifiedTime.Should().Be(semaphoreSecondModifiedTime); } [Theory] [InlineData("netcoreapp3.0")] public void ILLink_defaults_keep_nonframework(string targetFramework) { var projectName = "HelloWorld"; var referenceProjectName = "ClassLibForILLink"; var rid = EnvironmentInfo.GetCompatibleRid(targetFramework); var testProject = CreateTestProjectForILLinkTesting(targetFramework, projectName, referenceProjectName); string[] restoreArgs = { $"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true" }; var testAsset = _testAssetsManager.CreateTestProject(testProject) .Restore(Log, testProject.Name, restoreArgs); var publishCommand = new PublishCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); publishCommand.Execute("/v:n", $"/p:RuntimeIdentifier={rid}", $"/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; var intermediateDirectory = publishCommand.GetIntermediateDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; var linkedDirectory = Path.Combine(intermediateDirectory, "linked"); Directory.Exists(linkedDirectory).Should().BeTrue(); var linkedDll = Path.Combine(linkedDirectory, $"{projectName}.dll"); var publishedDll = Path.Combine(publishDirectory, $"{projectName}.dll"); var unusedDll = Path.Combine(publishDirectory, $"{referenceProjectName}.dll"); var unusedFrameworkDll = Path.Combine(publishDirectory, $"{unusedFrameworkAssembly}.dll"); File.Exists(linkedDll).Should().BeTrue(); File.Exists(publishedDll).Should().BeTrue(); File.Exists(unusedDll).Should().BeTrue(); File.Exists(unusedFrameworkDll).Should().BeFalse(); var depsFile = Path.Combine(publishDirectory, $"{projectName}.deps.json"); DoesDepsFileHaveAssembly(depsFile, projectName).Should().BeTrue(); DoesDepsFileHaveAssembly(depsFile, referenceProjectName).Should().BeTrue(); DoesDepsFileHaveAssembly(depsFile, unusedFrameworkAssembly).Should().BeFalse(); } [Theory] [InlineData("netcoreapp3.0")] public void ILLink_does_not_include_leftover_artifacts_on_second_run(string targetFramework) { var projectName = "HelloWorld"; var referenceProjectName = "ClassLibForILLink"; var rid = EnvironmentInfo.GetCompatibleRid(targetFramework); var testProject = CreateTestProjectForILLinkTesting(targetFramework, projectName, referenceProjectName); string[] restoreArgs = { $"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true" }; var testAsset = _testAssetsManager.CreateTestProject(testProject) .WithProjectChanges(project => EnableNonFrameworkTrimming(project)) .WithProjectChanges(project => AddRootDescriptor(project, $"{referenceProjectName}.xml")) .Restore(Log, testProject.Name, restoreArgs); var publishCommand = new PublishCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); var publishDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; var intermediateDirectory = publishCommand.GetIntermediateDirectory(targetFramework: targetFramework, runtimeIdentifier: rid).FullName; var linkedDirectory = Path.Combine(intermediateDirectory, "linked"); var linkSemaphore = Path.Combine(intermediateDirectory, "Link.semaphore"); // Link, keeping classlib publishCommand.Execute($"/p:RuntimeIdentifier={rid}", $"/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); DateTime semaphoreFirstModifiedTime = File.GetLastWriteTimeUtc(linkSemaphore); var publishedDllKeptFirstTimeOnly = Path.Combine(publishDirectory, $"{referenceProjectName}.dll"); var linkedDllKeptFirstTimeOnly = Path.Combine(linkedDirectory, $"{referenceProjectName}.dll"); File.Exists(linkedDllKeptFirstTimeOnly).Should().BeTrue(); File.Exists(publishedDllKeptFirstTimeOnly).Should().BeTrue(); // Delete kept dll from publish output (works around lack of incremental publish) File.Delete(publishedDllKeptFirstTimeOnly); // Remove root descriptor to change the linker behavior. WaitForUtcNowToAdvance(); // File.SetLastWriteTimeUtc(Path.Combine(testAsset.TestRoot, testProject.Name, $"{projectName}.cs"), DateTime.UtcNow); testAsset = testAsset.WithProjectChanges(project => RemoveRootDescriptor(project)); // Link, discarding classlib publishCommand.Execute($"/p:RuntimeIdentifier={rid}", $"/p:SelfContained=true", "/p:PublishTrimmed=true").Should().Pass(); DateTime semaphoreSecondModifiedTime = File.GetLastWriteTimeUtc(linkSemaphore); // Check that the linker actually ran again semaphoreFirstModifiedTime.Should().NotBe(semaphoreSecondModifiedTime); File.Exists(linkedDllKeptFirstTimeOnly).Should().BeFalse(); File.Exists(publishedDllKeptFirstTimeOnly).Should().BeFalse(); // "linked" intermediate directory does not pollute the publish output Directory.Exists(Path.Combine(publishDirectory, "linked")).Should().BeFalse(); } [Theory] [InlineData("netcoreapp3.0")] public void ILLink_error_on_portable_app(string targetFramework) { var projectName = "HelloWorld"; var referenceProjectName = "ClassLibForILLink"; var testProject = CreateTestProjectForILLinkTesting(targetFramework, projectName, referenceProjectName); var testAsset = _testAssetsManager.CreateTestProject(testProject) .Restore(Log, testProject.Name); var publishCommand = new PublishCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); publishCommand.Execute("/p:PublishTrimmed=true") .Should().Fail() .And.HaveStdOutContainingIgnoreCase("NETSDK1102"); } [Theory] [InlineData("netcoreapp3.0")] public void ILLink_displays_informational_warning(string targetFramework) { var projectName = "HelloWorld"; var referenceProjectName = "ClassLibForILLink"; var rid = EnvironmentInfo.GetCompatibleRid(targetFramework); var testProject = CreateTestProjectForILLinkTesting(targetFramework, projectName, referenceProjectName); string[] restoreArgs = { $"/p:RuntimeIdentifier={rid}", "/p:SelfContained=true" }; var testAsset = _testAssetsManager.CreateTestProject(testProject) .Restore(Log, testProject.Name); var publishCommand = new PublishCommand(Log, Path.Combine(testAsset.TestRoot, testProject.Name)); publishCommand.Execute("/p:PublishTrimmed=true", $"/p:SelfContained=true", "/p:PublishTrimmed=true") .Should().Pass().And.HaveStdOutContainingIgnoreCase("NETSDK1101"); } private static bool DoesImageHaveMethod(string path, string methodNameToCheck) { using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read)) using (var peReader = new PEReader(fs)) { var metadataReader = peReader.GetMetadataReader(); foreach (var handle in metadataReader.MethodDefinitions) { var methodDefinition = metadataReader.GetMethodDefinition(handle); string methodName = metadataReader.GetString(methodDefinition.Name); if (methodName == methodNameToCheck) return true; } } return false; } private static bool DoesDepsFileHaveAssembly(string depsFilePath, string assemblyName) { DependencyContext dependencyContext; using (var fs = File.OpenRead(depsFilePath)) { dependencyContext = new DependencyContextJsonReader().Read(fs); } return dependencyContext.RuntimeLibraries.Any(l => l.RuntimeAssemblyGroups.Any(rag => rag.AssetPaths.Any(f => Path.GetFileName(f) == $"{assemblyName}.dll"))); } static string unusedFrameworkAssembly = "System.IO"; private TestPackageReference GetPackageReference(TestProject project) { var asset = _testAssetsManager.CreateTestProject(project, project.Name).Restore(Log, project.Name); var pack = new PackCommand(Log, Path.Combine(asset.TestRoot, project.Name)); pack.Execute().Should().Pass(); return new TestPackageReference(project.Name, "1.0.0", pack.GetNuGetPackage(project.Name)); } private void AddRootDescriptor(XDocument project, string rootDescriptorFileName) { var ns = project.Root.Name.Namespace; var itemGroup = new XElement(ns + "ItemGroup"); project.Root.Add(itemGroup); itemGroup.Add(new XElement(ns + "TrimmerRootDescriptor", new XAttribute("Include", rootDescriptorFileName))); } private void RemoveRootDescriptor(XDocument project) { var ns = project.Root.Name.Namespace; project.Root.Elements(ns + "ItemGroup") .Where(ig => ig.Elements(ns + "TrimmerRootDescriptor").Any()) .First().Remove(); } private void EnableNonFrameworkTrimming(XDocument project) { // Used to override the default linker options for testing // purposes. The default roots non-framework assemblies, // but we want to ensure that the linker is running // end-to-end by checking that it strips code from our // test projects. var ns = project.Root.Name.Namespace; var target = new XElement(ns + "Target", new XAttribute("AfterTargets", "_SetILLinkDefaults"), new XAttribute("Name", "_EnableNonFrameworkTrimming")); project.Root.Add(target); target.Add(new XElement(ns + "PropertyGroup", new XElement("_ExtraTrimmerArgs", "-c link -u link"))); target.Add(new XElement(ns + "ItemGroup", new XElement("TrimmerRootAssembly", new XAttribute("Remove", "@(TrimmerRootAssembly)")), new XElement("TrimmerRootAssembly", new XAttribute("Include", "@(IntermediateAssembly->'%(FileName)')")), new XElement("_ManagedAssembliesToLink", new XAttribute("Update", "@(_ManagedAssembliesToLink)"), new XElement("action")))); } private TestProject CreateTestProjectForILLinkTesting(string targetFramework, string mainProjectName, string referenceProjectName) { var referenceProject = new TestProject() { Name = referenceProjectName, TargetFrameworks = targetFramework, IsSdkProject = true }; referenceProject.SourceFiles[$"{referenceProjectName}.cs"] = @" using System; public class ClassLib { public void UnusedMethod() { } public void UnusedMethodToRoot() { } } "; var packageReference = GetPackageReference(referenceProject); var testProject = new TestProject() { Name = mainProjectName, TargetFrameworks = targetFramework, IsSdkProject = true, PackageReferences = { packageReference } }; testProject.AdditionalProperties.Add("RestoreAdditionalProjectSources", "$(RestoreAdditionalProjectSources);" + Path.GetDirectoryName(packageReference.NupkgPath)); testProject.SourceFiles[$"{mainProjectName}.cs"] = @" using System; public class Program { public static void Main() { Console.WriteLine(""Hello world""); } } "; testProject.SourceFiles[$"{referenceProjectName}.xml"] = $@" <linker> <assembly fullname=""{referenceProjectName}""> <type fullname=""ClassLib""> <method name=""UnusedMethodToRoot"" /> </type> </assembly> </linker> "; return testProject; } } }
50.756208
147
0.652657
[ "MIT" ]
elinor-fung/sdk
src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToRunILLink.cs
22,485
C#
using System.Threading.Tasks; namespace App.Shared.Commands { public interface ICommandHandler<T> where T : ICommand { Task<ICommandResult> Handle(T command); } }
18.5
58
0.691892
[ "MIT" ]
carlosrogerioinfo/Core-API
App.Shared/Commands/ICommandHandler.cs
187
C#