NUnit.Framework.Assert.IsNotNull(object)

Here are the examples of the csharp api NUnit.Framework.Assert.IsNotNull(object) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

4552 Examples 7

19 View Source File : MaxSizeRollBackupsTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSaveCorrectly()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("appender");

            mSut.Value = "1";
            mSut.Save(xmlDoc, appender);

            XmlNode maxSizeNode = appender.SelectSingleNode("maxSizeRollBackups");

            replacedert.IsNotNull(maxSizeNode);
            replacedert.AreEqual("1", maxSizeNode.Attributes?["value"].Value);
        }

19 View Source File : DotNetTransformTests.cs
License : MIT License
Project Creator : AndresTraks

[Test]
        public void CreatesNativeMethodImports()
        {
            var @namespace = new NamespaceDefinition();
            var @clreplaced = new ClreplacedDefinition("CppClreplaced");
            var method = new MethodDefinition("method");

            @namespace.AddChild(@clreplaced);
            @clreplaced.AddChild(method);

            var rootFolder = new RootFolderDefinition("root");
            var header = new HeaderDefinition("header.h");
            rootFolder.AddChild(header);

            header.AddNode(@clreplaced);

            new DotNetTransformer().Transform(@namespace, rootFolder);

            var methodsHeader = rootFolder.Children.FirstOrDefault(c => c.Name == "UnsafeNativeMethods.cs");
            replacedert.IsNotNull(methodsHeader);

            var methodsClreplaced = @namespace.Children.FirstOrDefault(c => c.Name == "UnsafeNativeMethods") as ClreplacedDefinition;
            replacedert.IsNotNull(methodsClreplaced);

            replacedert.That(methodsClreplaced.Children, Has.Count.EqualTo(1));
            var nativeMethod = methodsClreplaced.Methods.First();

            replacedert.AreEqual("CppClreplaced_method", nativeMethod.Name);
            replacedert.IsTrue(nativeMethod.IsStatic);
            replacedert.IsTrue(nativeMethod.IsExtern);

            replacedert.That(nativeMethod.Parameters, Has.Length.EqualTo(1));
            var objParameter = nativeMethod.Parameters[0];

            replacedert.AreEqual("obj", objParameter.Name);
        }

19 View Source File : BackColorTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSaveSelectedLevel()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("mapping");

            mSut.SelectedColor = ConsoleColor.Blue;
            mSut.Save(xmlDoc, appender);

            XmlNode backColorNode = appender.SelectSingleNode("backColor");

            replacedert.IsNotNull(backColorNode);
            replacedert.AreEqual(ConsoleColor.Blue.ToString(), backColorNode.Attributes?["value"].Value);
        }

19 View Source File : LockingModelTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSaveIfNotExclusive()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("appender");

            mSut.SelectedModel = LockingModelDescriptor.Minimal;
            mSut.Save(xmlDoc, appender);

            XmlNode modelNode = appender.SelectSingleNode("lockingModel");

            replacedert.IsNotNull(modelNode);
            replacedert.AreEqual(LockingModelDescriptor.Minimal.TypeNamespace, modelNode.Attributes?["type"].Value);
        }

19 View Source File : ForeColorTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSaveSelectedLevel()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("mapping");

            mSut.SelectedColor = ConsoleColor.Blue;
            mSut.Save(xmlDoc, appender);

            XmlNode foreColorNode = appender.SelectSingleNode("foreColor");

            replacedert.IsNotNull(foreColorNode);
            replacedert.AreEqual(ConsoleColor.Blue.ToString(), foreColorNode.Attributes?["value"].Value);
        }

19 View Source File : XmlUtilitiesTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void AddAppenderRefToNode_ShouldNotDuplicateExistingRef()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement loggerElement = xmlDoc.CreateElement("logger");

            const string appenderName = "appenderName";
            xmlDoc.CreateElementWithAttribute("appender-ref", "ref", appenderName).AppendTo(loggerElement);

            XmlUtilities.AddAppenderRefToNode(xmlDoc, loggerElement, appenderName);

            XmlNodeList appenderRefs = loggerElement.SelectNodes($"appender-ref[@ref='{appenderName}']");

            replacedert.IsNotNull(appenderRefs);
            replacedert.AreEqual(1, appenderRefs.Count);
        }

19 View Source File : RemoteIdentityTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSave()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appenderElement = xmlDoc.CreateElement("appender");

            mSut.Value = "str";
            mSut.Save(xmlDoc, appenderElement);

            XmlNode idenreplacedyNode = appenderElement.SelectSingleNode("idenreplacedy");

            replacedert.IsNotNull(idenreplacedyNode);
            replacedert.AreEqual(mSut.Value, idenreplacedyNode.Attributes[Log4NetXmlConstants.Value].Value);
            replacedert.AreEqual(LayoutDescriptor.Pattern.TypeNamespace, idenreplacedyNode.Attributes[Log4NetXmlConstants.Type].Value);
        }

19 View Source File : StringMatchTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSave()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement filterElement = xmlDoc.CreateElement("filter");

            mSut.Value = "match";
            mSut.Save(xmlDoc, filterElement);

            XmlNode stringNode = filterElement.SelectSingleNode("stringToMatch");

            replacedert.IsNotNull(stringNode);
            replacedert.AreEqual(mSut.Value, stringNode.Attributes["value"].Value);
        }

19 View Source File : XmlMethodLoaderTest.cs
License : MIT License
Project Creator : arasplm

[Test]
		public void LoadMethod_ShouldReturnExpected()
		{
			//Arange
			var currentPath = System.AppDomain.CurrentDomain.BaseDirectory;
			var methodAmlPath = Path.Combine(currentPath, @"Code\TestData\MethodAml\ReturnNullMethodAml.xml");
			XmlMethodLoader xmlMethodLoader = new XmlMethodLoader();

			//Act
			XmlMethodInfo loadMethodResult = xmlMethodLoader.LoadMethod(methodAmlPath);

			//replacedert
			replacedert.IsNotNull(loadMethodResult);
			replacedert.AreEqual("\r\nreturn null;", loadMethodResult.Code);
			replacedert.AreEqual("ReturnNullMethodAml", loadMethodResult.MethodName);
			replacedert.AreEqual("C#", loadMethodResult.MethodType);
			replacedert.AreEqual(methodAmlPath, loadMethodResult.Path);
		}

19 View Source File : ThresholdTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSaveSelectedLevel()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("appender");

            mSut.SelectedValue = Level.All.Name;
            mSut.Save(xmlDoc, appender);

            XmlNode thresholdNode = appender.SelectSingleNode("threshold");

            replacedert.IsNotNull(thresholdNode);
            replacedert.AreEqual(Level.All.Name, thresholdNode.Attributes?["value"].Value);
        }

19 View Source File : LevelPropertyTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSaveSelectedLevel()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("appender");

            mSut.SelectedValue = Level.All.Name;
            mSut.Save(xmlDoc, appender);

            XmlNode thresholdNode = appender.SelectSingleNode("level");

            replacedert.IsNotNull(thresholdNode);
            replacedert.AreEqual(Level.All.Name, thresholdNode.Attributes?["value"].Value);
        }

19 View Source File : IncomingRefsTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldNotDuplicateExistingRef()
        {
            XmlElement loggerElement = mXmlDoc.CreateElement("logger");
            mXmlDoc.CreateElementWithAttribute("appender-ref", "ref", mNameProperty.Value).AppendTo(loggerElement);

            mSut.RefsCollection = new ObservableCollection<IAcceptAppenderRef>
            {
                new LoggerModel(loggerElement, true, LoggerDescriptor.Logger)
            };

            mSut.Save(mXmlDoc, mXmlDoc.CreateElement("appender"));

            XmlNodeList appenderRefs = loggerElement.SelectNodes($"appender-ref[@ref='{mNameProperty.Value}']");

            replacedert.IsNotNull(appenderRefs);
            replacedert.AreEqual(1, appenderRefs.Count);
        }

19 View Source File : LayoutToEnabledConverterTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Convert_ShouldReturnTrue_WhenPattern()
        {
            object value = mSut.Convert(LayoutDescriptor.Pattern, null, null, null);

            replacedert.IsNotNull(value);
            replacedert.IsTrue((bool)value);
        }

19 View Source File : MaximumFileSizeTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void ToolTip_ShouldBeInitialized()
        {
            replacedert.IsNotNull(mSut.ToolTip);
        }

19 View Source File : IncomingRefsTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldRemoveOldIncomingRefs_WhenNameHasChanged_AndRefIsEnabled()
        {
            //Original name is "appender0"
            mNameProperty.Value = "someOtherName";

            //Let's try to add a ref to the asyncAppender (which already exists with the original name)
            IAcceptAppenderRef loggerModel = mSut.RefsCollection.First(r => ((NamedModel)r).Name == "asyncAppender");
            loggerModel.IsEnabled = true;

            mSut.Save(mXmlDoc, mXmlDoc.CreateElement("appender"));

            //Selects all "appender-ref" nodes with the "ref" attribute
            XmlNodeList appenderRefs = loggerModel.Node.SelectNodes("appender-ref[@ref]");

            replacedert.IsNotNull(appenderRefs);
            replacedert.AreEqual(1, appenderRefs.Count);
            replacedert.AreEqual("someOtherName", appenderRefs[0].Attributes["ref"].Value);
        }

19 View Source File : RegexMatchTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSave()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement filterElement = xmlDoc.CreateElement("filter");

            mSut.Value = "match";
            mSut.Save(xmlDoc, filterElement);

            XmlNode regexNode = filterElement.SelectSingleNode("regexToMatch");

            replacedert.IsNotNull(regexNode);
            replacedert.AreEqual(mSut.Value, regexNode.Attributes["value"].Value);
        }

19 View Source File : EnumPropertyTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSave()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appenderElement = xmlDoc.CreateElement("appender");

            mSut.SelectedValue = MailPriority.High.ToString();
            mSut.Save(xmlDoc, appenderElement);

            XmlNode element = appenderElement.SelectSingleNode("elementName");
            replacedert.IsNotNull(element);
            replacedert.AreEqual(mSut.SelectedValue, element.Attributes["value"].Value);
        }

19 View Source File : FixTest.cs
License : MIT License
Project Creator : alexleen

[TestCase(FixFlags.None)]
        [TestCase(FixFlags.Partial)]
        [TestCase(FixFlags.Message | FixFlags.ThreadName | FixFlags.LocationInfo | FixFlags.UserName | FixFlags.Domain | FixFlags.Idenreplacedy | FixFlags.Exception | FixFlags.Properties)]
        public void Save_ShouldSaveCorrectly(FixFlags flags)
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("appender");

            foreach (FixModel fixModel in mSut.Fixes)
            {
                fixModel.Enabled = flags.HasFlag(fixModel.Flag);
            }

            mSut.Save(xmlDoc, appender);

            XmlNode fixNode = appender.SelectSingleNode("Fix");

            replacedert.IsNotNull(fixNode);
            replacedert.AreEqual(((int)flags).ToString(), fixNode.Attributes?["value"].Value);
        }

19 View Source File : FileTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSaveAppendTo_WhenOverwriteIsTrue()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("appender");

            mSut.Overwrite = true;
            mSut.Save(xmlDoc, appender);

            XmlNode appendToNode = appender.SelectSingleNode("appendToFile");

            replacedert.IsNotNull(appendToNode);
            replacedert.AreEqual("false", appendToNode.Attributes?["value"].Value);
        }

19 View Source File : CreateCodeItemViewModelTest.cs
License : MIT License
Project Creator : arasplm

[Test]
		public void Ctor_ShouldInitExpectedProperty()
		{
			//Arange
			ICodeItemProvider codeItemProvider = Subsreplacedute.For<ICodeItemProvider>();
			bool usedVSFormatting = true;

			//Act
			CreateCodeItemViewModel viewModel = new CreateCodeItemViewModel(codeItemProvider, usedVSFormatting);

			//replacedert
			replacedert.IsNotNull(viewModel.OKCommand);
			replacedert.IsNotNull(viewModel.CancelCommand);
			replacedert.IsNotNull(viewModel.CloseCommand);
			replacedert.AreEqual(usedVSFormatting, viewModel.IsUseVSFormattingCode);
			replacedert.AreEqual("File1", viewModel.FileName);
		}

19 View Source File : DatePatternTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldCreateAndAppendCorrectElement()
        {
            const string value = "yyyyMMdd";
            mSut.Value = value;
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("appender");

            mSut.Save(xmlDoc, appender);

            XmlElement datePattern = appender["datePattern"];
            replacedert.IsNotNull(datePattern);
            replacedert.AreEqual(value, datePattern.Attributes["value"].Value);
        }

19 View Source File : EncodingTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSaveSelectedValue_WhenSelected()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appenderElement = xmlDoc.CreateElement("appender");

            mSut.SelectedValue = "whatev";
            mSut.Save(xmlDoc, appenderElement);

            XmlNode encodingElement = appenderElement.SelectSingleNode("encoding");
            replacedert.IsNotNull(encodingElement);
            replacedert.AreEqual(mSut.SelectedValue, encodingElement.Attributes["value"].Value);
        }

19 View Source File : FileTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSaveFilePath()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("appender");

            mSut.FilePath = "filepath";
            mSut.Save(xmlDoc, appender);

            XmlNode fileNode = appender.SelectSingleNode("file");

            replacedert.IsNotNull(fileNode);
            replacedert.AreEqual("filepath", fileNode.Attributes?["value"].Value);
        }

19 View Source File : IncomingRefsTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldNotAddRef_WhenNotEnabled()
        {
            XmlElement loggerElement = mXmlDoc.CreateElement("logger");

            mSut.RefsCollection = new ObservableCollection<IAcceptAppenderRef>
            {
                new LoggerModel(loggerElement, false, LoggerDescriptor.Logger)
            };

            mSut.Save(mXmlDoc, mXmlDoc.CreateElement("appender"));

            XmlNodeList appenderRefs = loggerElement.SelectNodes($"appender-ref[@ref='{mNameProperty.Value}']");

            replacedert.IsNotNull(appenderRefs);
            replacedert.AreEqual(0, appenderRefs.Count);
        }

19 View Source File : FilterTypeToBoolConverterTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Convert_ShouldReturnFalse_WhenValueIsNotFilterModel()
        {
            object result = mSut.Convert(new object(), null, null, null);

            replacedert.IsNotNull(result);
            replacedert.IsFalse((bool)result);
        }

19 View Source File : LayoutTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldCreateConversionPatternElement_WhenNotSimple()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("appender");

            mSut.SelectedLayout = LayoutDescriptor.Pattern;
            mSut.Pattern = "%date{HH:mm:ss:fff} %message%newline";
            mSut.Save(xmlDoc, appender);

            replacedert.IsNotNull(appender[LayoutName][ConversionPatternName]);
            replacedert.AreEqual(mSut.Pattern, appender[LayoutName][ConversionPatternName].Attributes["value"].Value);
        }

19 View Source File : IncomingRefsTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldReduceRefCountToOne()
        {
            XmlElement loggerElement = mXmlDoc.CreateElement("logger");
            mXmlDoc.CreateElementWithAttribute("appender-ref", "ref", mNameProperty.Value).AppendTo(loggerElement);
            mXmlDoc.CreateElementWithAttribute("appender-ref", "ref", mNameProperty.Value).AppendTo(loggerElement);

            mSut.RefsCollection = new ObservableCollection<IAcceptAppenderRef>
            {
                new LoggerModel(loggerElement, true, LoggerDescriptor.Logger)
            };

            mSut.Save(mXmlDoc, mXmlDoc.CreateElement("appender"));

            XmlNodeList appenderRefs = loggerElement.SelectNodes($"appender-ref[@ref='{mNameProperty.Value}']");

            replacedert.IsNotNull(appenderRefs);
            replacedert.AreEqual(1, appenderRefs.Count);
        }

19 View Source File : LayoutToEnabledConverterTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Convert_ShouldReturnFalse_WhenSimple()
        {
            object value = mSut.Convert(LayoutDescriptor.Simple, null, null, null);

            replacedert.IsNotNull(value);
            replacedert.IsFalse((bool)value);
        }

19 View Source File : LevelToMatchTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSaveSelectedLevel()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("appender");

            mSut.SelectedValue = Level.All.Name;
            mSut.Save(xmlDoc, appender);

            XmlNode thresholdNode = appender.SelectSingleNode("levelToMatch");

            replacedert.IsNotNull(thresholdNode);
            replacedert.AreEqual(Level.All.Name, thresholdNode.Attributes?["value"].Value);
        }

19 View Source File : IncomingRefsTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldRemoveExistingRefs_WhenNotEnabled_AndNameHasChanged()
        {
            XmlElement loggerElement = mXmlDoc.CreateElement("logger");
            mXmlDoc.CreateElementWithAttribute("appender-ref", "ref", mNameProperty.Value).AppendTo(loggerElement);
            mXmlDoc.CreateElementWithAttribute("appender-ref", "ref", mNameProperty.Value).AppendTo(loggerElement);

            mSut.RefsCollection = new ObservableCollection<IAcceptAppenderRef>
            {
                new LoggerModel(loggerElement, false, LoggerDescriptor.Logger)
            };

            //Original name is "appender0"
            mNameProperty.Value = "someOtherName";

            mSut.Save(mXmlDoc, mXmlDoc.CreateElement("appender"));

            XmlNodeList appenderRefs = loggerElement.SelectNodes($"appender-ref[@ref='{mNameProperty.Value}' or @ref='{mNameProperty.OriginalName}']");

            replacedert.IsNotNull(appenderRefs);
            replacedert.AreEqual(0, appenderRefs.Count);
        }

19 View Source File : MaximumFileSizeTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSaveIfNotDefault()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("appender");

            mSut.Value = "100MB";
            mSut.Save(xmlDoc, appender);

            XmlNode maxFileSizeNode = appender.SelectSingleNode("maximumFileSize");

            replacedert.IsNotNull(maxFileSizeNode);
            replacedert.AreEqual(mSut.Value, maxFileSizeNode.Attributes["value"].Value);
        }

19 View Source File : XmlUtilitiesTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void AddAppenderRefToNode_ShouldSaveRef_WhenNoneExist()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement loggerElement = xmlDoc.CreateElement("logger");

            const string appenderName = "appenderName";
            XmlUtilities.AddAppenderRefToNode(xmlDoc, loggerElement, appenderName);

            XmlNodeList appenderRefs = loggerElement.SelectNodes($"appender-ref[@ref='{appenderName}']");

            replacedert.IsNotNull(appenderRefs);
            replacedert.AreEqual(1, appenderRefs.Count);
        }

19 View Source File : MaxLevelTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSaveSelectedLevel()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("appender");

            mSut.SelectedValue = Level.All.Name;
            mSut.Save(xmlDoc, appender);

            XmlNode levelNode = appender.SelectSingleNode("levelMax");

            replacedert.IsNotNull(levelNode);
            replacedert.AreEqual(Level.All.Name, levelNode.Attributes?["value"].Value);
        }

19 View Source File : SmallFactorizationTest.cs
License : GNU General Public License v3.0
Project Creator : AdamWhiteHat

[Order(4)]
		[Test]
		public void Test04_SquareRoot()
		{
			TestContext.WriteLine($"ENTER: {nameof(Test04_SquareRoot)}");

			replacedert.IsTrue(step03_preplaceded, "IsTrue(step03_preplaceded)");
			replacedert.IsNotNull(gnfs, "IsNotNull(gnfs)");

			int maxSetSize = gnfs.CurrentRelationsProgress.FreeRelations.Max(lst => lst.Count);

			List<Relation> choosenRelationSet = gnfs.CurrentRelationsProgress.FreeRelations.Where(lst => lst.Count == maxSetSize).First();

			SquareFinder squareRootFinder = new SquareFinder(gnfs, choosenRelationSet);

			squareRootFinder.CalculateRationalSide();
			Tuple<BigInteger, BigInteger> foundFactors = squareRootFinder.CalculateAlgebraicSide(cancelToken);

			/*	Non-trivial factors also recoverable by doing the following:
			
			BigInteger min = BigInteger.Min(squareRootFinder.RationalSquareRootResidue, squareRootFinder.AlgebraicSquareRootResidue);
			BigInteger max = BigInteger.Max(squareRootFinder.RationalSquareRootResidue, squareRootFinder.AlgebraicSquareRootResidue);
			BigInteger R = max - min;
			BigInteger S = max + min;
			BigInteger P = GCD.FindGCD(gnfs.N, S);
			BigInteger Q = GCD.FindGCD(gnfs.N, R);

			*/

			BigInteger P = foundFactors.Item1;
			BigInteger Q = foundFactors.Item2;

			replacedert.AreNotEqual(1, P, "AreNotEqual(1, P)");
			replacedert.AreNotEqual(1, Q, "AreNotEqual(1, Q)");

			replacedert.AreEqual(new BigInteger(1811), P, "AreEqual(1811, P)");
			replacedert.AreEqual(new BigInteger(1777), Q, "AreEqual(1777, Q)");

			step04_preplaceded = true;

			TestContext.WriteLine($"{nameof(Test04_SquareRoot)} preplaceded?: {step04_preplaceded}");
			TestContext.WriteLine($"LEAVE: {nameof(Test04_SquareRoot)}");
		}

19 View Source File : MinLevelTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSaveSelectedLevel()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("appender");

            mSut.SelectedValue = Level.All.Name;
            mSut.Save(xmlDoc, appender);

            XmlNode levelNode = appender.SelectSingleNode("levelMin");

            replacedert.IsNotNull(levelNode);
            replacedert.AreEqual(Level.All.Name, levelNode.Attributes?["value"].Value);
        }

19 View Source File : XmlUtilitiesTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void AddAppenderRefToNode_ShouldReduceRefCountToOne()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement loggerElement = xmlDoc.CreateElement("logger");

            const string appenderName = "appenderName";
            xmlDoc.CreateElementWithAttribute("appender-ref", "ref", appenderName).AppendTo(loggerElement);
            xmlDoc.CreateElementWithAttribute("appender-ref", "ref", appenderName).AppendTo(loggerElement);

            XmlUtilities.AddAppenderRefToNode(xmlDoc, loggerElement, appenderName);

            XmlNodeList appenderRefs = loggerElement.SelectNodes($"appender-ref[@ref='{appenderName}']");

            replacedert.IsNotNull(appenderRefs);
            replacedert.AreEqual(1, appenderRefs.Count);
        }

19 View Source File : RemoteAddressTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSave()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appenderElement = xmlDoc.CreateElement("appender");

            mSut.Value = "1.2.3.4";
            mSut.Save(xmlDoc, appenderElement);

            XmlNode regexNode = appenderElement.SelectSingleNode("remoteAddress");

            replacedert.IsNotNull(regexNode);
            replacedert.AreEqual(mSut.Value, regexNode.Attributes["value"].Value);
        }

19 View Source File : RollingStyleTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSave_WhenNotComposite()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("appender");

            mSut.SelectedMode = RollingFileAppender.RollingMode.Date;
            mSut.Save(xmlDoc, appender);

            XmlNode rollingStyleNode = appender.SelectSingleNode("rollingStyle");

            replacedert.IsNotNull(rollingStyleNode);
            replacedert.AreEqual("Date", rollingStyleNode.Attributes["value"].Value);
        }

19 View Source File : FiltersTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSaveEachExistingFilter()
        {
            mSut.AddFilter.Execute(FilterDescriptor.DenyAll);
            mSut.AddFilter.Execute(FilterDescriptor.DenyAll);

            XmlElement newAppender = mXmlDoc.CreateElement("appender");

            mSut.Save(mXmlDoc, newAppender);

            XmlNodeList appenderRefs = newAppender.SelectNodes($"filter[@type='{FilterDescriptor.DenyAll.TypeNamespace}']");

            replacedert.IsNotNull(appenderRefs);
            replacedert.AreEqual(2, appenderRefs.Count);
        }

19 View Source File : NumericPropertyTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldCreateAndAppendCorrectElement_WhenNotDefault()
        {
            NumericProperty<int> sut = CreateSut<int>();

            const string value = "10000";

            sut.Value = value;
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("appender");

            sut.Save(xmlDoc, appender);

            XmlElement numProp = appender["numProp"];
            replacedert.IsNotNull(numProp);
            replacedert.AreEqual(value, numProp.Attributes["value"].Value);
        }

19 View Source File : IncomingRefsTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSaveRef_WhenNoneExist()
        {
            XmlElement loggerElement = mXmlDoc.CreateElement("logger");

            mSut.RefsCollection = new ObservableCollection<IAcceptAppenderRef>
            {
                new LoggerModel(loggerElement, true, LoggerDescriptor.Logger)
            };

            mSut.Save(mXmlDoc, mXmlDoc.CreateElement("appender"));

            XmlNodeList appenderRefs = loggerElement.SelectNodes($"appender-ref[@ref='{mNameProperty.Value}']");

            replacedert.IsNotNull(appenderRefs);
            replacedert.AreEqual(1, appenderRefs.Count);
        }

19 View Source File : SmallFactorizationTest.cs
License : GNU General Public License v3.0
Project Creator : AdamWhiteHat

[Order(2)]
		[Test]
		public void Test02_GenerateRelations()
		{
			TestContext.WriteLine($"ENTER: {nameof(Test02_GenerateRelations)}");
			replacedert.IsTrue(step01_preplaceded, "IsTrue(step01_preplaceded)");
			replacedert.IsNotNull(gnfs, "IsNotNull(gnfs)");

			bool success = false;

			while (!cancelToken.IsCancellationRequested)
			{
				if (gnfs.CurrentRelationsProgress.SmoothRelationsCounter >= gnfs.CurrentRelationsProgress.SmoothRelations_TargetQuanreplacedy)
				{
					gnfs.CurrentRelationsProgress.IncreaseTargetQuanreplacedy(100);
				}

				gnfs.CurrentRelationsProgress.GenerateRelations(cancelToken);

				Console.Write(".");

				if (gnfs.CurrentRelationsProgress.SmoothRelationsCounter >= gnfs.CurrentRelationsProgress.SmoothRelations_TargetQuanreplacedy)
				{
					success = true;
					break;
				}
			}

			replacedert.IsTrue(success, "IsTrue(success)");

			step02_preplaceded = success;

			TestContext.WriteLine($"{nameof(Test02_GenerateRelations)} preplaceded?: {step02_preplaceded}");
			TestContext.WriteLine($"LEAVE: {nameof(Test02_GenerateRelations)}");
		}

19 View Source File : GlobalConfigurationTest.cs
License : MIT License
Project Creator : arasplm

[Test]
		public void GetUserCodeTemplatesPaths_Should()
		{
			//Arange
			string currentPath = AppDomain.CurrentDomain.BaseDirectory;
			string configFilePath = Path.Combine(currentPath, @"Configurations\TestData\config.xml");
			MockConfigFilePath(configFilePath);
			this.iOWrapper.FileExists(configFilePath).Returns(File.Exists(configFilePath));

			XmlDoreplacedent xmlDoreplacedent = new XmlDoreplacedent();
			xmlDoreplacedent.Load(configFilePath);
			this.iOWrapper.XmlDoreplacedentLoad(configFilePath).Returns(xmlDoreplacedent);
			GlobalConfigurationTestProxy globalConfigurationTest = new GlobalConfigurationTestProxy(this.iOWrapper);

			//Act
			List<string> actualUserCodeTemlates = globalConfigurationTest.GetUserCodeTemplatesPaths();

			//replacedert
			replacedert.AreEqual(2, actualUserCodeTemlates.Count);
			foreach (var actualUserCodeTemlate in actualUserCodeTemlates)
			{
				XmlNode userCodeTemlate = xmlDoreplacedent.SelectSingleNode($"//userCodeTemplate[text()=\"{actualUserCodeTemlate}\"]");
				replacedert.IsNotNull(userCodeTemlate);
			}
		}

19 View Source File : CategoryTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSaveCorrectValue()
        {
            mSut.Value = "whatev";

            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("appender");

            mSut.Save(xmlDoc, appender);

            XmlElement category = appender["category"];
            replacedert.IsNotNull(category);
            replacedert.AreEqual(LayoutDescriptor.Pattern.TypeNamespace, category.Attributes[Log4NetXmlConstants.Type].Value);

            XmlElement conversionPattern = category["conversionPattern"];
            replacedert.IsNotNull(conversionPattern);
            replacedert.AreEqual("whatev", conversionPattern.Attributes[Log4NetXmlConstants.Value].Value);
        }

19 View Source File : TargetTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldSaveIfConsoleError()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("appender");

            mSut.SelectedItem = ConsoleError;
            mSut.Save(xmlDoc, appender);

            XmlNode targetNode = appender.SelectSingleNode("target");

            replacedert.IsNotNull(targetNode);
            replacedert.AreEqual(ConsoleError, targetNode.Attributes?["value"].Value);
        }

19 View Source File : SmallFactorizationTest.cs
License : GNU General Public License v3.0
Project Creator : AdamWhiteHat

[Order(1)]
		[Test]
		public void Test01_GNFSCreate()
		{
			while (!step00_preplaceded)
			{
				Thread.SpinWait(100);
			}

			TestContext.WriteLine($"ENTER: {nameof(Test01_GNFSCreate)}");

			replacedert.IsTrue(step00_preplaceded, "IsTrue(step00_preplaceded)");

			gnfs = new GNFS(cancelToken, Console.WriteLine, N, polyBase, degree, primeBound, relationQuanreplacedy, relationValueRange);

			replacedert.IsNotNull(gnfs, "IsNotNull(gnfs)");

			replacedert.IsTrue(gnfs.PrimeFactorBase.RationalFactorBase.Any(), "IsTrue(gnfs.PrimeFactorBase.RATIONALFactorBase.Any())");
			replacedert.IsTrue(gnfs.PrimeFactorBase.AlgebraicFactorBase.Any(), "IsTrue(gnfs.PrimeFactorBase.ALGEBRAICFactorBase.Any())");
			replacedert.IsTrue(gnfs.PrimeFactorBase.QuadraticFactorBase.Any(), "IsTrue(gnfs.PrimeFactorBase.QUADRATICFactorBase.Any())");

			replacedert.IsTrue(gnfs.RationalFactorPairCollection.Any(), "IsTrue(gnfs.RATIONALFactorPairCollection.Any())");
			replacedert.IsTrue(gnfs.AlgebraicFactorPairCollection.Any(), "IsTrue(gnfs.ALGEBRAICFactorPairCollection.Any())");
			replacedert.IsTrue(gnfs.QuadraticFactorPairCollection.Any(), "IsTrue(gnfs.QUADRATICFactorPairCollection.Any())");

			step01_preplaceded = true;

			TestContext.WriteLine($"{nameof(Test01_GNFSCreate)} preplaceded?: {step01_preplaceded}");
			TestContext.WriteLine($"LEAVE: {nameof(Test01_GNFSCreate)}");
		}

19 View Source File : SmallFactorizationTest.cs
License : GNU General Public License v3.0
Project Creator : AdamWhiteHat

[Order(3)]
		[Test]
		public void Test03_Matrix()
		{
			TestContext.WriteLine($"ENTER: {nameof(Test03_Matrix)}");

			replacedert.IsTrue(step02_preplaceded, "IsTrue(step02_preplaceded)");
			replacedert.IsNotNull(gnfs, "IsNotNull(gnfs)");

			MatrixSolve.GaussianSolve(cancelToken, gnfs);

			replacedert.IsTrue(gnfs.CurrentRelationsProgress.FreeRelations.Any(), "IsTrue(gnfs.CurrentRelationsProgress.FreeRelations.Any())");

			step03_preplaceded = true;

			TestContext.WriteLine($"{nameof(Test03_Matrix)} preplaceded?: {step03_preplaceded}");
			TestContext.WriteLine($"LEAVE: {nameof(Test03_Matrix)}");
		}

19 View Source File : IncomingRefsTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldRemoveExistingRefs_WhenNotEnabled()
        {
            XmlElement loggerElement = mXmlDoc.CreateElement("logger");
            mXmlDoc.CreateElementWithAttribute("appender-ref", "ref", mNameProperty.Value).AppendTo(loggerElement);
            mXmlDoc.CreateElementWithAttribute("appender-ref", "ref", mNameProperty.Value).AppendTo(loggerElement);

            mSut.RefsCollection = new ObservableCollection<IAcceptAppenderRef>
            {
                new LoggerModel(loggerElement, false, LoggerDescriptor.Logger)
            };

            mSut.Save(mXmlDoc, mXmlDoc.CreateElement("appender"));

            XmlNodeList appenderRefs = loggerElement.SelectNodes($"appender-ref[@ref='{mNameProperty.Value}']");

            replacedert.IsNotNull(appenderRefs);
            replacedert.AreEqual(0, appenderRefs.Count);
        }

19 View Source File : LayoutToEnabledConverterTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Convert_ShouldReturnFalse_WhenNone()
        {
            object value = mSut.Convert(LayoutDescriptor.None, null, null, null);

            replacedert.IsNotNull(value);
            replacedert.IsFalse((bool)value);
        }

19 View Source File : LayoutTest.cs
License : MIT License
Project Creator : alexleen

[Test]
        public void Save_ShouldCreateAndAppendCorrectElement()
        {
            XmlDoreplacedent xmlDoc = new XmlDoreplacedent();
            XmlElement appender = xmlDoc.CreateElement("appender");

            mSut.Save(xmlDoc, appender);

            XmlElement layout = appender[LayoutName];
            replacedert.IsNotNull(layout);
            replacedert.AreEqual(LayoutDescriptor.Simple.TypeNamespace, layout.Attributes["type"].Value);
        }

See More Examples