Ejemplo n.º 1
0
        public IEnumerator JohnCanLogOut()
        {
            yield return(OnFacet <AuthenticationFacet> .Call(
                             nameof(AuthenticationFacet.Login),
                             "John"
                             ).AsCoroutine());

            yield return(OnFacet <AuthenticationFacet> .Call(
                             nameof(AuthenticationFacet.Logout)
                             ).AsCoroutine());

            yield return(OnFacet <AuthenticationFacet> .Call <PlayerEntity>(
                             nameof(AuthenticationFacet.GetPlayer)
                             ).Then(p => {
                Assert.IsNull(p);
            }).AsCoroutine());

            yield return(OnFacet <AuthenticationFacet> .Call <bool>(
                             nameof(AuthenticationFacet.Check)
                             ).Then(c => {
                Assert.IsFalse(c);
            }).AsCoroutine());

            yield return(OnFacet <AuthenticationFacet> .Call <string>(
                             nameof(AuthenticationFacet.Id)
                             ).Then(id => {
                Assert.IsNull(id);
            }).AsCoroutine());
        }
Ejemplo n.º 2
0
        public void TestEqualList()
        {
            var v1 = new LogicVar();
            var v2 = new LogicVar();

            var goal  = MicroKanren.Equal(new [] { 5, 6 }, new[] { v1, v2 });
            var subst = goal(MicroKanren.GetEmptySubst()).SingleOrDefault();

            Assert.NotNull(subst);
            Assert.AreEqual(5, subst.GetValue(v1));
            Assert.AreEqual(6, subst.GetValue(v2));

            goal  = MicroKanren.Equal(new object[] { 5, 5, v1 }, new[] { v1, v1, v2 });
            subst = goal(MicroKanren.GetEmptySubst()).SingleOrDefault();

            Assert.NotNull(subst);
            Assert.AreEqual(5, subst.GetValue(v1));
            Assert.AreEqual(5, subst.GetValue(v2));

            goal = MicroKanren.Equal(new[] { 5, 6, 7 }, new[] { v1, v2 });
            Assert.IsNull(goal(MicroKanren.GetEmptySubst()));

            var v3 = new LogicVar();

            goal = MicroKanren.Equal(new[] { 5, 6 }, new[] { v1, v2, v3 });
            Assert.IsNull(goal(MicroKanren.GetEmptySubst()));
        }
        public void DecodeQuotedPrintable_Null()
        {
            // Null should be returned if Null is specified.

            Assert.IsNull(
                vCardStandardReader.DecodeQuotedPrintable(null));
        }
Ejemplo n.º 4
0
        public static void Null(object value)
        {
#if XUNIT
            FrameworkAssert.Null(value);
#else
            FrameworkAssert.IsNull(value);
#endif
        }
        public void EncodeQuotedPrintable_Null()
        {
            // The function should return null if null is
            // passed to it.  A future version might return
            // String.Empty or raise an exception; the best
            // behavior is under investigation.

            Assert.IsNull(
                vCardStandardWriter.EncodeQuotedPrintable((string)null));
        }
Ejemplo n.º 6
0
        public void Basic()
        {
            var dict = IQ.From <Dog>().AsDictionaries().First();

            Assert.AreEqual(1, dict["pk"]);

            dict = IQ.From <Dog>().Select("pk").AsDictionaries().First();
            Assert.AreEqual(1, dict["pk"]);
            Assert.IsTrue(dict.ContainsKey("breed"), "The dictionary contains keys for anything bound in the object");
            Assert.IsNull(dict["breed"], "The value in the dict is the default value from the object");
        }
        public void TestTryValidateRequiredFieldHappyPathForInheritedClass()
        {
            var msg = "";
            RequiredFieldBase inheritedObject = new RequiredFieldDerived()
            {
                BaseStringType     = "Payments",
                DerivedIntegerType = 10
            };

            var res = SwagValidator.TryValidate(inheritedObject, out msg);

            Assert.IsTrue(res);
            Assert.IsNull(msg);
        }
        public void Constructor()
        {
            // Tests the default values of the vCardSource
            // class when the parameterless constructor is used.

            vCardSource source = new vCardSource();

            Assert.IsEmpty(
                source.Context,
                "The Context property should default to empty.");

            Assert.IsNull(
                source.Uri,
                "The Uri property should default to null.");
        }
Ejemplo n.º 9
0
        public void TestConjunctionDifferent()
        {
            var v1 = new LogicVar();
            var v2 = new LogicVar();

            var goal1 = MicroKanren.Equal(v1, 5);
            var goal2 = MicroKanren.Equal(v2, "6");
            var goal3 = MicroKanren.Equal(v2, v1);

            var conjGoal = MicroKanren.Conjunction(goal3, MicroKanren.Conjunction(goal1, goal2));

            var subst = conjGoal(MicroKanren.GetEmptySubst());

            Assert.IsNull(subst);
        }
        public void CreateAndDeleteNewObjectWithScalars() {
            var person = CreateNewTransientPerson();
            var name = Guid.NewGuid().ToString();
            person.Name = name;

            var adapter = Save(person);

            var person1 = Persistor.Instances<Person>().SingleOrDefault(p => p.Name == name);
            Assert.IsNotNull(person1);

            Delete(adapter.Object);

            var person2 = Persistor.Instances<Person>().SingleOrDefault(p => p.Name == name);

            Assert.IsNull(person2);
        }
Ejemplo n.º 11
0
        private void CallbackMatcherTest3(Mock <IParentInterface> mock)
        {
            var callback = new CallbackMatcher <Action>();

            mock.Expects.One.Method(_ => _.AsyncMethod((Action)null)).With(callback);

            var presenter = new TestPresenter(mock.MockObject);

            presenter.ShowDialog();

            Assert.IsNull(presenter.Status);

            callback.Callback();

            Assert.AreEqual(TestPresenter.SHOW_DIALOG, presenter.Status);
        }
Ejemplo n.º 12
0
        public void Constructor()
        {
            vCardProperty property = new vCardProperty();

            Assert.IsNotNull(
                property.Subproperties,
                "The subproperties collection was not created.");

            Assert.IsEmpty(
                property.Subproperties,
                "The subproperties collection should be empty.");

            Assert.IsNull(
                property.Value,
                "The value should be null.");
        }
Ejemplo n.º 13
0
        public void ReadWriteProperty_BirthDate()
        {
            vCard card = new vCard();

            card.BirthDate = DateTime.Parse("04/04/04");

            Assert.AreEqual(
                DateTime.Parse("04/04/04"),
                card.BirthDate.Value,
                "The BirthDate property was not set.");

            card.BirthDate = null;

            Assert.IsNull(
                card.BirthDate,
                "The BirthDate property was not set to null.");
        }
Ejemplo n.º 14
0
        public void SelectedLayerNullIfLayerRemoved()
        {
            var map     = new Map();
            var path    = Path.Combine("TestFiles", "test-randomPts.shp");
            var myLayer = map.AddLayer(path);

            Assert.IsNotNull(myLayer, "the added map layer should not be null.");

            myLayer.IsSelected = true;
            Assert.AreEqual(map.Layers.SelectedLayer, myLayer, "the selected layer should be equal to myLayer.");

            //now remove all layers
            map.Layers.Clear();

            //selectedLayer should be null
            Assert.IsNull(map.Layers.SelectedLayer, "SelectedLayer should be null after removing all layers");
        }
Ejemplo n.º 15
0
        public IEnumerator FirstThereIsNoAuthenticatedPlayer()
        {
            yield return(OnFacet <AuthenticationFacet> .Call <PlayerEntity>(
                             nameof(AuthenticationFacet.GetPlayer)
                             ).Then(p => {
                Assert.IsNull(p);
            }).AsCoroutine());

            yield return(OnFacet <AuthenticationFacet> .Call <bool>(
                             nameof(AuthenticationFacet.Check)
                             ).Then(c => {
                Assert.IsFalse(c);
            }).AsCoroutine());

            yield return(OnFacet <AuthenticationFacet> .Call <string>(
                             nameof(AuthenticationFacet.Id)
                             ).Then(id => {
                Assert.IsNull(id);
            }).AsCoroutine());
        }
Ejemplo n.º 16
0
        public void TestEqualDifferent()
        {
            var v1 = new LogicVar();
            var v2 = new LogicVar();

            var goal1 = MicroKanren.Equal(v1, 5);
            var goal2 = MicroKanren.Equal(v2, "5");

            var subst1 = goal1(MicroKanren.GetEmptySubst()).SingleOrDefault();

            Assert.IsNull(MicroKanren.Equal(6, v1)(subst1));

            var subst2 = goal2(subst1).SingleOrDefault();

            Assert.NotNull(subst2);
            Assert.AreEqual(5, subst2.GetValue(v1));
            Assert.AreEqual("5", subst2.GetValue(v2));

            Assert.IsNull(MicroKanren.Equal(v2, v1)(subst2));
        }
Ejemplo n.º 17
0
        public void Constructor_Name()
        {
            vCardProperty property = new vCardProperty("NAME");

            Assert.AreEqual(
                "NAME",
                property.Name,
                "The name is incorrect.");

            Assert.IsNull(
                property.Value,
                "The value should be null.");

            Assert.IsNotNull(
                property.Subproperties,
                "The subproperties collection was not created.");

            Assert.IsEmpty(
                property.Subproperties,
                "The subproperties collection should be empty.");
        }
Ejemplo n.º 18
0
 public static void IsNull(object value) =>
 TestAssert.IsNull(value);
Ejemplo n.º 19
0
 public void ThenThePatientNDDShouldBeNull()
 {
     Assert.IsNull(_patient.NDD, "NDD expected to be null");
 }
Ejemplo n.º 20
0
        public void TestUrlFromUnversionedPath()
        {
            Uri url = this.Client.GetUriFromWorkingCopy(@"C:\");

            Assert.IsNull(url, "Url should be null for an unversioned path");
        }
 public void DecodeEscaped_Null()
 {
     Assert.IsNull(
         vCardStandardReader.DecodeEscaped((string)null));
 }